summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.bld2
-rw-r--r--src/.gitignore1
-rw-r--r--src/command.cpp2
-rw-r--r--src/game.h4
-rw-r--r--src/gamebuilder.cpp13
-rw-r--r--src/gamestate.cpp11
-rw-r--r--src/gamestate.h16
7 files changed, 43 insertions, 6 deletions
diff --git a/default.bld b/default.bld
index a2a0a8a..0c7f50c 100644
--- a/default.bld
+++ b/default.bld
@@ -8,7 +8,7 @@ target "stage"
8 CXXFLAGS="-ggdb"; 8 CXXFLAGS="-ggdb";
9 CFLAGS="-ggdb"; 9 CFLAGS="-ggdb";
10 10
11 FLEXFLAGS="-osrc/parser.yy.c"; 11 FLEXFLAGS="-osrc/parser.yy.c --header-file=src/parser.yy.h";
12 BISONFLAGS="-d"; 12 BISONFLAGS="-d";
13 13
14 LDFLAGS += "-lbu++"; 14 LDFLAGS += "-lbu++";
diff --git a/src/.gitignore b/src/.gitignore
index 721300b..6f29247 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,3 +1,4 @@
1parser.tab.c 1parser.tab.c
2parser.tab.h 2parser.tab.h
3parser.yy.c 3parser.yy.c
4parser.yy.h
diff --git a/src/command.cpp b/src/command.cpp
index 5b859f7..e81d307 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -41,6 +41,6 @@ void Command::print()
41 sio << " " << (*i).sValue; 41 sio << " " << (*i).sValue;
42 } 42 }
43 43
44 sio << sio.nl; 44 sio << *pAst << sio.nl;
45} 45}
46 46
diff --git a/src/game.h b/src/game.h
index 81247ca..dd614cf 100644
--- a/src/game.h
+++ b/src/game.h
@@ -3,9 +3,11 @@
3 3
4#include <bu/string.h> 4#include <bu/string.h>
5#include <bu/hash.h> 5#include <bu/hash.h>
6
6#include "function.h" 7#include "function.h"
7#include "situation.h" 8#include "situation.h"
8#include "scope.h" 9#include "scope.h"
10#include "commandset.h"
9 11
10class Game 12class Game
11{ 13{
@@ -20,7 +22,7 @@ private:
20 VariableHash hGlobalParam; 22 VariableHash hGlobalParam;
21 FunctionHash hFunction; 23 FunctionHash hFunction;
22 SituationHash hSituation; 24 SituationHash hSituation;
23 Bu::String sCurSituation; 25 CommandSet csGlobal;
24}; 26};
25 27
26#endif 28#endif
diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp
index e6c1f38..45aee50 100644
--- a/src/gamebuilder.cpp
+++ b/src/gamebuilder.cpp
@@ -139,10 +139,17 @@ void GameBuilder::addCommandParam( const Bu::String &sValue )
139 139
140void GameBuilder::closeCommand() 140void GameBuilder::closeCommand()
141{ 141{
142 pCurCmd->print();
143 sio << *pCurRoot << sio.nl;
144 pCurCmd->setAst( pCurRoot ); 142 pCurCmd->setAst( pCurRoot );
145 delete pCurCmd; 143 pCurRoot = pCurNode = NULL;
144 pCurCmd->print();
145 if( bGlobal )
146 {
147 pGame->csGlobal.addCommand( pCurCmd );
148 }
149 else
150 {
151 delete pCurCmd;
152 }
146 pCurCmd = NULL; 153 pCurCmd = NULL;
147} 154}
148 155
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
new file mode 100644
index 0000000..fcd3433
--- /dev/null
+++ b/src/gamestate.cpp
@@ -0,0 +1,11 @@
1#include "gamestate.h"
2
3GameState::GameState( Game *pGame ) :
4 pGame( pGame )
5{
6}
7
8GameState::~GameState()
9{
10}
11
diff --git a/src/gamestate.h b/src/gamestate.h
new file mode 100644
index 0000000..2754873
--- /dev/null
+++ b/src/gamestate.h
@@ -0,0 +1,16 @@
1#ifndef GAME_STATE_H
2#define GAME_STATE_H
3
4class Game;
5
6class GameState
7{
8public:
9 GameState( Game *pGame );
10 virtual ~GameState();
11
12private:
13 Game *pGame;
14};
15
16#endif