Package VASSAL.build
Class GpIdChecker
java.lang.Object
VASSAL.build.GpIdChecker
public class GpIdChecker extends Object
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 Modifier and Type Field Description protected boolean
extensionsLoaded
protected GpIdSupport
gpIdSupport
protected int
maxId
protected boolean
useName
-
Constructor Summary
Constructors Constructor Description GpIdChecker()
GpIdChecker(boolean useName)
GpIdChecker(GpIdSupport gpIdSupport)
-
Method Summary
Modifier and Type Method Description void
add(PrototypeDefinition prototype)
Add any PieceSlots contained in traits in a Prototype Definitionvoid
add(PieceSlot pieceSlot)
Add a PieceSlot to our cross-reference and any PlaceMarker traits it contains.protected void
checkTrait(GamePiece gp)
Check for PlaceMarker traits in a GamePiece and add them to the cross-referenceprotected void
checkTrait(GamePiece gp, PrototypeDefinition prototype, GamePiece definition)
GamePiece
createUpdatedPiece(GamePiece oldPiece)
Locate the SlotElement that matches oldPiece and return a new GamePiece created from that Slot.boolean
findUpdatedPiece(GamePiece oldPiece)
void
fixErrors()
Repair any errors - Update the next GpId in the module if necessary - Generate new GpId's for slots with errors.boolean
hasErrors()
Where any errors found?protected void
testGpId(String id, VASSAL.build.GpIdChecker.SlotElement element)
Validate a GamePieceId.
-
Field Details
-
gpIdSupport
-
maxId
protected int maxId -
useName
protected boolean useName -
extensionsLoaded
protected boolean extensionsLoaded
-
-
Constructor Details
-
GpIdChecker
public GpIdChecker() -
GpIdChecker
-
GpIdChecker
public GpIdChecker(boolean useName)
-
-
Method Details
-
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.- Parameters:
oldPiece
- Old GamePiece- Returns:
- Newly created GamePiece
-
findUpdatedPiece
-