summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/gamestate.cpp18
-rw-r--r--src/variable.cpp5
-rw-r--r--src/variable.h1
3 files changed, 20 insertions, 4 deletions
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
index 4af49aa..dcae848 100644
--- a/src/gamestate.cpp
+++ b/src/gamestate.cpp
@@ -428,8 +428,6 @@ void GameState::parse( const AstBranch::NodeList &lCode )
428 Variable y = popDeref(); 428 Variable y = popDeref();
429 Variable x = pop(); 429 Variable x = pop();
430 deref( x ) += y; 430 deref( x ) += y;
431// VariableRef r = x.getVariableRef();
432// setVariable( r.sName, getVariable( r.sName, r.sid ) + y, r.sid );
433 } 431 }
434 break; 432 break;
435 433
@@ -438,8 +436,6 @@ void GameState::parse( const AstBranch::NodeList &lCode )
438 Variable y = popDeref(); 436 Variable y = popDeref();
439 Variable x = pop(); 437 Variable x = pop();
440 deref( x ) -= y; 438 deref( x ) -= y;
441// VariableRef r = x.getVariableRef();
442// setVariable( r.sName, getVariable( r.sName, r.sid ) - y, r.sid );
443 } 439 }
444 break; 440 break;
445 441
@@ -618,6 +614,20 @@ void GameState::parse( const AstBranch::NodeList &lCode )
618 parse( rDo ); 614 parse( rDo );
619 } 615 }
620 } 616 }
617 else if( vIn.getType() == Variable::tList )
618 {
619 if( bUseKey )
620 {
621 throw Bu::ExceptionBase("You cannot use key:value pairs as iterators in a for each loop iterating over a list.");
622 }
623 const Variable::VariableList &rList = vIn.getList();
624 for( Variable::VariableList::const_iterator i =
625 rList.begin(); i; i++ )
626 {
627 setVariable( vrValue.sName, *i, vrValue.sid );
628 parse( rDo );
629 }
630 }
621 } 631 }
622 break; 632 break;
623 633
diff --git a/src/variable.cpp b/src/variable.cpp
index 0ce9793..5296848 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -113,6 +113,11 @@ Variable *Variable::getVariablePtr() const
113 return pValue; 113 return pValue;
114} 114}
115 115
116const Variable::VariableList &Variable::getList() const
117{
118 return *lValue;
119}
120
116const Variable::VariableHash &Variable::getHash() const 121const Variable::VariableHash &Variable::getHash() const
117{ 122{
118 return *hValue; 123 return *hValue;
diff --git a/src/variable.h b/src/variable.h
index 22a1b26..8741b28 100644
--- a/src/variable.h
+++ b/src/variable.h
@@ -61,6 +61,7 @@ public:
61 Bu::String getString() const; 61 Bu::String getString() const;
62 VariableRef getVariableRef() const; 62 VariableRef getVariableRef() const;
63 Variable *getVariablePtr() const; 63 Variable *getVariablePtr() const;
64 const VariableList &getList() const;
64 const VariableHash &getHash() const; 65 const VariableHash &getHash() const;
65 66
66 Variable to( Type e ) const; 67 Variable to( Type e ) const;