diff options
author | Filippos Karapetis | 2017-03-22 04:32:23 +0200 |
---|---|---|
committer | Filippos Karapetis | 2017-03-22 04:32:23 +0200 |
commit | 93982b2ca9b67cd143f603f516570e269f28fa32 (patch) | |
tree | e07900e5f79f9b63135dd91ba228252bc409176f /engines | |
parent | 56ec429537ee86a5e8cda0f027a21f217f1c16a2 (diff) | |
download | scummvm-rg350-93982b2ca9b67cd143f603f516570e269f28fa32.tar.gz scummvm-rg350-93982b2ca9b67cd143f603f516570e269f28fa32.tar.bz2 scummvm-rg350-93982b2ca9b67cd143f603f516570e269f28fa32.zip |
FULLPIPE: Change more object-related functions to use Common::String
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/behavior.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 6 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 6 | ||||
-rw-r--r-- | engines/fullpipe/interaction.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/motion.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/objects.h | 8 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 24 | ||||
-rw-r--r-- | engines/fullpipe/scene.h | 6 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 10 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/statics.h | 4 |
11 files changed, 46 insertions, 46 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index 694f7d0799..8c0bf9198c 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -70,7 +70,7 @@ void BehaviorManager::initBehavior(Scene *sc, GameVar *var) { _behaviors.push_back(behinfo); } else { - StaticANIObject *ani = sc->getStaticANIObject1ByName((char *)subvar->_varName.c_str(), -1); + StaticANIObject *ani = sc->getStaticANIObject1ByName(subvar->_varName, -1); if (ani) { for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) { if (((StaticANIObject *)sc->_staticANIObjectList1[i])->_id == ani->_id) { @@ -279,7 +279,7 @@ void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject * if (strcmp(var->_value.stringValue, "ROOT")) break; - GameVar *v1 = g_fp->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName().c_str()); + GameVar *v1 = g_fp->getGameLoaderGameVar()->getSubVarByName("BEHAVIOR")->getSubVarByName(ani->getName()); if (v1 == var) return; @@ -317,7 +317,7 @@ BehaviorAnim::BehaviorAnim(GameVar *var, Scene *sc, StaticANIObject *ani, int *m _flags = 0; _behaviorMoves = 0; - Statics *st = ani->getStaticsByName((char *)var->_varName.c_str()); + Statics *st = ani->getStaticsByName(var->_varName); if (st) _staticsId = st->_staticsId; @@ -346,7 +346,7 @@ BehaviorMove::BehaviorMove(GameVar *subvar, Scene *sc, int *delay) { _delay = 0; _percent = 0; _flags = 0; - _messageQueue = sc->getMessageQueueByName((char *)subvar->_varName.c_str()); + _messageQueue = sc->getMessageQueueByName(subvar->_varName); GameVar *vart = subvar->getSubVarByName("dwDelay"); if (vart) diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 9c474d111b..32e2ea2862 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -552,7 +552,7 @@ void FullpipeEngine::updateScreen() { ++_updateTicks; } -int FullpipeEngine::getObjectEnumState(const char *name, const char *state) { +int FullpipeEngine::getObjectEnumState(Common::String name, const char *state) { GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES"); if (!var) { @@ -569,7 +569,7 @@ int FullpipeEngine::getObjectEnumState(const char *name, const char *state) { return 0; } -int FullpipeEngine::getObjectState(const char *objname) { +int FullpipeEngine::getObjectState(Common::String objname) { GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES"); if (var) @@ -578,7 +578,7 @@ int FullpipeEngine::getObjectState(const char *objname) { return 0; } -void FullpipeEngine::setObjectState(const char *name, int state) { +void FullpipeEngine::setObjectState(Common::String name, int state) { GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES"); if (!var) { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 3733bed65d..3c2df9fa0c 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -272,9 +272,9 @@ public: void setCursor(int id); void updateCursorCommon(); - int getObjectState(const char *objname); - void setObjectState(const char *name, int state); - int getObjectEnumState(const char *name, const char *state); + int getObjectState(Common::String objname); + void setObjectState(Common::String name, int state); + int getObjectEnumState(Common::String name, const char *state); void sceneAutoScrolling(); bool sceneSwitcher(EntranceInfo *entrance); diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 856552a8b1..8a959260ab 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -493,20 +493,20 @@ bool Interaction::canInteract(GameObject *obj1, GameObject *obj2, int invId) { if (_objectState1) { if (_flags & 0x10) { - if ((g_fp->getObjectState(obj1->getName().c_str()) & _objectState1) == 0) + if ((g_fp->getObjectState(obj1->getName()) & _objectState1) == 0) return false; } else { - if (g_fp->getObjectState(obj1->getName().c_str()) != _objectState1) + if (g_fp->getObjectState(obj1->getName()) != _objectState1) return false; } } if (_objectState2) { if (_flags & 0x10) { - if ((g_fp->getObjectState(obj2->getName().c_str()) & _objectState2) == 0) + if ((g_fp->getObjectState(obj2->getName()) & _objectState2) == 0) return false; } else { - if (g_fp->getObjectState(obj2->getName().c_str()) != _objectState2) + if (g_fp->getObjectState(obj2->getName()) != _objectState2) return false; } } diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 47d0591daa..5297b9e527 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -391,7 +391,7 @@ int MctlLadder::findObjectPos(StaticANIObject *obj) { bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) { debugC(4, kDebugPathfinding, "MctlLadder::initMovement(*%d, ...)", ani->_id); - GameVar *v = g_fp->getGameLoaderGameVar()->getSubVarByName(ani->getName().c_str()); + GameVar *v = g_fp->getGameLoaderGameVar()->getSubVarByName(ani->getName()); if (!v) return false; @@ -1744,7 +1744,7 @@ bool MctlGraph::fillData(StaticANIObject *obj, MctlAni *item) { item->_obj = obj; item->_objectId = obj->_id; - GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(obj->_objectName.c_str()); + GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(obj->_objectName); if (!var) return false; diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index 57f7864f1b..a8cd846631 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -90,10 +90,10 @@ class GameVar : public CObject { virtual bool load(MfcArchive &file); virtual void save(MfcArchive &file); - GameVar *getSubVarByName(const char *name); - bool setSubVarAsInt(const char *name, int value); - int getSubVarAsInt(const char *name); - GameVar *addSubVarAsInt(const char *name, int value); + GameVar *getSubVarByName(Common::String name); + bool setSubVarAsInt(Common::String name, int value); + int getSubVarAsInt(Common::String name); + GameVar *addSubVarAsInt(Common::String name, int value); bool addSubVar(GameVar *subvar); int getSubVarsCount(); GameVar *getSubVarByIndex(int idx); diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index a4086734b2..3dc8acdbcd 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -304,9 +304,9 @@ StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) { return 0; } -StaticANIObject *Scene::getStaticANIObject1ByName(char *name, int a3) { +StaticANIObject *Scene::getStaticANIObject1ByName(Common::String &name, int a3) { for (uint i = 0; i < _staticANIObjectList1.size(); i++) { - if (_staticANIObjectList1[i]->_objectName == name && (a3 == -1 || _staticANIObjectList1[i]->_odelay == a3)) + if ((_staticANIObjectList1[i]->_objectName == name) && (a3 == -1 || _staticANIObjectList1[i]->_odelay == a3)) return _staticANIObjectList1[i]; } @@ -365,9 +365,9 @@ PictureObject *Scene::getPictureObjectById(int objId, int flags) { return 0; } -PictureObject *Scene::getPictureObjectByName(const char *objName, int flags) { +PictureObject *Scene::getPictureObjectByName(Common::String objName, int flags) { for (uint i = 0; i < _picObjList.size(); i++) { - if (((PictureObject *)_picObjList[i])->_objectName == objName && (((PictureObject *)_picObjList[i])->_odelay == flags || flags == -1)) + if ((((PictureObject *)_picObjList[i])->_objectName == objName) && (((PictureObject *)_picObjList[i])->_odelay == flags || flags == -1)) return (PictureObject *)_picObjList[i]; } @@ -393,9 +393,9 @@ MessageQueue *Scene::getMessageQueueById(int messageId) { return 0; } -MessageQueue *Scene::getMessageQueueByName(char *name) { +MessageQueue *Scene::getMessageQueueByName(Common::String &name) { for (uint i = 0; i < _messageQueueList.size(); i++) - if (!strcmp(_messageQueueList[i]->_queueName.c_str(), name)) + if (_messageQueueList[i]->_queueName == name) return _messageQueueList[i]; return 0; @@ -407,14 +407,14 @@ void Scene::preloadMovements(GameVar *var) { return; for (GameVar *i = preload->_subVars; i; i = i->_nextVarObj) { - StaticANIObject *ani = getStaticANIObject1ByName((char *)i->_varName.c_str(), -1); + StaticANIObject *ani = getStaticANIObject1ByName(i->_varName, -1); if (ani) { GameVar *subVars = i->_subVars; if (subVars) { for (;subVars; subVars = subVars->_nextVarObj) { - Movement *mov = ani->getMovementByName((char *)subVars->_varName.c_str()); + Movement *mov = ani->getMovementByName(subVars->_varName); if (mov) mov->loadPixelData(); @@ -436,9 +436,9 @@ void Scene::initObjectCursors(const char *varname) { int minId = 0xffff; for (GameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) { - GameObject *obj = getPictureObjectByName((char *)sub->_varName.c_str(), -1); + GameObject *obj = getPictureObjectByName(sub->_varName, -1); - if (obj || (obj = getStaticANIObject1ByName((char *)sub->_varName.c_str(), -1)) != 0) { + if (obj || (obj = getStaticANIObject1ByName(sub->_varName, -1)) != 0) { if (obj->_id < minId) minId = obj->_id; if (obj->_id > maxId) @@ -452,10 +452,10 @@ void Scene::initObjectCursors(const char *varname) { g_fp->_objectIdCursors.resize(maxId - minId + 1); for (GameVar *sub = cursorsVar->_subVars; sub; sub = sub->_nextVarObj) { - GameObject *obj = getPictureObjectByName((char *)sub->_varName.c_str(), -1); + GameObject *obj = getPictureObjectByName(sub->_varName, -1); if (!obj) - obj = getStaticANIObject1ByName((char *)sub->_varName.c_str(), -1); + obj = getStaticANIObject1ByName(sub->_varName, -1); PictureObject *pic = getGameLoaderInventory()->getScene()->getPictureObjectByName(sub->_value.stringValue, -1); diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 324c8b9a2a..61e3aacba9 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -59,16 +59,16 @@ class Scene : public Background { StaticANIObject *getAniMan(); StaticANIObject *getStaticANIObject1ById(int obj, int a3); - StaticANIObject *getStaticANIObject1ByName(char *name, int a3); + StaticANIObject *getStaticANIObject1ByName(Common::String &name, int a3); MessageQueue *getMessageQueueById(int messageId); - MessageQueue *getMessageQueueByName(char *name); + MessageQueue *getMessageQueueByName(Common::String &name); void deleteStaticANIObject(StaticANIObject *obj); void addStaticANIObject(StaticANIObject *obj, bool addList2); void setPictureObjectsFlag4(); PictureObject *getPictureObjectById(int objId, int flags); - PictureObject *getPictureObjectByName(const char *name, int keyCode); + PictureObject *getPictureObjectByName(Common::String name, int keyCode); void deletePictureObject(PictureObject *obj); void preloadMovements(GameVar *var); diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 54d6fbbf3f..1430f3cb5e 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -492,18 +492,18 @@ bool GameVar::load(MfcArchive &file) { return true; } -GameVar *GameVar::getSubVarByName(const char *name) { +GameVar *GameVar::getSubVarByName(Common::String name) { GameVar *sv = 0; if (_subVars != 0) { sv = _subVars; - for (;sv && scumm_stricmp(sv->_varName.c_str(), name); sv = sv->_nextVarObj) + for (;sv && scumm_stricmp(sv->_varName.c_str(), name.c_str()); sv = sv->_nextVarObj) ; } return sv; } -bool GameVar::setSubVarAsInt(const char *name, int value) { +bool GameVar::setSubVarAsInt(Common::String name, int value) { GameVar *var = getSubVarByName(name); if (var) { @@ -523,7 +523,7 @@ bool GameVar::setSubVarAsInt(const char *name, int value) { return addSubVar(var); } -int GameVar::getSubVarAsInt(const char *name) { +int GameVar::getSubVarAsInt(Common::String name) { GameVar *var = getSubVarByName(name); if (var) @@ -532,7 +532,7 @@ int GameVar::getSubVarAsInt(const char *name) { return 0; } -GameVar *GameVar::addSubVarAsInt(const char *name, int value) { +GameVar *GameVar::addSubVarAsInt(Common::String name, int value) { if (getSubVarByName(name)) { return 0; } else { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 5c83114e10..5032ca719f 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -418,7 +418,7 @@ Statics *StaticANIObject::getStaticsById(int itemId) { return 0; } -Statics *StaticANIObject::getStaticsByName(char *name) { +Statics *StaticANIObject::getStaticsByName(Common::String &name) { for (uint i = 0; i < _staticsList.size(); i++) if (_staticsList[i]->_staticsName == name) return _staticsList[i]; @@ -450,7 +450,7 @@ int StaticANIObject::getMovementIdById(int itemId) { return 0; } -Movement *StaticANIObject::getMovementByName(char *name) { +Movement *StaticANIObject::getMovementByName(Common::String &name) { for (uint i = 0; i < _movements.size(); i++) if (_movements[i]->_objectName == name) return _movements[i]; @@ -681,7 +681,7 @@ void StaticANIObject::draw2() { } MovTable *StaticANIObject::countMovements() { - GameVar *preloadSubVar = g_fp->getGameLoaderGameVar()->getSubVarByName(getName().c_str())->getSubVarByName("PRELOAD"); + GameVar *preloadSubVar = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("PRELOAD"); if (!preloadSubVar || preloadSubVar->getSubVarsCount() == 0) return 0; @@ -706,7 +706,7 @@ MovTable *StaticANIObject::countMovements() { } void StaticANIObject::setSpeed(int speed) { - GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(getName().c_str())->getSubVarByName("SpeedUp"); + GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName(getName())->getSubVarByName("SpeedUp"); if (!var) return; diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 1bf95ec3b4..4812511ca1 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -204,10 +204,10 @@ public: void setOXY(int x, int y); Statics *getStaticsById(int id); - Statics *getStaticsByName(char *name); + Statics *getStaticsByName(Common::String &name); Movement *getMovementById(int id); int getMovementIdById(int itemId); - Movement *getMovementByName(char *name); + Movement *getMovementByName(Common::String &name); Common::Point *getCurrDimensions(Common::Point &p); Common::Point *getSomeXY(Common::Point &p); |