Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

LevelLoading Class Reference

Inheritance diagram for LevelLoading:

Inheritance graph
[legend]
Collaboration diagram for LevelLoading:

Collaboration graph
[legend]

Detailed Description

Game loading.

Definition at line 13 of file LevelLoading.h.

Public Member Functions

 LevelLoading (RoomAccess *access)
void reset ()
void loadGame (const std::string &moves)
 Start loading mode.
void loadReplay (const std::string &moves)
 Start replay mode.
void togglePause ()
bool isPaused () const
bool isLoading () const
void nextLoadAction ()
 Load a few moves.


Constructor & Destructor Documentation

LevelLoading::LevelLoading RoomAccess access  ) 
 

Definition at line 17 of file LevelLoading.cpp.

00018 {
00019     m_access = access;
00020     reset();
00021 }


Member Function Documentation

bool LevelLoading::isLoading  )  const
 

Definition at line 33 of file LevelLoading.cpp.

00034 {
00035     return !m_loadedMoves.empty() || m_replayMode;
00036 }

bool LevelLoading::isPaused  )  const [inline]
 

Definition at line 28 of file LevelLoading.h.

00028 { return m_paused; }

void LevelLoading::loadGame const std::string &  moves  ) 
 

Start loading mode.

Parameters:
moves saved moves to load

Definition at line 43 of file LevelLoading.cpp.

00044 {
00045     m_loadedMoves = moves;
00046     m_loadSpeed = min(50, max(5, m_loadedMoves.size() / 150));
00047 }

void LevelLoading::loadReplay const std::string &  moves  ) 
 

Start replay mode.

Parameters:
moves saved moves to load

Definition at line 54 of file LevelLoading.cpp.

00055 {
00056     m_loadedMoves = moves;
00057     m_loadSpeed = 1;
00058     m_replayMode = true;
00059 }

void LevelLoading::nextLoadAction  ) 
 

Load a few moves.

Exceptions:
LoadException for bad load

Definition at line 66 of file LevelLoading.cpp.

00067 {
00068     if (m_paused) {
00069         return;
00070     }
00071 
00072     if (m_loadedMoves.empty()) {
00073         m_access->room()->beginFall(false);
00074         m_access->room()->finishRound(false);
00075     }
00076     else {
00077         for (int i = 0; i < m_loadSpeed
00078                 && !m_loadedMoves.empty(); ++i)
00079         {
00080             try {
00081                 char symbol = m_loadedMoves[0];
00082                 m_loadedMoves.erase(0, 1);
00083 
00084                 m_access->room()->loadMove(symbol);
00085             }
00086             catch (LoadException &e) {
00087                 throw LoadException(ExInfo(e.info())
00088                         .addInfo("remain", m_loadedMoves));
00089             }
00090         }
00091     }
00092 }

void LevelLoading::reset  ) 
 

Definition at line 24 of file LevelLoading.cpp.

00025 {
00026     m_paused = false;
00027     m_replayMode = false;
00028     m_loadSpeed = 1;
00029     m_loadedMoves = "";
00030 }

void LevelLoading::togglePause  )  [inline]
 

Definition at line 27 of file LevelLoading.h.

00027 { m_paused = !m_paused; }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:43 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2