From 79dce6268850fb1b0d76c15d5399d66bcd286e5f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Dec 2011 10:41:23 -0700 Subject: About to add the processing core. --- default.bld | 2 +- src/.gitignore | 1 + src/command.cpp | 2 +- src/game.h | 4 +++- src/gamebuilder.cpp | 13 ++++++++++--- src/gamestate.cpp | 11 +++++++++++ src/gamestate.h | 16 ++++++++++++++++ 7 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 src/gamestate.cpp create mode 100644 src/gamestate.h diff --git a/default.bld b/default.bld index a2a0a8a..0c7f50c 100644 --- a/default.bld +++ b/default.bld @@ -8,7 +8,7 @@ target "stage" CXXFLAGS="-ggdb"; CFLAGS="-ggdb"; - FLEXFLAGS="-osrc/parser.yy.c"; + FLEXFLAGS="-osrc/parser.yy.c --header-file=src/parser.yy.h"; BISONFLAGS="-d"; LDFLAGS += "-lbu++"; diff --git a/src/.gitignore b/src/.gitignore index 721300b..6f29247 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,3 +1,4 @@ parser.tab.c parser.tab.h parser.yy.c +parser.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() sio << " " << (*i).sValue; } - sio << sio.nl; + sio << *pAst << sio.nl; } 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 @@ #include #include + #include "function.h" #include "situation.h" #include "scope.h" +#include "commandset.h" class Game { @@ -20,7 +22,7 @@ private: VariableHash hGlobalParam; FunctionHash hFunction; SituationHash hSituation; - Bu::String sCurSituation; + CommandSet csGlobal; }; #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 ) void GameBuilder::closeCommand() { - pCurCmd->print(); - sio << *pCurRoot << sio.nl; pCurCmd->setAst( pCurRoot ); - delete pCurCmd; + pCurRoot = pCurNode = NULL; + pCurCmd->print(); + if( bGlobal ) + { + pGame->csGlobal.addCommand( pCurCmd ); + } + else + { + delete pCurCmd; + } pCurCmd = NULL; } 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 @@ +#include "gamestate.h" + +GameState::GameState( Game *pGame ) : + pGame( pGame ) +{ +} + +GameState::~GameState() +{ +} + 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 @@ +#ifndef GAME_STATE_H +#define GAME_STATE_H + +class Game; + +class GameState +{ +public: + GameState( Game *pGame ); + virtual ~GameState(); + +private: + Game *pGame; +}; + +#endif -- cgit v1.2.3