Permalink
Browse files

MUTATIONOFJB: Fix multiple RANDOM commands in one script.

  • Loading branch information...
MiroslavR authored and LubomirR committed Jul 15, 2018
1 parent e668365 commit a7b352ce4a249392bcff37eada10177d8aafaa94
Showing with 7 additions and 2 deletions.
  1. +7 −2 engines/mutationofjb/commands/randomcommand.cpp
@@ -74,8 +74,13 @@ bool RandomBlockStartParser::parse(const Common::String &line, ScriptParseContex
}

void RandomBlockStartParser::transition(ScriptParseContext &parseCtx, Command *, Command *newCommand, CommandParser *) {
if (newCommand && parseCtx._pendingRandomCommand) {
parseCtx._pendingRandomCommand->_choices.push_back(newCommand);
RandomCommand *randomCommand = parseCtx._pendingRandomCommand;
if (newCommand && randomCommand) {
randomCommand->_choices.push_back(newCommand);

if (randomCommand->_choices.size() == randomCommand->_numChoices) {
parseCtx._pendingRandomCommand = nullptr;
}
}
}

0 comments on commit a7b352c

Please sign in to comment.