Definition at line 16 of file WorldBranch.h.
Public Member Functions | |
WorldBranch (LevelNode *root) | |
LevelNode * | parseMap (const Path &datafile, LevelNode **outEnding, ResDialogPack *des) |
Execute script which will add nodes. | |
void | addDesc (const std::string &codename, LevelDesc *desc) |
void | addNode (const std::string &parent, LevelNode *new_node, bool hidden) |
Add new node to branch. | |
void | setEnding (LevelNode *new_node) |
Take ending node. | |
void | bestSolution (const std::string &codename, int moves, const std::string &author) |
Store best solution author. |
|
Definition at line 24 of file WorldBranch.cpp. 00025 { 00026 m_root = root; 00027 m_ending = NULL; 00028 m_outPack = NULL; 00029 00030 m_script->registerFunc("worldmap_addDesc", script_worldmap_addDesc); 00031 m_script->registerFunc("branch_addNode", script_branch_addNode); 00032 m_script->registerFunc("branch_setEnding", script_branch_setEnding); 00033 m_script->registerFunc("node_bestSolution", script_node_bestSolution); 00034 }
|
|
Definition at line 69 of file WorldBranch.cpp. 00070 { 00071 if (m_outPack) { 00072 m_outPack->addRes(codename, desc); 00073 } 00074 else { 00075 throw LogicException(ExInfo("cannot export level description") 00076 .addInfo("codename", codename)); 00077 } 00078 }
|
|
Add new node to branch.
Definition at line 84 of file WorldBranch.cpp. 00086 { 00087 prepareNode(new_node, hidden); 00088 insertNode(parent, new_node); 00089 }
|
|
Store best solution author.
Definition at line 117 of file WorldBranch.cpp. 00119 { 00120 LevelNode *node = m_root->findNamed(codename); 00121 if (node) { 00122 node->bestSolution(moves, author); 00123 } 00124 else { 00125 throw LogicException(ExInfo("there is no such node") 00126 .addInfo("codename", codename) 00127 .addInfo("moves", moves) 00128 .addInfo("author", author)); 00129 } 00130 }
|
|
Execute script which will add nodes.
Definition at line 45 of file WorldBranch.cpp. 00047 { 00048 m_outPack = destPack; 00049 scriptInclude(datafile); 00050 m_outPack = NULL; 00051 00052 if (m_ending) { 00053 if (outEnding) { 00054 *outEnding = m_ending; 00055 } 00056 else { 00057 throw LogicException(ExInfo("cannot export ending node") 00058 .addInfo("ending", m_ending->getCodename())); 00059 } 00060 } 00061 00062 if (m_root && m_root->getState() < LevelNode::STATE_OPEN) { 00063 m_root->setState(LevelNode::STATE_OPEN); 00064 } 00065 return m_root; 00066 }
|
|
Take ending node.
Definition at line 95 of file WorldBranch.cpp. 00096 { 00097 if (m_ending) { 00098 delete m_ending; 00099 } 00100 m_ending = new_node; 00101 if (wasSolved(m_ending->getCodename())) { 00102 m_ending->setState(LevelNode::STATE_SOLVED); 00103 } 00104 else { 00105 m_ending->setState(LevelNode::STATE_OPEN); 00106 } 00107 m_ending->setDepth(-1); 00108 }
|