Package VASSAL.build
Class GpIdChecker
java.lang.Object
VASSAL.build.GpIdChecker
Build a cross-reference of all GpId-able elements in a module or ModuleExtension,
Check for missing, duplicate or illegal GamePieceId's
Update if necessary
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(PrototypeDefinition prototype) Add any PieceSlots contained in traits in a Prototype DefinitionvoidAdd a PieceSlot to our cross-reference and any PlaceMarker traits it contains.protected voidcheckTrait(GamePiece gp) Check for PlaceMarker traits in a GamePiece and add them to the cross-referenceprotected voidcheckTrait(GamePiece gp, PrototypeDefinition prototype, GamePiece definition) protected voidCopy as much state information as possible from the old piece to the new piececreateUpdatedPiece(GamePiece oldPiece) Locate the SlotElement that matches oldPiece and return a new GamePiece created from that Slot.protected StringfindState(GamePiece oldPiece, GamePiece pNew, Decorator decoratorNewPc, Class<? extends GamePiece> classToFind) Locate a Decorator in the old piece that has the exact same type as the new Decorator and return it's statevoidRepair any errors - Update the next GpId in the module if necessary - Generate new GpId's for slots with errors.booleanWhere any errors found?protected voidValidate a GamePieceId.booleanbooleanbooleanuseName()boolean
-
Field Details
-
gpIdSupport
-
maxId
protected int maxId -
extensionsLoaded
protected boolean extensionsLoaded
-
-
Constructor Details
-
GpIdChecker
public GpIdChecker() -
GpIdChecker
-
GpIdChecker
-
-
Method Details
-
useLabelerName
public boolean useLabelerName() -
useLayerName
public boolean useLayerName() -
useRotateName
public boolean useRotateName() -
useName
public boolean useName() -
add
Add a PieceSlot to our cross-reference and any PlaceMarker traits it contains.- Parameters:
pieceSlot- PieceSlot to add to cross-reference
-
add
Add any PieceSlots contained in traits in a Prototype Definition- Parameters:
prototype- Prototype Definition to check
-
checkTrait
Check for PlaceMarker traits in a GamePiece and add them to the cross-reference- Parameters:
gp- GamePiece to check
-
checkTrait
-
testGpId
Validate a GamePieceId. - non-null - Integer - Not a duplicate of any other GpId Keep a list of the good Slots and the slots with errors. Also track the maximum GpId- Parameters:
id- GpId to testelement- Containing SlotElement
-
hasErrors
public boolean hasErrors()Where any errors found?- Returns:
- Error count
-
fixErrors
public void fixErrors()Repair any errors - Update the next GpId in the module if necessary - Generate new GpId's for slots with errors. -
createUpdatedPiece
Locate the SlotElement that matches oldPiece and return a new GamePiece created from that Slot. Match by ID, if it does not work, match by name if option is ON- Parameters:
oldPiece- Old GamePiece- Returns:
- Newly created GamePiece
-
copyState
Copy as much state information as possible from the old piece to the new piece- Parameters:
oldPiece- Piece to copy state fromnewPiece- Piece to copy state to
-
findState
protected String findState(GamePiece oldPiece, GamePiece pNew, Decorator decoratorNewPc, Class<? extends GamePiece> classToFind) Locate a Decorator in the old piece that has the exact same type as the new Decorator and return it's state- Parameters:
oldPiece- Old piece to searchclassToFind- Class to match- Returns:
- state of located matching Decorator
-