diff options
Diffstat (limited to 'engines/sludge')
-rw-r--r-- | engines/sludge/bg_effects.cpp | 2 | ||||
-rw-r--r-- | engines/sludge/builtin.cpp | 2 | ||||
-rw-r--r-- | engines/sludge/variable.cpp | 6 | ||||
-rw-r--r-- | engines/sludge/variable.h | 3 |
4 files changed, 7 insertions, 6 deletions
diff --git a/engines/sludge/bg_effects.cpp b/engines/sludge/bg_effects.cpp index d02acebe4f..3f40fc81e1 100644 --- a/engines/sludge/bg_effects.cpp +++ b/engines/sludge/bg_effects.cpp @@ -166,7 +166,7 @@ bool blur_createSettings(int numParams, VariableStack *&stack) { error = "Third and subsequent parameters in setBackgroundEffect should be arrays"; break; } else { - int w = stackSize(justToCheckSizes->thisVar.varData.theStack); + int w = justToCheckSizes->thisVar.varData.theStack->getStackSize(); if (a) { if (w != width) { error = "Arrays in setBackgroundEffect must be the same size"; diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index c7b66d6dc6..6e4a953cd4 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -527,7 +527,7 @@ builtIn(stackSize) { switch (fun->stack->thisVar.varType) { case SVT_STACK: // Return value - fun->reg.setVariable(SVT_INT, stackSize(fun->stack->thisVar.varData.theStack)); + fun->reg.setVariable(SVT_INT, fun->stack->thisVar.varData.theStack->getStackSize()); trimStack(fun->stack); return BR_CONTINUE; diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index c1ff97e699..04e520177e 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -134,9 +134,9 @@ Persona *Variable::getCostumeFromVar() { return p; } -int stackSize(const StackHandler *me) { +int StackHandler::getStackSize() const { int r = 0; - VariableStack *a = me->first; + VariableStack *a = first; while (a) { r++; a = a->next; @@ -403,7 +403,7 @@ bool Variable::makeFastArraySize(int size) { } bool Variable::makeFastArrayFromStack(const StackHandler *stacky) { - int size = stackSize(stacky); + int size = stacky->getStackSize(); if (!makeFastArraySize(size)) return false; diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h index 4d756f5d67..afbf9c37ae 100644 --- a/engines/sludge/variable.h +++ b/engines/sludge/variable.h @@ -56,6 +56,8 @@ struct StackHandler { struct VariableStack *first; struct VariableStack *last; int timesUsed; + + int getStackSize() const; }; union VariableData { @@ -135,7 +137,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); -int stackSize(const StackHandler *me); bool getSavedGamesStack(StackHandler *sH, const Common::String &ext); // load & save |