summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-03 23:50:00 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-03 23:50:00 -0700
commit549069762ccc35352186eb4fe1922883a0c4f213 (patch)
treefd119dfc43bbd98b14ffb0c7df76547701e66770
parent4d0ae6422674a2a752c5c6b60ca5ffe908a2278f (diff)
downloadstage-549069762ccc35352186eb4fe1922883a0c4f213.tar.gz
stage-549069762ccc35352186eb4fe1922883a0c4f213.tar.bz2
stage-549069762ccc35352186eb4fe1922883a0c4f213.tar.xz
stage-549069762ccc35352186eb4fe1922883a0c4f213.zip
Return seems to be fixed.
-rw-r--r--src/gamestate.cpp7
-rw-r--r--src/gamestate.h1
-rw-r--r--test.stage25
3 files changed, 29 insertions, 4 deletions
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
index 2032d5c..57dbe2f 100644
--- a/src/gamestate.cpp
+++ b/src/gamestate.cpp
@@ -10,7 +10,8 @@ using namespace Bu;
10 10
11GameState::GameState( Game *pGame ) : 11GameState::GameState( Game *pGame ) :
12 pGame( pGame ), 12 pGame( pGame ),
13 bRunning( true ) 13 bRunning( true ),
14 bReturnOnly( false )
14{ 15{
15} 16}
16 17
@@ -498,6 +499,8 @@ void GameState::parse( const AstBranch::NodeList &lCode )
498 break; 499 break;
499 500
500 case AstNode::tReturn: 501 case AstNode::tReturn:
502 bReturnOnly = true;
503 bEscape = true;
501 return; 504 return;
502 break; 505 break;
503 506
@@ -536,6 +539,8 @@ void GameState::parse( const AstBranch::NodeList &lCode )
536 dynamic_cast<const AstLeafLiteral *>(*i) 539 dynamic_cast<const AstLeafLiteral *>(*i)
537 ->getValue().getString() 540 ->getValue().getString()
538 ); 541 );
542 bReturnOnly = false;
543 bEscape = false;
539 break; 544 break;
540 545
541 // tBranch 546 // tBranch
diff --git a/src/gamestate.h b/src/gamestate.h
index 5c47ce0..9e7a060 100644
--- a/src/gamestate.h
+++ b/src/gamestate.h
@@ -54,6 +54,7 @@ private:
54 54
55 bool bEscape; 55 bool bEscape;
56 bool bRunning; 56 bool bRunning;
57 bool bReturnOnly;
57 Bu::String sPrompt; 58 Bu::String sPrompt;
58 59
59 VariableList lStack; 60 VariableList lStack;
diff --git a/test.stage b/test.stage
index 42529af..b963b2b 100644
--- a/test.stage
+++ b/test.stage
@@ -13,13 +13,32 @@ global
13 } 13 }
14} 14}
15 15
16function subfunction()
17{
18 if true then
19 {
20 return();
21 }
22 display("subfunction()");
23}
24
25function hello()
26{
27 if true == true then
28 {
29 subfunction();
30 display("Yeah!");
31 return();
32 }
33 display("hello()");
34}
35
16situation <<start>> 36situation <<start>>
17{ 37{
18 setup 38 setup
19 { 39 {
20 global.stuff = {'count': 1}; 40 hello();
21 global.stuff['count'] += 5; 41 display("situation");
22 display( global.stuff['count'] );
23 exit(); 42 exit();
24 } 43 }
25 44