#ifndef GAME_STATE_H #define GAME_STATE_H #include "astbranch.h" #include "variable.h" #include "scope.h" #include "enums.h" class Game; class GameState { public: GameState( Game *pGame ); virtual ~GameState(); void parse( class AstBranch *pAst ); void init(); void gotoSituation( const Bu::String &sName ); Variable pop() { return lStack.peekPop(); } Variable popDeref(); void push( const Variable &v ) { lStack.push( v ); } void callFunction( const Bu::String &sName ); Variable getVariable( const Bu::String &sName, ScopeId id=sidLocal ); void setVariable( const Bu::String &sName, const Variable &v, ScopeId id=sidLocal ); Variable deref( const Variable &src ); private: void parse( const AstBranch::NodeList &lCode ); private: typedef Bu::List ScopeList; typedef Bu::Hash ScopeHash; Game *pGame; Scope sGlobal; Scope sPlayer; ScopeList lsLocal; ScopeHash hsSituation; Bu::String sCurSituation; bool bEscape; VariableList lStack; }; #endif