jurpe.dungeon
Class DungeonLevels

java.lang.Object
  extended by jurpe.dungeon.DungeonLevels
All Implemented Interfaces:
java.io.Serializable

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

Dungeon Levels class. This class handles the persistance of dungeon levels on files. When it is first called it initialize the initial number of levels. With "createDungeons()" it creates the village (openspace) dungeon plus the number of dungeons in numberOfLevels. When created, the dungeon is serialized. Through "getDungeonLevel(int)" this class returns the related RpgMap object deserializing it from the disk.

See Also:
Serialized Form

Constructor Summary
DungeonLevels(Dungeons inDungeon, int levels)
          Constructor
 
Method Summary
 void addLevels()
          Add LEVELS_GAP levels to the dungeon.
 void createLevels()
          Create dungeon levels.
 void destroyLevelFiles()
          Delete level files
 Level getDungeonLevel(int level)
          Get the dungeon map associated with that level
 int getNumberOfLevels()
          Get number of levels
static Level restore(int level)
          Get a serialized Level
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DungeonLevels

public DungeonLevels(Dungeons inDungeon,
                     int levels)
Constructor

Parameters:
inDungeon - Handle to dungeon
levels - int Initial Number of dungeons to be created
Method Detail

createLevels

public void createLevels()
Create dungeon levels. When created, the level is then serialized.


addLevels

public void addLevels()
Add LEVELS_GAP levels to the dungeon. The level are created and then serialized.


destroyLevelFiles

public void destroyLevelFiles()
Delete level files


getNumberOfLevels

public int getNumberOfLevels()
Get number of levels

Returns:
int Number of Levels

getDungeonLevel

public Level getDungeonLevel(int level)
                      throws JurpeException
Get the dungeon map associated with that level

Parameters:
level - int Level. If zero, returns the Village (open space).
Returns:
RpgMap The map level. If null, new levels have to be generated
Throws:
JurpeException

restore

public static Level restore(int level)
                     throws java.io.InvalidClassException
Get a serialized Level

Parameters:
level - int Dungeon map level
Returns:
RpgMap
Throws:
java.io.InvalidClassException

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net