summaryrefslogtreecommitdiff
path: root/src/gamebuilder.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-29 14:13:21 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-29 14:13:21 -0700
commit533310f646f1b1a00250a361f627967c420f1eef (patch)
tree0ade5ffb70259af7f4e2be56497e4e4707bc079a /src/gamebuilder.cpp
parent1bc10d1408eb29b0675a030e029155dd046b1dd8 (diff)
downloadstage-533310f646f1b1a00250a361f627967c420f1eef.tar.gz
stage-533310f646f1b1a00250a361f627967c420f1eef.tar.bz2
stage-533310f646f1b1a00250a361f627967c420f1eef.tar.xz
stage-533310f646f1b1a00250a361f627967c420f1eef.zip
Situations & their modes are built.
Diffstat (limited to 'src/gamebuilder.cpp')
-rw-r--r--src/gamebuilder.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp
index ee85129..6c42fb0 100644
--- a/src/gamebuilder.cpp
+++ b/src/gamebuilder.cpp
@@ -7,6 +7,7 @@
7#include "astleafliteral.h" 7#include "astleafliteral.h"
8#include "astfunction.h" 8#include "astfunction.h"
9#include "command.h" 9#include "command.h"
10#include "situation.h"
10 11
11using namespace Bu; 12using namespace Bu;
12 13
@@ -16,7 +17,8 @@ GameBuilder::GameBuilder() :
16 pCurNode( NULL ), 17 pCurNode( NULL ),
17 pCurRoot( NULL ), 18 pCurRoot( NULL ),
18 pCurCmd( NULL ), 19 pCurCmd( NULL ),
19 pCurFnc( NULL ) 20 pCurFnc( NULL ),
21 pCurSit( NULL )
20{ 22{
21 pGame = new Game(); 23 pGame = new Game();
22} 24}
@@ -58,11 +60,26 @@ void GameBuilder::endFunction()
58 60
59void GameBuilder::beginSituation( const Bu::String &sName ) 61void GameBuilder::beginSituation( const Bu::String &sName )
60{ 62{
63 pCurSit = new Situation( sName );
61 sio << "New situation: " << sName << sio.nl; 64 sio << "New situation: " << sName << sio.nl;
62} 65}
63 66
67void GameBuilder::beginSituationMode( Situation::Mode m )
68{
69 pCurNode = pCurRoot = new AstBranch( AstNode::tScope );
70 eCurSitMode = m;
71}
72
73void GameBuilder::closeSituationMode()
74{
75 sio << "Set situation mode " << eCurSitMode << " to " << *pCurRoot << sio.nl;
76 pCurSit->setAst( pCurRoot, eCurSitMode );
77 pCurRoot = pCurNode = NULL;
78}
79
64void GameBuilder::endSituation() 80void GameBuilder::endSituation()
65{ 81{
82 pGame->hSituation.insert( pCurSit->getName(), pCurSit );
66 sio << "Situation ended." << sio.nl; 83 sio << "Situation ended." << sio.nl;
67} 84}
68 85