summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2015-05-07 15:23:03 -0600
committerMike Buland <eichlan@xagasoft.com>2015-05-07 15:23:03 -0600
commit0655735c84f412b7ad3e65381dc24694a9ac8071 (patch)
tree42baeb025d0e2842fe0aad9b7e75da81db5e24ed /src
parent75b3ad661c2d6ed382620a25613846c2b2b10f46 (diff)
downloadstage-main.tar.gz
stage-main.tar.bz2
stage-main.tar.xz
stage-main.zip
Goto was confused.HEADmain
The variable was being reset, then used by reference as the next destination. Confusing to debug.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp2
-rw-r--r--src/gamebuilder.cpp2
-rw-r--r--src/gamestate.cpp27
-rw-r--r--src/interfacegats.cpp1
-rw-r--r--src/variable.cpp2
5 files changed, 27 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 05c5eca..77d65d8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -11,6 +11,8 @@
11#include "functionkeys.h" 11#include "functionkeys.h"
12#include "functioncount.h" 12#include "functioncount.h"
13 13
14#include <bu/sio.h>
15
14Game::Game() 16Game::Game()
15{ 17{
16 hGlobalParam.insert("start", Variable::newSituationName("start") ); 18 hGlobalParam.insert("start", Variable::newSituationName("start") );
diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp
index e8ecf63..1002d71 100644
--- a/src/gamebuilder.cpp
+++ b/src/gamebuilder.cpp
@@ -123,7 +123,7 @@ void GameBuilder::beginSituationMode( Situation::Mode m )
123 123
124void GameBuilder::closeSituationMode() 124void GameBuilder::closeSituationMode()
125{ 125{
126// sio << "Set situation <<" << pCurSit->getName() << ">> mode " << eCurSitMode << " to " << *pCurRoot << sio.nl; 126 //sio << "Set situation <<" << pCurSit->getName() << ">> mode " << eCurSitMode << " to " << *pCurRoot << sio.nl;
127 pCurSit->setAst( pCurRoot, eCurSitMode ); 127 pCurSit->setAst( pCurRoot, eCurSitMode );
128 pCurRoot = pCurNode = NULL; 128 pCurRoot = pCurNode = NULL;
129} 129}
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
index b009e4c..ceed091 100644
--- a/src/gamestate.cpp
+++ b/src/gamestate.cpp
@@ -10,6 +10,8 @@
10#include <gats/types.h> 10#include <gats/types.h>
11 11
12#include <bu/sio.h> 12#include <bu/sio.h>
13
14#include <stdlib.h>
13using namespace Bu; 15using namespace Bu;
14 16
15GameState::GameState( Game *pGame, Interface *pIface ) : 17GameState::GameState( Game *pGame, Interface *pIface ) :
@@ -281,7 +283,9 @@ void GameState::gotoSituation( const Bu::String &sName )
281 hsSituation.insert( sName, new Scope() ); 283 hsSituation.insert( sName, new Scope() );
282 pSit->exec( *this, Situation::modeSetup ); 284 pSit->exec( *this, Situation::modeSetup );
283 if( !sGoto.isSet() ) 285 if( !sGoto.isSet() )
286 {
284 pSit->exec( *this, Situation::modeEnter ); 287 pSit->exec( *this, Situation::modeEnter );
288 }
285 } 289 }
286 else 290 else
287 { 291 {
@@ -290,7 +294,7 @@ void GameState::gotoSituation( const Bu::String &sName )
290 294
291 if( sGoto.isSet() ) 295 if( sGoto.isSet() )
292 { 296 {
293 gotoSituation( sGoto ); 297 gotoSituation( sGoto.clone() );
294 } 298 }
295} 299}
296 300
@@ -315,7 +319,7 @@ void GameState::execCommand( const Bu::String &sCmd )
315 } 319 }
316 320
317 if( sGoto.isSet() ) 321 if( sGoto.isSet() )
318 gotoSituation( sGoto ); 322 gotoSituation( sGoto.clone() );
319} 323}
320 324
321void GameState::execOption( int idx ) 325void GameState::execOption( int idx )
@@ -323,7 +327,7 @@ void GameState::execOption( int idx )
323 pGame->getSituation( sCurSituation )->execOption( *this, idx ); 327 pGame->getSituation( sCurSituation )->execOption( *this, idx );
324 328
325 if( sGoto.isSet() ) 329 if( sGoto.isSet() )
326 gotoSituation( sGoto ); 330 gotoSituation( sGoto.clone() );
327} 331}
328 332
329bool GameState::hasVariable( const Bu::String &sName, ScopeId id ) 333bool GameState::hasVariable( const Bu::String &sName, ScopeId id )
@@ -461,8 +465,21 @@ Variable &GameState::deref( Variable &src, bool bCreate )
461 return sPlayer.get( r.sName ); 465 return sPlayer.get( r.sName );
462 466
463 case sidSituation: 467 case sidSituation:
464 hsSituation.get( sCurSituation )->insert( r.sName, Variable() ); 468 if( hsSituation.has( sCurSituation ) )
465 return hsSituation.get( sCurSituation )->get( r.sName ); 469 {
470 hsSituation.get( sCurSituation )->insert( r.sName, Variable() );
471 return hsSituation.get( sCurSituation )->get( r.sName );
472 }
473 else
474 {
475 Bu::println("No such situation: %1").arg( sCurSituation );
476 Bu::println("Available:");
477 for( ScopeHash::iterator i = hsSituation.begin(); i; i++ )
478 {
479 Bu::println(" <<%1>>").arg( i.getKey() );
480 }
481 ::exit( 0 );
482 }
466 } 483 }
467 } 484 }
468 else 485 else
diff --git a/src/interfacegats.cpp b/src/interfacegats.cpp
index 2e33aee..d2afce3 100644
--- a/src/interfacegats.cpp
+++ b/src/interfacegats.cpp
@@ -11,6 +11,7 @@
11#include <bu/plugger.h> 11#include <bu/plugger.h>
12#include <bu/sio.h> 12#include <bu/sio.h>
13#include <bu/file.h> 13#include <bu/file.h>
14#include <bu/streamstack.h>
14#include <gats/gatsstream.h> 15#include <gats/gatsstream.h>
15#include <gats/types.h> 16#include <gats/types.h>
16#include <stdlib.h> 17#include <stdlib.h>
diff --git a/src/variable.cpp b/src/variable.cpp
index 88ac1bc..4ddec1a 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -1048,7 +1048,7 @@ void Variable::deinitType()
1048 1048
1049Variable::Type Variable::bestType( Variable::Type t1, Variable::Type t2 ) const 1049Variable::Type Variable::bestType( Variable::Type t1, Variable::Type t2 ) const
1050{ 1050{
1051 Type tBest = Bu::max( t1, t2 ); 1051 Type tBest = Bu::buMax( t1, t2 );
1052 1052
1053 return tBest; 1053 return tBest;
1054} 1054}