20 package net.sf.gridarta.model.mapmodel;
22 import java.awt.Point;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.HashSet;
27 import java.util.Iterator;
28 import java.util.List;
47 import org.apache.log4j.Category;
48 import org.apache.log4j.Logger;
49 import org.jetbrains.annotations.NotNull;
50 import org.jetbrains.annotations.Nullable;
75 private final transient Object
syncLock =
new Object();
211 public void mapMetaChanged() {
216 public void mapSizeChanged(@NotNull
final Size2D mapSize) {
232 public DefaultMapModel(@NotNull
final AutojoinLists<G, A, R> autojoinLists, @NotNull
final A mapArchObject, @NotNull
final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull
final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull
final GameObjectMatchers gameObjectMatchers, @NotNull
final InsertionMode<G, A, R> topmostInsertionMode) {
240 mapArchObject.addMapArchObjectListener(mapArchObjectListener);
247 mapArchObject.removeMapArchObjectListener(mapArchObjectListener);
269 for (
final G gameObject : objects) {
270 if (!gameObject.isInContainer()) {
271 addGameObjectToMap(gameObject,
new Point(gameObject.getMapX(), gameObject.getMapY()), topmostInsertionMode);
292 if (newSize.equals(mapSize)) {
296 final Collection<GameObject<G, A, R>> objectsToDelete =
new HashSet<>();
305 if (mapSize.
getWidth() > newSize.getWidth()) {
310 if (mapSize.
getHeight() > newSize.getHeight()) {
334 final Iterator<MapSquare<G, A, R>> it = mapSquares.iterator();
335 while (it.hasNext()) {
337 if (mapSquare.
getMapX() >= mapSize.getWidth() || mapSquare.
getMapY() >= mapSize.getHeight()) {
349 final Iterator<G> it2 = gameObjects.iterator();
350 while (it2.hasNext()) {
353 if (topGameObject.getContainer() == null || topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) {
361 mapModelListeners.
add(listener);
366 mapModelListeners.
remove(listener);
371 mapTransactionListeners.
add(listener);
376 mapTransactionListeners.
remove(listener);
381 if (transactionDepth == 0) {
382 LOG.error(
"beginSquareChange: square (" + mapSquare +
") is about to change outside a transaction");
391 if (transactionDepth == 0) {
392 LOG.error(
"endSquareChange: square (" + mapSquare +
") was changed outside a transaction");
393 final Set<MapSquare<G, A, R>> mapSquares =
new HashSet<>(1);
394 mapSquares.add(mapSquare);
395 lightMapModelTracker.
mapSquaresChanged(Collections.unmodifiableCollection(mapSquares));
399 changedSquares.add(mapSquare);
406 if (transactionDepth == 0) {
407 LOG.error(
"beginGameObjectChange: game object (" + gameObject.getBestName() +
"@" + gameObject.getMapSquare() +
") is about to change outside a transaction");
412 assert mapSquare != null;
418 if (transactionDepth == 0) {
419 LOG.error(
"endGameObjectChange: game object (" + gameObject.getBestName() +
"@" + gameObject.getMapSquare() +
") was changed outside a transaction");
420 final Set<G> gameObjects =
new HashSet<>(1);
421 gameObjects.add(gameObject);
425 changedGameObjects.add(gameObject);
432 if (transactionDepth == 0) {
433 LOG.error(
"transientGameObjectChange: game object (" + gameObject.getBestName() +
"@" + gameObject.getMapSquare() +
") was changed outside a transaction");
434 final Set<G> gameObjects =
new HashSet<>(1);
435 gameObjects.add(gameObject);
439 transientChangedGameObjects.add(gameObject);
446 if (transactionDepth == 0) {
448 transactionThread = Thread.currentThread();
454 if (transactionThread != Thread.currentThread()) {
455 throw new IllegalStateException(
"A transaction must only be used by one thread.");
468 if (transactionDepth <= 0) {
469 throw new IllegalStateException(
"Tried to end a transaction but no transaction was open.");
472 assert transactionDepth >= 0;
473 if (transactionDepth == 0) {
475 }
else if (fireEvent && transactionDepth == 1) {
488 final Collection<MapSquare<G, A, R>> mapSquares =
new HashSet<>(
changedSquares);
489 for (
final G gameObject : changedGameObjects) {
491 if (mapSquare != null) {
492 mapSquares.add(mapSquare);
499 if (!changedGameObjects.isEmpty() || !transientChangedGameObjects.isEmpty()) {
500 transientChangedGameObjects.removeAll(changedGameObjects);
503 for (
final G gameObject : changedGameObjects) {
504 if (gameObject.isHead()) {
505 for (G env = gameObject; env != null; env = env.getContainerGameObject()) {
513 fireGameObjectsChangedEvent(Collections.unmodifiableSet(changedGameObjects), Collections.unmodifiableSet(transientChangedGameObjects));
514 changedGameObjects.clear();
516 if (!changedSquares.isEmpty()) {
518 changedSquares.clear();
524 if (transactionDepth > 0) {
534 transactionDepth = 0;
535 transactionThread = null;
548 return transactionDepth > 0;
558 listener.mapSquaresChanged(mapSquares);
568 if (!gameObjects.isEmpty()) {
572 listener.mapObjectsChanged(gameObjects, transientGameObjects);
583 listener.mapSizeChanged(newSize);
592 listener.preBeginTransaction();
601 savedSquares.
clear();
603 listener.beginTransaction(name);
612 listener.endTransaction(savedSquares);
614 savedSquares.
clear();
622 listener.postEndTransaction();
632 listener.mapFileChanged(oldMapFile);
641 listener.modifiedChanged();
648 assert mapSquare != null;
649 if (gameObject.isInContainer()) {
663 final Point point =
new Point(part.getMultiX(), part.getMultiY());
664 point.translate(pos.x, pos.y);
666 if (!mapArchObject.isPointValid(point)) {
671 final String temp = part.getArchetypeName();
673 if (node.getArchetype().getArchetypeName().equals(temp)) {
687 listener.errorsChanged(errors);
704 if (!mapArchObject.isPointValid(pos)) {
708 final G newGameObject;
710 if (nextGameObject == null || nextGameObjectEnv == null) {
711 newGameObject =
insertBaseObject(templateBaseObject, pos,
true, join, topmostInsertionMode);
712 if (newGameObject == null) {
717 for (
final G gameObject : mapGrid.
getMapSquare(pos.x, pos.y).reverse()) {
720 if (gameObject == nextGameObject) {
725 for (
int i = 0; i < position - 1; i++) {
726 newGameObject.moveDown();
729 newGameObject = templateBaseObject.newInstance(gameObjectFactory);
730 nextGameObjectEnv.
addLast(newGameObject);
731 if (templateBaseObject instanceof
Archetype) {
736 return newGameObject;
742 if (!mapArchObject.isPointValid(pos)) {
746 final R realArchetype = baseObject.getArchetype();
747 final R effectiveArchetype;
751 if (gameObject != null) {
756 if (effectiveArchetype == null) {
760 effectiveArchetype = realArchetype;
767 final Integer direction = effectiveArchetype.usesDirection() ? archetypeChooserModel.
getDirection() : null;
769 final List<G> parts =
new ArrayList<>();
770 for (R archetypePart = effectiveArchetype; archetypePart != null; archetypePart = archetypePart.getMultiNext()) {
772 if (archetypePart == effectiveArchetype) {
773 part = baseObject.newInstance(gameObjectFactory);
774 part.setArchetype(archetypePart);
776 part = archetypePart.newInstance(gameObjectFactory);
778 if (direction != null) {
781 if (!parts.isEmpty()) {
782 parts.get(0).addTailPart(part);
787 for (
final G part : parts) {
788 final int mapX = pos.x + part.getArchetype().getMultiX();
789 final int mapY = pos.y + part.getArchetype().getMultiY();
790 insertionMode.insert(part, mapGrid.
getMapSquare(mapX, mapY));
793 final G head = parts.get(0);
803 if (!mapArchObject.isPointValid(pos)) {
804 LOG.error(
"addGameObjectToMap: trying to insert game object out of map bounds at " + pos.x +
"/" + pos.y +
", map bounds is " + mapArchObject.getMapSize());
808 insertionMode.insert(gameObject, mapGrid.
getMapSquare(pos.x, pos.y));
812 public void moveEnv(@NotNull
final G gameObject, @NotNull
final Point pos, @NotNull
final G nextGameObject) {
813 if (!nextGameObject.isHead()) {
814 throw new IllegalArgumentException();
816 assert !gameObject.isMulti();
818 if (nextGameObject.isInContainer()) {
819 nextGameObjectContainer = nextGameObject.getContainer();
820 if (nextGameObjectContainer == null) {
821 throw new IllegalArgumentException();
827 if (mapSquare == null || mapSquare.
getMapModel() !=
this) {
828 throw new IllegalArgumentException();
831 nextGameObjectContainer.
insertAfter(nextGameObject, gameObject);
834 if (!nextGameObject.isInContainer() && gameObject.getArchetype().isMulti()) {
835 final Point tmp =
new Point();
836 for (R archetypeTail = gameObject.getArchetype().getMultiNext(); archetypeTail != null; archetypeTail = archetypeTail.getMultiNext()) {
837 final G gameObjectTail = archetypeTail.newInstance(gameObjectFactory);
838 gameObject.addTailPart(gameObjectTail);
839 tmp.x = pos.x + archetypeTail.getMultiX();
840 tmp.y = pos.y + archetypeTail.getMultiY();
848 if (!gameObject.isHead() || !prevGameObject.isHead()) {
849 throw new IllegalArgumentException();
853 gameObject.removeTailParts();
854 prevGameObject.addFirst(gameObject);
858 public boolean isAreaEmpty(
final int left,
final int top,
final int width,
final int height) {
859 final Point point =
new Point();
860 for (
int x = left; x < left + width; x++) {
862 for (
int y = top; y < top + height; y++) {
875 if ((activeEditType & editType) != editType) {
878 for (
final Iterable<G> mapSquare :
this) {
887 activeEditType |= editType;
893 if (this.mapFile == null ? mapFile == null : this.mapFile.equals(mapFile)) {
912 if (thisMapFile == null) {
916 if (newMapFile.
equals(thisMapFile)) {
917 throw new SameMapException();
925 final List<G> gameObjects =
new ArrayList<>();
926 for (
final Iterable<G> mapSquare :
this) {
927 for (
final G gameObject : mapSquare) {
928 if (gameObject.isHead()) {
929 gameObjects.add(gameObject);
955 for (
final Iterable<G> mapSquare :
this) {
956 for (
final G gameObject : mapSquare) {
957 gameObject.facesReloaded();
966 public void nextPoint(
final Point point,
final int direction) {
967 final Size2D mapSize = mapArchObject.getMapSize();
970 if (point.x >= mapSize.
getWidth()) {
1008 assert gameObject.isHead();
1009 if (checkType == 0) {
1015 final int editType = gameObject.getEditType();
1017 final int newEditType = retainedEditType |
calculateEditType(gameObject, checkType);
1018 gameObject.setEditType(newEditType);
1030 final int matcherEditType = matcher.getEditType();
1031 if ((matcherEditType & checkType) != 0 && matcher.isMatching(gameObject)) {
1032 editType |= matcherEditType;
1050 if (archetype.isMulti()) {
1055 if (autojoinList == null) {
1060 final boolean isMainIndex = autojoinList.isMainIndex(archetype);
1062 if (gameObject != null) {
1063 final R gameObjectArchetype = gameObject.getArchetype();
1064 final boolean isExistingMainIndex = autojoinList.isMainIndex(gameObjectArchetype);
1067 if (isExistingMainIndex) {
1075 if (isExistingMainIndex) {
1079 if (gameObjectArchetype == archetype) {
1087 final int altIndex = isMainIndex ? -1 : autojoinList.getAlternativeIndex(archetype);
1093 final R newArchetype = isMainIndex ? autojoinList.
getArchetype(newIndex) : archetype;
1094 if (gameObject != null) {
1095 gameObject.setArchetype(newArchetype);
1101 private int joinInsert(@NotNull
final Point point, @NotNull
final AutojoinList<G, A, R> autojoinList,
final int dx,
final int dy,
final int dir,
final int reverseDir,
final int altIndex) {
1102 final Point tmp =
new Point(point.x + dx, point.y + dy);
1103 if (!mapArchObject.isPointValid(tmp)) {
1108 if (gameObject == null) {
1113 final int index = autojoinList.getAlternativeIndex(archetype);
1115 return (index & reverseDir) == 0 ? 0 : dir;
1118 final int archetypeIndex = autojoinList.getIndex(archetype);
1120 if ((altIndex & dir) == 0) {
1121 newIndex = archetypeIndex & ~reverseDir;
1123 newIndex = archetypeIndex | reverseDir;
1125 gameObject.
setArchetype(autojoinList.getArchetype(newIndex));
1137 private void joinDelete(@NotNull
final Point point, @NotNull
final R archetype) {
1138 if (archetype.isMulti()) {
1143 if (autojoinList == null) {
1147 final boolean isMainIndex = autojoinList.
isMainIndex(archetype);
1156 private void joinDelete(@NotNull
final Point point, @NotNull
final AutojoinList<G, A, R> autojoinList,
final int dx,
final int dy,
final int reverseDir,
final int dir,
final int altIndex) {
1157 if ((altIndex & reverseDir) == 0) {
1161 final Point tmp =
new Point(point.x + dx, point.y + dy);
1162 if (!mapArchObject.isPointValid(tmp)) {
1167 if (gameObject == null) {
1184 for (
final G gameObject :
getMapSquare(point).reverse()) {
1185 if (autojoinLists.
getAutojoinList(gameObject.getArchetype()) == autojoinList) {
1204 final R archetype = gameObject.getArchetype();
1205 if (autojoinLists.
getAutojoinList(archetype) == autojoinList && autojoinList.isMainIndex(archetype)) {
void addMapTransactionListener(@NotNull final MapTransactionListener< G, A, R > listener)
void updateEditType(@NotNull final GameObject< G, A, R > gameObject, final int checkType)
Updates the edit type of a GameObject.
int getMapX()
Returns the x coordinate on the map.
void fireEvents()
Deliver all pending events.
G insertBaseObject(@NotNull final BaseObject< G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode< G, A, R > insertionMode)
Interface for listeners listening on map arch object changes.
G insertArchToMap(@NotNull final BaseObject< G, A, R, ?> templateBaseObject, @Nullable final G nextGameObject, @NotNull final Point pos, final boolean join)
I'm too complex
DefaultMapModel(@NotNull final AutojoinLists< G, A, R > autojoinLists, @NotNull final A mapArchObject, @NotNull final ArchetypeChooserModel< G, A, R > archetypeChooserModel, @NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final InsertionMode< G, A, R > topmostInsertionMode)
Create a new instance.
final Set< G > transientChangedGameObjects
The ArrayList with transient changed gameObjects.
Exception thrown if the destination path points to the source map.
boolean isMultiArchFittingToMap(@NotNull final Archetype< G, A, R > archetype, @NotNull final Point pos, final boolean allowDouble)
R getArchetype()
Returns the Archetype that should be inserted.
void fireGameObjectsChangedEvent(@NotNull final Set< G > gameObjects, @NotNull final Set< G > transientGameObjects)
Fire a GameObjectsChangedEvent.
MapSquare< G, A, R > getMapSquare()
A MapModel reflects the data of a map.
void resizeMapInt(@NotNull final Size2D newSize)
Resizes the map grid after the map size has changed.
void firePreBeginTransaction()
Fire a pre-begin transaction event.
T [] getListeners()
Returns an array of all the listeners.
boolean modified
Set if the map has changed since last save.
void recordMapSquare(@NotNull final MapSquare< G, A, R > mapSquare)
Records a map square as changed.
void endGameObjectChange(@NotNull final G gameObject)
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
abstract MapSquare< G, A, R > getMapSquare()
Returns the MapSquare of this container.
final EventListenerList2< MapTransactionListener< G, A, R > > mapTransactionListeners
The registered MapTransactionListeners.
T getMultiNext()
Returns the next of this multi-part object.
final AutojoinLists< G, A, R > autojoinLists
The AutojoinLists for performing autojoining.
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
This package contains the framework for validating maps.
MapSquare< G, A, R > getMapSquare(@NotNull final Point pos)
void setArchetype(@NotNull R archetype)
Set the Archetype of this GameObject.
void beginSquareChange(@NotNull final MapSquare< G, A, R > mapSquare)
void removeMapModelListener(@NotNull final MapModelListener< G, A, R > listener)
void endSquareChange(@NotNull final MapSquare< G, A, R > mapSquare)
void setMapFile(@Nullable final MapFile mapFile)
Interface for listeners listening on MapModel events.
void nextPoint(final Point point, final int direction)
G getContainerGameObject()
Returns the environment game object if this game object is in the inventory or.
void resize(@NotNull final Size2D newSize)
Resizes the map grid to a new size.
boolean isAnyTransactionActive()
void beginTransaction(@NotNull final String name)
Base class for classes that contain GameObjects as children in the sense of containment.
final LightMapModelTracker< G, A, R > lightMapModelTracker
The LightMapModelTracker tracking this instance.
Represents a maps directory local map path.
boolean isEmpty()
Returns whether the map is empty.
Decorates an arbitrary GameObjectMatcher with a localized name that is suitable for the user interfac...
final transient MapArchObjectListener mapArchObjectListener
The MapArchObjectListener used to detect changes in mapArchObject and set the modified flag according...
void createInventory(@NotNull GameObject< G, A, R > gameObject, @NotNull Iterable< G > archetype)
Copies inventory objects from an archetype into a game object.
void setModified()
Marks the map as being modified.
final A mapArchObject
The MapArchObject associated with this model.
ErrorCollector< G, A, R > errors
The errors of this map model.
G findGameObjectOfAutojoinList(@NotNull final Point point, @NotNull final AutojoinList< G, A, R > autojoinList)
Looks for an archetype at map-position point which is part of an autojoin list.
int getTransactionDepth()
InsertionResult< G, A, R > joinInsert(@NotNull final Point point, @NotNull final R archetype)
Do autojoining on insertion of an game object on the map.
int transactionDepth
The transaction depth.
Contains a list of (typically wall-)arches which do autojoining.
void addActiveEditType(final int editType)
Base package of all Gridarta classes.
void setErrors(@NotNull final ErrorCollector< G, A, R > errors)
Interface for listeners listening on map transactions of MapModels.
final GameObjectFactory< G, A, R > gameObjectFactory
The GameObjectFactory for creating GameObjects.
Reflects a game object (object on a map).
boolean equals(@Nullable final Object obj)
Abstract factory for creating GameObject instances.
void fireBeginTransaction(@NotNull final String name)
Fire a begin transaction event.
void discardInvalidMapSquares(@NotNull final Iterable< MapSquare< G, A, R >> mapSquares, @NotNull final Size2D mapSize)
Discards map squares that are out of map bounds.
void removeGameObject(@NotNull final G gameObject, final boolean join)
String DIRECTION
The attribute name of the object's direction.
void fireMapFileChanged(@Nullable final MapFile oldMapFile)
Fires a map file changed event.
void remove(@NotNull final T listener)
Removes a listener.
boolean isMainIndex(@NotNull final R archetype)
Returns the index of an Archetype if it is a main archetype for any direction.
void mapSizeChanging(@NotNull final Size2D newSize, @NotNull final Size2D oldSize)
Called whenever the tracked map is about to change size.
GameObjects are the objects based on Archetypes found on maps.
void removeMapTransactionListener(@NotNull final MapTransactionListener< G, A, R > listener)
List< G > getAllGameObjects()
void add(@NotNull final T listener)
Adds a listener.
int joinInsert(@NotNull final Point point, @NotNull final AutojoinList< G, A, R > autojoinList, final int dx, final int dy, final int dir, final int reverseDir, final int altIndex)
int getWidth()
Returns the width of the area.
void transientGameObjectChange(@NotNull final G gameObject)
Maintains GameObjectMatcher instances.
Point getMapLocation()
Returns the coordinate on the map.
int calculateEditType(@NotNull final GameObject<?, ?, ?> gameObject, final int checkType)
Returns the edit type for a GameObject.
void fireMapSizeChanged(@NotNull final Size2D newSize)
Fire a map size changed event.
AutojoinList< G, A, R > getAutojoinList(@NotNull final Archetype< G, A, R > archetype)
Returns an AutojoinList for a given archetype.
final Set< G > changedGameObjects
The ArrayList with changed gameObjects.
void addMapModelListener(@NotNull final MapModelListener< G, A, R > listener)
void clearMap()
This implementation is very safe by recreating every single MapSquare as new empty square with the tr...
void endAllTransactions()
void insertAfter(@Nullable final G previousGameObject, @NotNull final G gameObject)
Add a GameObject after another.
MapFile mapFile
The backing map file.
static final long serialVersionUID
The serial version UID.
void fireEndTransaction()
Fire an end transaction event.
void mapSquaresChanged(@NotNull final Iterable< MapSquare< G, A, R >> mapSquares)
Called whenever some game objects have changed.
void joinDelete(@NotNull final Point point, @NotNull final R archetype)
Do autojoining on deletion of an GameObject on the map.
void addObjectListToMap(@NotNull final Iterable< G > objects)
MapSquare< G, A, R > getMapSquare(final int x, final int y)
Returns the MapSquare at a given location.
static final Category LOG
The Logger for printing log messages.
R getArchetype()
Returns the Archetype this GameObject is based on.
final transient Object syncLock
Sync Lock Object.
final EventListenerList2< MapModelListener< G, A, R > > mapModelListeners
The registered MapModelListeners.
void fireMapSquaresChangedEvent(final Set< MapSquare< G, A, R >> mapSquares)
Fire a MapSquaresChangedEvent.
final GameObjectMatchers gameObjectMatchers
The GameObjectMatchers to use.
Type-safe version of EventListenerList.
int getAlternativeIndex(@NotNull final R archetype)
Returns the index of an Archetype if it is an alternative archetype for any direction.
final SavedSquares< G, A, R > savedSquares
Records unchanged square contents for all squares in changedSquares.
void addGameObjectToMap(@NotNull final G gameObject, @NotNull final Point pos, @NotNull final InsertionMode< G, A, R > insertionMode)
Iterator< MapSquare< G, A, R > > iterator()
void clear()
Forgets all saved squares.
final Set< MapSquare< G, A, R > > changedSquares
The ArrayList with changed squares.
final InsertionMode< G, A, R > topmostInsertionMode
The "topmost" InsertionMode.
The view of the archetype chooser.
Exception thrown if an operation is attempted on an unsaved map.
Manages a mapping between archetypes to AutojoinLists.
MapFile getMapFile(@NotNull final MapPath mapPath)
void moveInv(@NotNull final G gameObject, @NotNull final GameObject< G, A, R > prevGameObject)
An interface for classes that collect errors.
void endTransaction(final boolean fireEvent)
void firePostEndTransaction()
Fire a post-end transaction event.
void moveEnv(@NotNull final G gameObject, @NotNull final Point pos, @NotNull final G nextGameObject)
G getGameObject()
Returns the GameObject that has been modified.
G getTopContainer()
Get the topmost container of this GameObject (in Game sense, which means being in a MapSquare isn't...
void remove(@NotNull final G gameObject)
Remove a GameObject from this container.
final MapSquareGrid< G, A, R > mapGrid
The map, containing all arches grid-wise.
Simple error collector that just collects the error in a collection for later retrieval through itera...
void fireModifiedChanged()
Fires a map size changed event.
int getHeight()
Returns the height of the area.
Size2D getMapSize()
Returns the size of this map grid in map squares.
GameObject< G, A, R > findMainGameObjectOfAutojoinList(@NotNull final Point point, @NotNull final AutojoinList< G, A, R > autojoinList)
Looks for an archetype at map-position point which is the main archetypes part of an autojoin list...
void joinDelete(@NotNull final Point point, @NotNull final AutojoinList< G, A, R > autojoinList, final int dx, final int dy, final int reverseDir, final int dir, final int altIndex)
void addLast(@NotNull G gameObject)
Add the given GameObject at the end of this Container.
void commitTransaction()
Performs ending a transaction.
The result of an insertion operation involving autojoining.
final ArchetypeChooserModel< G, A, R > archetypeChooserModel
The ArchetypeChooserModel to use when inserting directional game objects.
ErrorCollector< G, A, R > getErrors()
void discardInvalidGameObjects(@NotNull final Iterable< G > gameObjects, @NotNull final Size2D mapSize)
Discards game objects that are out of map bounds.
int activeEditType
Contains the edit types that have already been (requested and) calculated (edit types get calculated ...
void collectHeads(final int minX, final int minY, final int maxX, final int maxY, @NotNull final Collection< GameObject< G, A, R >> objectsToDelete)
Adds all head parts for game object within an area to a collection.
The location of a map file with a map directory.
int getMapY()
Returns the y coordinate on the map.
Interface for MapArchObjects.
transient Thread transactionThread
The thread that performs the current transaction.
Implementation of MapModel that covers the similarities between crossfire and daimonin.
void beginGameObjectChange(@NotNull final G gameObject)
boolean isAreaEmpty(final int left, final int top, final int width, final int height)
The class Size2D represents a 2d rectangular area.
Integer getDirection()
Returns the default direction for game objects created from archetypes.
Iterator for iterating over all squares of a model.