diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/builtin.cpp | 2 | ||||
-rw-r--r-- | engines/sludge/variable.cpp | 9 | ||||
-rw-r--r-- | engines/sludge/variable.h | 2 |
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); |