diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gamestate.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gamestate.cpp b/src/gamestate.cpp index 3f09c3f..902d0a9 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp | |||
| @@ -366,7 +366,30 @@ void GameState::parse( const AstBranch::NodeList &lCode ) | |||
| 366 | break; | 366 | break; |
| 367 | 367 | ||
| 368 | case AstNode::tForEach: | 368 | case AstNode::tForEach: |
| 369 | |||
| 370 | break; | ||
| 371 | |||
| 369 | case AstNode::tWhile: | 372 | case AstNode::tWhile: |
| 373 | { | ||
| 374 | AstBranch::NodeList lWhile = | ||
| 375 | dynamic_cast<const AstBranch *>(*i)->getNodeList(); | ||
| 376 | AstBranch::NodeList::const_iterator iTest = lWhile.begin(); | ||
| 377 | AstBranch::NodeList::const_iterator iDo = iTest+1; | ||
| 378 | |||
| 379 | for(;;) | ||
| 380 | { | ||
| 381 | parse( dynamic_cast<const AstBranch *>(*iTest)-> | ||
| 382 | getNodeList() ); | ||
| 383 | Variable v = popDeref(); | ||
| 384 | if( v.getType() != Variable::tBool ) | ||
| 385 | throw Bu::ExceptionBase("conditional did not evaluate to boolean."); | ||
| 386 | if( !v.getBool() ) | ||
| 387 | break; | ||
| 388 | |||
| 389 | parse( dynamic_cast<const AstBranch *>(*iDo)-> | ||
| 390 | getNodeList() ); | ||
| 391 | } | ||
| 392 | } | ||
| 370 | break; | 393 | break; |
| 371 | } | 394 | } |
| 372 | 395 | ||
