de.farafin.snEADy.inOut
Class C_LevelLoader

java.lang.Object
  extended by de.farafin.snEADy.inOut.C_LevelLoader
All Implemented Interfaces:
I_Constants, I_LevelLoader_interface

public final class C_LevelLoader
extends java.lang.Object
implements I_Constants, I_LevelLoader_interface

This class loads level files.

Version:
$Revision: 1.20 $
Author:
roland, lars
See Also:
FileReader

Field Summary
 
Fields inherited from interface de.farafin.snEADy.communication.I_Constants
analyse_ms, auto_grow_delay, auto_slowdown_delay, autogamespeed, closemonitor, damage_length_grow, damage_points_radius, DEBUG, delplayer, easy_points, ejectreplay, emergencyPause, exit_time, FACE_EAST, FACE_NORTH, FACE_SOUTH, FACE_WEST, game_end, goody_length_occ, goody_length_value, goody_points_occ, goody_points_value, goody_shorter_occ, goody_shorter_value, goody_slowdown_occ, goody_speed_occ, IN_ACTION, IN_ERROR_EXC, IN_ERROR_INIT, IN_ERROR_SPACE, IN_ERROR_TIME, IN_EXIT, IN_HEAVEN, init_length, init_move_delay, kill, kill_point_goodies, kill_points_radius, loaddummy, loadhuman, loadlevel, loadplayer, loadscript, logging, max_goody_occ_delay, MAX_HUMAN_PLAYERS, max_mem_check_delay, max_move_delay, max_player_mem, MAX_PLAYERS, max_thinking_ms, memkill, min_cycle_ms, min_move_delay, MOVE_EAST, MOVE_NORTH, MOVE_SOUTH, MOVE_WEST, openmonitor, overalldelay, pause, player_controlling, print_calc_ms, print_parameter, print_player_mem, print_playfield, quit, record, recordname, replay, replay_reverse, replay_stepwidth, replay_stepwise, run, set, show_subcycles, start, stop, suddend_time, survival_points, timekill, tolerance_ms, TURN_LEFT, TURN_NONE, TURN_RIGHT
 
Constructor Summary
C_LevelLoader()
           
 
Method Summary
private  D_Level load(java.lang.String root, java.lang.String levName, boolean loadPlayfield)
          This method loads the level.
 D_Level loadLevel(java.lang.String levName)
          its almost the same funktion, with the root directory of "levels".
 D_Level loadLevel(java.lang.String root, java.lang.String levName)
          Loads a level file into a D_Level object
 D_Level loadLevelHeader(java.lang.String levName)
          Loads only the header of the File into a D_Level objecrt.
 D_Level loadLevelHeader(java.lang.String root, java.lang.String levName)
          Loads only the header of the File into a D_Level objecrt.
private  java.lang.String removeComents(java.lang.String str)
          if a string has a coment tag '%' inside, than only the part before its first accuence will be taken and returned.
private  java.lang.String removeSpaces(java.lang.String str)
          removes ONLY leading spaces and spaces at the end. spaces in the middle of the string are ignored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

C_LevelLoader

public C_LevelLoader()
Method Detail

removeComents

private java.lang.String removeComents(java.lang.String str)
if a string has a coment tag '%' inside, than only the part before its first accuence will be taken and returned.

Parameters:
str - an string
Returns:
the beginning of str befre the first '%'

removeSpaces

private java.lang.String removeSpaces(java.lang.String str)
removes ONLY leading spaces and spaces at the end. spaces in the middle of the string are ignored

Parameters:
str -
Returns:
the clear string

load

private D_Level load(java.lang.String root,
                     java.lang.String levName,
                     boolean loadPlayfield)
              throws java.io.FileNotFoundException,
                     E_LevelFileException
This method loads the level. All other funktions are rooting in here.

Parameters:
root - the realtive root directory to snEADy mainfolder
levName - The name of the level that should be loaded
loadPlayfield - either the Playfield should be loaded or not.
Returns:
the level, if loadPlayfield == false, playFiled will be null.
Throws:
java.io.FileNotFoundException
E_LevelFileException

loadLevelHeader

public D_Level loadLevelHeader(java.lang.String root,
                               java.lang.String levName)
                        throws E_LevelFileException,
                               java.io.FileNotFoundException
Description copied from interface: I_LevelLoader_interface
Loads only the header of the File into a D_Level objecrt. The playfield is ignored.

Specified by:
loadLevelHeader in interface I_LevelLoader_interface
Returns:
returns everything but the playfield in a level data object
Throws:
E_LevelFileException
java.io.FileNotFoundException

loadLevelHeader

public D_Level loadLevelHeader(java.lang.String levName)
                        throws E_LevelFileException,
                               java.io.FileNotFoundException
Description copied from interface: I_LevelLoader_interface
Loads only the header of the File into a D_Level objecrt. The playfield is ignored. its almost the same funktion, with the root directory of "levels".

Specified by:
loadLevelHeader in interface I_LevelLoader_interface
Parameters:
levName - levName the name of the level that should be loaded. Its the name of the file, the level may have an different name.
Returns:
the loaded level see here for file specifications: @see D_ModuleCom.D_File_Level
Throws:
E_LevelFileException - if the file was found, but in a wrong format
java.io.FileNotFoundException - if the file was not found
See Also:
I_LevelLoader_interface.loadLevelHeader(String, String)

loadLevel

public D_Level loadLevel(java.lang.String root,
                         java.lang.String levName)
                  throws E_LevelFileException,
                         java.io.FileNotFoundException
Description copied from interface: I_LevelLoader_interface
Loads a level file into a D_Level object

Specified by:
loadLevel in interface I_LevelLoader_interface
Parameters:
root - the root-path of the levelFolder. Its only possible to point to folders which are subfolders of the gake-folder
levName - the name of the level that should be loaded. Its the name of the file, the level may have an different name.
Returns:
the loaded level see here for file specifications: @see D_ModuleCom.D_File_Level
Throws:
E_LevelFileException - if the file was found, but in a wrong format
java.io.FileNotFoundException - if the file was not found

loadLevel

public D_Level loadLevel(java.lang.String levName)
                  throws E_LevelFileException,
                         java.io.FileNotFoundException
Description copied from interface: I_LevelLoader_interface
its almost the same funktion, with the root directory of "levels".

Specified by:
loadLevel in interface I_LevelLoader_interface
Parameters:
levName - levName the name of the level that should be loaded. Its the name of the file, the level may have an different name.
Returns:
the loaded level see here for file specifications: @see D_ModuleCom.D_File_Level
Throws:
E_LevelFileException - if the file was found, but in a wrong format
java.io.FileNotFoundException - if the file was not found
See Also:
I_LevelLoader_interface.loadLevel(String, String)