summaryrefslogtreecommitdiff
path: root/src/gamestate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamestate.cpp')
-rw-r--r--src/gamestate.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
index 902d0a9..a3758ce 100644
--- a/src/gamestate.cpp
+++ b/src/gamestate.cpp
@@ -65,6 +65,46 @@ void GameState::callFunction( const Bu::String &sName )
65 pGame->getFunction( sName )->call( *this ); 65 pGame->getFunction( sName )->call( *this );
66} 66}
67 67
68bool GameState::hasVariable( const Bu::String &sName, ScopeId id )
69{
70 switch( id )
71 {
72 case sidLocal:
73 return lsLocal.peek()->has( sName );
74
75 case sidGlobal:
76 return sGlobal.has( sName );
77
78 case sidPlayer:
79 return sPlayer.has( sName );
80
81 case sidSituation:
82 return hsSituation.get( sCurSituation )->has( sName );
83 }
84
85 throw Bu::ExceptionBase("Really bad scopeid passed into getVariable");
86}
87
88void GameState::delVariable( const Bu::String &sName, ScopeId id )
89{
90 switch( id )
91 {
92 case sidLocal:
93 return lsLocal.peek()->erase( sName );
94
95 case sidGlobal:
96 return sGlobal.erase( sName );
97
98 case sidPlayer:
99 return sPlayer.erase( sName );
100
101 case sidSituation:
102 return hsSituation.get( sCurSituation )->erase( sName );
103 }
104
105 throw Bu::ExceptionBase("Really bad scopeid passed into getVariable");
106}
107
68Variable GameState::getVariable( const Bu::String &sName, ScopeId id ) 108Variable GameState::getVariable( const Bu::String &sName, ScopeId id )
69{ 109{
70 try 110 try