Skip to content

Commit

Permalink
ZVISION: Change Puzzle::resultActions to a List of pointers instead o…
Browse files Browse the repository at this point in the history
…f ResultAction objects

ResultAction is abstract, therefore, it can't be directly stored in the list
  • Loading branch information
RichieSams committed Aug 4, 2013
1 parent 0ba9ca8 commit 3822de2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion engines/zvision/puzzle.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ enum StateFlags : byte {
struct Puzzle {
uint32 key;
Common::List<Criteria> criteriaList;
Common::List<ResultAction> resultActions;
// This has to be list of pointers because ResultAction is abstract
Common::List<ResultAction *> resultActions;
byte flags;
};

Expand Down
8 changes: 4 additions & 4 deletions engines/zvision/scr_file_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const
return criteria;
}

void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List<ResultAction> &actionList) const {
void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List<ResultAction *> &actionList) const {
// Loop until we find the closing brace
Common::String line = stream.readLine();
trimCommentsAndWhiteSpace(line);
Expand All @@ -135,11 +135,11 @@ void ScriptManager::parseResult(Common::SeekableReadStream &stream, Common::List
while (!line.contains('}')) {
// Parse for the action type
if (line.matchString("*:add*", true)) {
actionList.push_back(ActionAdd(line));
actionList.push_back(new ActionAdd(line));
} else if (line.matchString("*:animplay*", true)) {
actionList.push_back(ActionPlayAnimation(line));
actionList.push_back(new ActionPlayAnimation(line));
} else if (line.matchString("*:animpreload*", true)) {
actionList.push_back(ActionPreloadAnimation(line));
actionList.push_back(new ActionPreloadAnimation(line));
} else if (line.matchString("*:animunload*", true)) {


Expand Down
2 changes: 1 addition & 1 deletion engines/zvision/script_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ScriptManager {
* @param stream Scr file stream
* @return Created Results object
*/
void parseResult(Common::SeekableReadStream &stream, Common::List<ResultAction> &actionList) const;
void parseResult(Common::SeekableReadStream &stream, Common::List<ResultAction *> &actionList) const;

/**
* Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum
Expand Down

0 comments on commit 3822de2

Please sign in to comment.