aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2015-12-24 19:30:17 +0100
committerWillem Jan Palenstijn2015-12-24 20:28:57 +0100
commitad182f1f697e185221975479838fad4f8fefba9c (patch)
treeb9bcf3c5862a10f5d5b6a3f0a4a287736c134a9c
parent0d97d1af820a55ab62ce259113f9ba1305f76c9f (diff)
downloadscummvm-rg350-ad182f1f697e185221975479838fad4f8fefba9c.tar.gz
scummvm-rg350-ad182f1f697e185221975479838fad4f8fefba9c.tar.bz2
scummvm-rg350-ad182f1f697e185221975479838fad4f8fefba9c.zip
LAB: Make readAction consistent with the other read functions
-rw-r--r--engines/lab/resource.cpp13
-rw-r--r--engines/lab/resource.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index b2258ba25c..985a71b490 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -242,18 +242,19 @@ Common::Array<int16> Resource::readConditions(Common::File *file) {
void Resource::readRule(Common::File *file, RuleList &rules) {
rules.clear();
while (file->readByte() == 1) {
- Rule rule;
+ rules.push_back(Rule());
+ Rule &rule = rules.back();
+
rule._ruleType = (RuleType)file->readSint16LE();
rule._param1 = file->readSint16LE();
rule._param2 = file->readSint16LE();
rule._condition = readConditions(file);
- rule._actionList = readAction(file);
- rules.push_back(rule);
+ readAction(file, rule._actionList);
}
}
-Common::List<Action> Resource::readAction(Common::File *file) {
- Common::List<Action> list;
+void Resource::readAction(Common::File *file, Common::List<Action>& list) {
+ list.clear();
while (file->readByte() == 1) {
list.push_back(Action());
@@ -272,8 +273,6 @@ Common::List<Action> Resource::readAction(Common::File *file) {
action._messages.push_back(readString(file));
}
}
-
- return list;
}
void Resource::readCloseUps(uint16 depth, Common::File *file, Common::List<CloseData> &list) {
diff --git a/engines/lab/resource.h b/engines/lab/resource.h
index a5732587ec..7a7cfb4b95 100644
--- a/engines/lab/resource.h
+++ b/engines/lab/resource.h
@@ -110,7 +110,7 @@ private:
Common::String readString(Common::File *file);
Common::Array<int16> readConditions(Common::File *file);
void readRule(Common::File *file, RuleList &rules);
- Common::List<Action> readAction(Common::File *file);
+ void readAction(Common::File *file, Common::List<Action> &action);
void readCloseUps(uint16 depth, Common::File *file, Common::List<CloseData> &close);
void readView(Common::File *file, Common::List<ViewData> &view);
void readStaticText();