GameVar *GameVar::addSubVarAsInt(const Common::String &name, int value) { if (getSubVarByName(name)) { return 0; } else { GameVar *var = new GameVar(); var->_varType = 0; var->_value.intValue = value; var->_varName = name; return (addSubVar(var) != 0) ? var : 0; } }
GameVar *GameVar::addSubVarAsInt(const char *name, int value) { if (getSubVarByName(name)) { return 0; } else { GameVar *var = new GameVar(); var->_varType = 0; var->_value.intValue = value; var->_varName = (char *)calloc(strlen(name) + 1, 1); strcpy(var->_varName, name); return (addSubVar(var) != 0) ? var : 0; } }
bool GameVar::setSubVarAsInt(const Common::String &name, int value) { GameVar *var = getSubVarByName(name); if (var) { if (var->_varType == 0) { var->_value.intValue = value; return true; } return false; } var = new GameVar(); var->_varType = 0; var->_value.intValue = value; var->_varName = name; return addSubVar(var); }
bool GameVar::setSubVarAsInt(const char *name, int value) { GameVar *var = getSubVarByName(name); if (var) { if (var->_varType == 0) { var->_value.intValue = value; return true; } return false; } var = new GameVar(); var->_varType = 0; var->_value.intValue = value; var->_varName = (char *)calloc(strlen(name) + 1, 1); strcpy(var->_varName, name); return addSubVar(var); }
int16 GameVars::getSubVarIndex(int16 varIndex, uint32 subNameHash) { int16 subVarIndex = findSubVarIndex(varIndex, subNameHash); if (subVarIndex == -1) subVarIndex = addSubVar(varIndex, subNameHash, 0); return subVarIndex; }