aboutsummaryrefslogtreecommitdiff
path: root/engines/sludge
diff options
context:
space:
mode:
authorSimei Yin2018-05-31 23:13:20 +0200
committerSimei Yin2018-05-31 23:15:09 +0200
commit8ead8de2846539fd68811937abdd1cbb94382ce0 (patch)
tree1c9d3bc2d3493e3090b1279ccdcb0d7a3057040e /engines/sludge
parentfa72209845740352e6f575f5afc1dd0da9d6a502 (diff)
downloadscummvm-rg350-8ead8de2846539fd68811937abdd1cbb94382ce0.tar.gz
scummvm-rg350-8ead8de2846539fd68811937abdd1cbb94382ce0.tar.bz2
scummvm-rg350-8ead8de2846539fd68811937abdd1cbb94382ce0.zip
SLUDGE: Move save game getter to StackHandler
Diffstat (limited to 'engines/sludge')
-rw-r--r--engines/sludge/builtin.cpp2
-rw-r--r--engines/sludge/variable.cpp9
-rw-r--r--engines/sludge/variable.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp
index 6e4a953cd4..1030643788 100644
--- a/engines/sludge/builtin.cpp
+++ b/engines/sludge/builtin.cpp
@@ -215,7 +215,7 @@ builtIn(getMatchingFiles) {
fun->reg.varData.theStack->first = NULL;
fun->reg.varData.theStack->last = NULL;
fun->reg.varData.theStack->timesUsed = 1;
- if (!getSavedGamesStack(fun->reg.varData.theStack, newText))
+ if (!fun->reg.varData.theStack->getSavedGamesStack(newText))
return BR_ERROR;
return BR_CONTINUE;
}
diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp
index 04e520177e..44381aa97f 100644
--- a/engines/sludge/variable.cpp
+++ b/engines/sludge/variable.cpp
@@ -144,8 +144,7 @@ int StackHandler::getStackSize() const {
return r;
}
-bool getSavedGamesStack(StackHandler *sH, const Common::String &ext) {
-
+bool StackHandler::getSavedGamesStack(const Common::String &ext) {
// Make pattern
uint len = ext.size();
Common::String pattern = "*";
@@ -161,10 +160,10 @@ bool getSavedGamesStack(StackHandler *sH, const Common::String &ext) {
for (it = sa.begin(); it != sa.end(); ++it) {
(*it).erase((*it).size() - len, len);
newName.makeTextVar((*it));
- if (!addVarToStack(newName, sH->first))
+ if (!addVarToStack(newName, first))
return false;
- if (sH->last == NULL)
- sH->last = sH->first;
+ if (last == NULL)
+ last = first;
}
return true;
diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h
index afbf9c37ae..1ae2acacc7 100644
--- a/engines/sludge/variable.h
+++ b/engines/sludge/variable.h
@@ -58,6 +58,7 @@ struct StackHandler {
int timesUsed;
int getStackSize() const;
+ bool getSavedGamesStack(const Common::String &ext);
};
union VariableData {
@@ -137,7 +138,6 @@ bool addVarToStack(const Variable &va, VariableStack *&thisStack);
bool addVarToStackQuick(Variable &va, VariableStack *&thisStack);
void trimStack(VariableStack *&stack);
int deleteVarFromStack(const Variable &va, VariableStack *&thisStack, bool allOfEm = false);
-bool getSavedGamesStack(StackHandler *sH, const Common::String &ext);
// load & save
void saveStack(VariableStack *vs, Common::WriteStream *stream);