From e9170376ec9d75f65949ac6b61694ddf7ad37897 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 7 Feb 2012 22:13:15 -0700 Subject: Goto is broken. I think I need to switch to a global instruction stack, it'll be so much easier to manage. --- src/gamebuilder.cpp | 2 +- src/gamestate.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp index e8ecf63..ac1174a 100644 --- a/src/gamebuilder.cpp +++ b/src/gamebuilder.cpp @@ -123,7 +123,7 @@ void GameBuilder::beginSituationMode( Situation::Mode m ) void GameBuilder::closeSituationMode() { -// sio << "Set situation <<" << pCurSit->getName() << ">> mode " << eCurSitMode << " to " << *pCurRoot << sio.nl; + sio << "Set situation <<" << pCurSit->getName() << ">> mode " << eCurSitMode << " to " << *pCurRoot << sio.nl; pCurSit->setAst( pCurRoot, eCurSitMode ); pCurRoot = pCurNode = NULL; } diff --git a/src/gamestate.cpp b/src/gamestate.cpp index 041af86..99cc749 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -520,8 +520,8 @@ void GameState::parse( const AstBranch::NodeList &lCode ) bEscape = false; for( AstBranch::NodeList::const_iterator i = lCode.begin(); i; i++ ) { - // sio << "Stack: " << lStack << sio.nl; - // sio << "exec: " << (*i)->getType() << sio.nl; + sio << "Stack: " << lStack << sio.nl; + sio << "exec: " << (*i)->getType() << sio.nl; switch( (*i)->getType() ) { // tLeaf @@ -705,6 +705,8 @@ void GameState::parse( const AstBranch::NodeList &lCode ) throw Bu::ExceptionBase("You cannot goto anything but a situation."); gotoSituation( x.getString() ); bEscape = true; + sio << "Initial return" << sio.nl; + push( Variable( Variable::tNull ) ); return; } break; @@ -908,6 +910,7 @@ void GameState::parse( const AstBranch::NodeList &lCode ) if( bEscape || !bRunning ) { + sio << "Returning from" << sio.nl; return; } } -- cgit v1.2.3