 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.validation.checks;
22 import java.io.IOException;
40 import org.jetbrains.annotations.NotNull;
46 public class ExitChecker<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractValidator<G, A, R> implements
GameObjectValidator<G, A, R> {
78 if (path.length() <= 0 || path.equals(
"/!") || path.startsWith(
"/random/")) {
82 final int exitX = gameObject.getAttributeInt(
BaseObject.
HP);
83 final int exitY = gameObject.getAttributeInt(
BaseObject.
SP);
91 if ((exitX != -1 || exitY != -1) && (exitX < 0 || exitX >= mapSize.
getWidth() || exitY < 0 || exitY >= mapSize.
getHeight())) {
97 }
catch (
final IOException ignored) {
int getWidth()
Returns the width of the area.
Exception thrown if the destination path points to the source map.
void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector< G, A, R > errorCollector)
Validates a game object.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
A MapManager manages all opened maps.
Base package of all Gridarta classes.
String SP
The attribute name of the "sp" attribute.
final int exitTypeNo
The archetype type number of exits.
ExitChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapManager< G, A, R > mapManager, final int exitTypeNo)
Creates a new instance.
A Validator to assert that exits are connected to maps properly.
static MapPath newMapPath(@NotNull final String string)
Creates a MapPath instance from string representation.
Reflects a game object (object on a map).
Utility class for MapPath related functions.
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
Configuration parameters for Validators.
GameObjects are the objects based on Archetypes found on maps.
int getHeight()
Returns the height of the area.
Interface for MapArchObjects.
MapControl< G, A, R > openMapFile(@NotNull MapFile mapFile, boolean interactive)
Loads a map file.
An interface for classes that collect errors.
This is the base class for validators.
Exception thrown if an operation is attempted on an unsaved map.
This package contains the framework for validating maps.
String SLAYING
The name of the "slaying" attribute.
The location of a map file with a map directory.
void release(@NotNull MapControl< G, A, R > mapControl)
Releases a MapControl instance.
final MapManager< G, A, R > mapManager
The MapManager for loading maps.
Interface for GameObject Validators.
Currently nothing more than a marker interface for unification.
MapModel< G, A, R > getMapModel()
Returns the map model.
String HP
The attribute name of the "hp" attribute.
Validation error that's used when a map has wrong exit paths.
The class Size2D represents a 2d rectangular area.
Validation error that's used when an exit points to an invalid position.