de.adom.jade.world
Class LocationManager

java.lang.Object
  extended by de.adom.jade.world.LocationManager
All Implemented Interfaces:
java.io.Serializable

public class LocationManager
extends java.lang.Object
implements java.io.Serializable

Handles all locations of the game. The manager is responsible for storing the locations on hard disk if the ressources are in danger to become exhausted and retrieving the locations, if they are required.

Currently all locations are stored in memory. At some point this behaviour will have to be modified.

See Also:
Serialized Form

Constructor Summary
LocationManager()
          Creates an empty location manager.
 
Method Summary
 void addLocation(Location location)
          Adds a new location to the location manager.
 void connect(int x1, int y1, Location location1, int x2, int y2, Location location2)
          Connects to locations.
 Location getCurrentLocation()
          Returns the current location used by the world for map display.
 Location getLocation(java.lang.String logicalName)
          Retrieves a location based on its logical name.
 void setCurrentLocation(Location location)
          Defines the current location on which the PC is active.
 boolean switchLocation(Being being, Connection connection)
          Switches the location for the given being.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationManager

public LocationManager()
Creates an empty location manager.

Method Detail

addLocation

public void addLocation(Location location)
Adds a new location to the location manager.

Parameters:
location - the location to add

getLocation

public Location getLocation(java.lang.String logicalName)
Retrieves a location based on its logical name.

Parameters:
logicalName - the logical name of the location to be retrieved
Returns:
the requested location

setCurrentLocation

public void setCurrentLocation(Location location)
Defines the current location on which the PC is active.

Parameters:
location - the new current location

getCurrentLocation

public Location getCurrentLocation()
Returns the current location used by the world for map display.

Returns:
he current location

connect

public void connect(int x1,
                    int y1,
                    Location location1,
                    int x2,
                    int y2,
                    Location location2)
Connects to locations.

Parameters:
x1 - the x position of the first location
y1 - the y position of the first location
location1 - the first location
x2 - the x position of the second location
y2 - the y position of the second location
location2 - the second location

switchLocation

public boolean switchLocation(Being being,
                              Connection connection)
Switches the location for the given being.

Parameters:
being - the being to switch the location
connection - the connection used to switch locations
Returns:
a boolean value indicating whether the new location could be entered