diff --git a/engines/sludge/event.cpp b/engines/sludge/event.cpp index d6afe2f5b92..acccd7ff84a 100644 --- a/engines/sludge/event.cpp +++ b/engines/sludge/event.cpp @@ -182,7 +182,6 @@ bool EventManager::handleInput() { if (!checkNew(tempStack)) return false; - initVarNew(tempStack->thisVar); ScreenRegion *overRegion = _vm->_regionMan->getOverRegion(); if (overRegion) { setVariable(tempStack->thisVar, SVT_OBJTYPE, overRegion->thisType->objectNum); @@ -321,7 +320,6 @@ bool EventManager::handleInput() { VariableStack *tempStack = new VariableStack; if (!checkNew(tempStack)) return false; - initVarNew(tempStack->thisVar); makeTextVar(tempStack->thisVar, tempString); tempStack->next = nullptr; if (!startNewFunctionNum(_currentEvents->func[kSpace], 1, nullptr, tempStack)) diff --git a/engines/sludge/function.cpp b/engines/sludge/function.cpp index 8aa69f07c4c..98f7bf79b19 100644 --- a/engines/sludge/function.cpp +++ b/engines/sludge/function.cpp @@ -661,9 +661,6 @@ bool loadFunctionCode(LoadedFunction *newFunc) { newFunc->localVars = new Variable[newFunc->numLocals]; if (!checkNew(newFunc->localVars)) return false; - for (int a = 0; a < newFunc->numLocals; a++) { - initVarNew(newFunc->localVars[a]); - } return true; } @@ -700,7 +697,6 @@ int startNewFunctionNum(uint funcNum, uint numParamsExpected, newFunc->freezerLevel = 0; newFunc->runThisLine = 0; newFunc->isSpeech = 0; - initVarNew(newFunc->reg); restartFunction(newFunc); return 1; diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index f297ff12f59..f9dedf22fc1 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -177,7 +177,6 @@ void killSludge() { bool initSludge(const Common::String &filename) { initSludge(); - int a = 0; Common::File *fp = openAndVerify(filename, 'G', 'E', ERROR_BAD_HEADER, gameVersion); if (!fp) return false; @@ -276,8 +275,6 @@ bool initSludge(const Common::String &filename) { globalVars = new Variable[numGlobals]; if (!checkNew(globalVars)) return false; - for (a = 0; a < numGlobals; a++) - initVarNew(globalVars[a]); // Get language selected by user g_sludge->_resMan->setData(fp); diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index 8ed2297008a..a663599d5ae 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -408,9 +408,6 @@ bool makeFastArraySize(Variable &to, int size) { to.varData.fastArray->fastVariables = new Variable[size]; if (!checkNew(to.varData.fastArray->fastVariables)) return false; - for (int i = 0; i < size; i++) { - initVarNew(to.varData.fastArray->fastVariables[i]); - } to.varData.fastArray->size = size; to.varData.fastArray->timesUsed = 1; return true; diff --git a/engines/sludge/variable.h b/engines/sludge/variable.h index a3cc57d9111..27bf71a6896 100644 --- a/engines/sludge/variable.h +++ b/engines/sludge/variable.h @@ -68,6 +68,11 @@ union VariableData { struct Variable { VariableType varType; VariableData varData; + + Variable() { + varType = SVT_NULL; + varData.intValue = 0; + } }; struct VariableStack { @@ -75,10 +80,6 @@ struct VariableStack { VariableStack *next; }; -// Initialisation - -#define initVarNew(thisVar) thisVar.varType = SVT_NULL - // Setting variables void setVariable(Variable &thisVar, VariableType vT, int value); @@ -94,7 +95,6 @@ char *createCString(const Common::String &s); // Misc. void unlinkVar(Variable &thisVar); -Common::String getNumberedString(int value); Common::String getTextFromAnyVar(const Variable &from); struct Persona *getCostumeFromVar(Variable &thisVar); struct PersonaAnimation *getAnimationFromVar(Variable &thisVar);