diff options
author | Filippos Karapetis | 2017-03-24 00:35:37 +0200 |
---|---|---|
committer | Filippos Karapetis | 2017-03-24 00:56:11 +0200 |
commit | a93c8c5d3ee5345f3a7889d501370f30494e5278 (patch) | |
tree | 5b880963702e552b34f3ebab5247897bec2b0dc6 | |
parent | 1c083fe0004c2b952da3bd8e45de0c4139f62786 (diff) | |
download | scummvm-rg350-a93c8c5d3ee5345f3a7889d501370f30494e5278.tar.gz scummvm-rg350-a93c8c5d3ee5345f3a7889d501370f30494e5278.tar.bz2 scummvm-rg350-a93c8c5d3ee5345f3a7889d501370f30494e5278.zip |
Unify all string function parameters to be const Common::String &
Thanks to wjp for the suggestion
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 6 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 10 | ||||
-rw-r--r-- | engines/fullpipe/objects.h | 8 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 6 | ||||
-rw-r--r-- | engines/fullpipe/scene.h | 6 | ||||
-rw-r--r-- | engines/fullpipe/sound.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/sound.h | 4 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/statics.h | 4 | ||||
-rw-r--r-- | engines/fullpipe/utils.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/utils.h | 8 |
12 files changed, 40 insertions, 40 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index ea75af1a5a..61e7eef692 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -548,7 +548,7 @@ void FullpipeEngine::updateScreen() { ++_updateTicks; } -int FullpipeEngine::getObjectEnumState(Common::String name, const char *state) { +int FullpipeEngine::getObjectEnumState(const Common::String &name, const char *state) { GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES"); if (!var) { @@ -565,7 +565,7 @@ int FullpipeEngine::getObjectEnumState(Common::String name, const char *state) { return 0; } -int FullpipeEngine::getObjectState(Common::String objname) { +int FullpipeEngine::getObjectState(const Common::String &objname) { GameVar *var = _gameLoader->_gameVar->getSubVarByName("OBJSTATES"); if (var) @@ -574,7 +574,7 @@ int FullpipeEngine::getObjectState(Common::String objname) { return 0; } -void FullpipeEngine::setObjectState(Common::String name, int state) { +void FullpipeEngine::setObjectState(const 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 f58c63b73f..0a763816fd 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -183,8 +183,8 @@ public: int getSceneTrack(); void updateTrackDelay(); void startSceneTrack(); - void startSoundStream1(Common::String trackName); - void playOggSound(Common::String trackName, Audio::SoundHandle *stream); + void startSoundStream1(const Common::String &trackName); + void playOggSound(const Common::String &trackName, Audio::SoundHandle *stream); void stopSoundStream2(); void stopAllSoundStreams(); void stopAllSoundInstances(int id); @@ -272,9 +272,9 @@ public: void setCursor(int id); void updateCursorCommon(); - int getObjectState(Common::String objname); - void setObjectState(Common::String name, int state); - int getObjectEnumState(Common::String name, const char *state); + int getObjectState(const Common::String &objname); + void setObjectState(const Common::String &name, int state); + int getObjectEnumState(const Common::String &name, const char *state); void sceneAutoScrolling(); bool sceneSwitcher(EntranceInfo *entrance); diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index a8cd846631..78165c4f8d 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(Common::String name); - bool setSubVarAsInt(Common::String name, int value); - int getSubVarAsInt(Common::String name); - GameVar *addSubVarAsInt(Common::String name, int value); + GameVar *getSubVarByName(const Common::String &name); + bool setSubVarAsInt(const Common::String &name, int value); + int getSubVarAsInt(const Common::String &name); + GameVar *addSubVarAsInt(const 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 fa4f955832..b5508da0ba 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -293,7 +293,7 @@ StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) { return 0; } -StaticANIObject *Scene::getStaticANIObject1ByName(Common::String &name, int a3) { +StaticANIObject *Scene::getStaticANIObject1ByName(const Common::String &name, int a3) { for (uint i = 0; i < _staticANIObjectList1.size(); i++) { if ((_staticANIObjectList1[i]->_objectName == name) && (a3 == -1 || _staticANIObjectList1[i]->_odelay == a3)) return _staticANIObjectList1[i]; @@ -354,7 +354,7 @@ PictureObject *Scene::getPictureObjectById(int objId, int flags) { return 0; } -PictureObject *Scene::getPictureObjectByName(Common::String objName, int flags) { +PictureObject *Scene::getPictureObjectByName(const 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)) return (PictureObject *)_picObjList[i]; @@ -382,7 +382,7 @@ MessageQueue *Scene::getMessageQueueById(int messageId) { return 0; } -MessageQueue *Scene::getMessageQueueByName(Common::String &name) { +MessageQueue *Scene::getMessageQueueByName(const Common::String &name) { for (uint i = 0; i < _messageQueueList.size(); i++) if (_messageQueueList[i]->_queueName == name) return _messageQueueList[i]; diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 61e3aacba9..9a684ce7bc 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(Common::String &name, int a3); + StaticANIObject *getStaticANIObject1ByName(const Common::String &name, int a3); MessageQueue *getMessageQueueById(int messageId); - MessageQueue *getMessageQueueByName(Common::String &name); + MessageQueue *getMessageQueueByName(const Common::String &name); void deleteStaticANIObject(StaticANIObject *obj); void addStaticANIObject(StaticANIObject *obj, bool addList2); void setPictureObjectsFlag4(); PictureObject *getPictureObjectById(int objId, int flags); - PictureObject *getPictureObjectByName(Common::String name, int keyCode); + PictureObject *getPictureObjectByName(const Common::String &name, int keyCode); void deletePictureObject(PictureObject *obj); void preloadMovements(GameVar *var); diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index d4c944a695..77112cb518 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -50,7 +50,7 @@ SoundList::~SoundList() { free(_soundItems); } -bool SoundList::load(MfcArchive &file, Common::String fname) { +bool SoundList::load(MfcArchive &file, const Common::String &fname) { debugC(5, kDebugLoading, "SoundList::load()"); _soundItemsCount = file.readUint32LE(); @@ -73,7 +73,7 @@ bool SoundList::load(MfcArchive &file, Common::String fname) { } -bool SoundList::loadFile(Common::String fname, Common::String libname) { +bool SoundList::loadFile(const Common::String &fname, const Common::String &libname) { Common::File file; if (!file.open(fname)) @@ -364,13 +364,13 @@ int FullpipeEngine::getSceneTrack() { return res; } -void FullpipeEngine::startSoundStream1(Common::String trackName) { +void FullpipeEngine::startSoundStream1(const Common::String &trackName) { stopAllSoundStreams(); playOggSound(trackName, _soundStream1); } -void FullpipeEngine::playOggSound(Common::String trackName, Audio::SoundHandle *stream) { +void FullpipeEngine::playOggSound(const Common::String &trackName, Audio::SoundHandle *stream) { #ifdef USE_VORBIS if (_mixer->isSoundHandleActive(*stream)) return; diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index ea1cf2c9bf..bccf2a781c 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -67,9 +67,9 @@ class SoundList : public CObject { public: SoundList(); ~SoundList(); - virtual bool load(MfcArchive &file, Common::String fname); + virtual bool load(MfcArchive &file, const Common::String &fname); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class - bool loadFile(Common::String fname, Common::String libname); + bool loadFile(const Common::String &fname, const Common::String &libname); int getCount() { return _soundItemsCount; } Sound *getSoundByIndex(int idx) { return _soundItems[idx]; } diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 1430f3cb5e..d55f7dbf31 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -492,7 +492,7 @@ bool GameVar::load(MfcArchive &file) { return true; } -GameVar *GameVar::getSubVarByName(Common::String name) { +GameVar *GameVar::getSubVarByName(const Common::String &name) { GameVar *sv = 0; if (_subVars != 0) { @@ -503,7 +503,7 @@ GameVar *GameVar::getSubVarByName(Common::String name) { return sv; } -bool GameVar::setSubVarAsInt(Common::String name, int value) { +bool GameVar::setSubVarAsInt(const Common::String &name, int value) { GameVar *var = getSubVarByName(name); if (var) { @@ -523,7 +523,7 @@ bool GameVar::setSubVarAsInt(Common::String name, int value) { return addSubVar(var); } -int GameVar::getSubVarAsInt(Common::String name) { +int GameVar::getSubVarAsInt(const Common::String &name) { GameVar *var = getSubVarByName(name); if (var) @@ -532,7 +532,7 @@ int GameVar::getSubVarAsInt(Common::String name) { return 0; } -GameVar *GameVar::addSubVarAsInt(Common::String name, int value) { +GameVar *GameVar::addSubVarAsInt(const Common::String &name, int value) { if (getSubVarByName(name)) { return 0; } else { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 447b78a3e1..32c019e5af 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -417,7 +417,7 @@ Statics *StaticANIObject::getStaticsById(int itemId) { return 0; } -Statics *StaticANIObject::getStaticsByName(Common::String &name) { +Statics *StaticANIObject::getStaticsByName(const Common::String &name) { for (uint i = 0; i < _staticsList.size(); i++) if (_staticsList[i]->_staticsName == name) return _staticsList[i]; @@ -449,7 +449,7 @@ int StaticANIObject::getMovementIdById(int itemId) { return 0; } -Movement *StaticANIObject::getMovementByName(Common::String &name) { +Movement *StaticANIObject::getMovementByName(const Common::String &name) { for (uint i = 0; i < _movements.size(); i++) if (_movements[i]->_objectName == name) return _movements[i]; diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 4812511ca1..f19d981553 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(Common::String &name); + Statics *getStaticsByName(const Common::String &name); Movement *getMovementById(int id); int getMovementIdById(int itemId); - Movement *getMovementByName(Common::String &name); + Movement *getMovementByName(const Common::String &name); Common::Point *getCurrDimensions(Common::Point &p); Common::Point *getSomeXY(Common::Point &p); diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index ed30096b69..5500d23202 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -33,7 +33,7 @@ namespace Fullpipe { -bool CObject::loadFile(Common::String fname) { +bool CObject::loadFile(const Common::String &fname) { Common::File file; if (!file.open(fname)) @@ -112,7 +112,7 @@ Common::String MfcArchive::readPascalString(bool twoByte) { return result; } -void MfcArchive::writePascalString(Common::String str, bool twoByte) { +void MfcArchive::writePascalString(const Common::String &str, bool twoByte) { int len = str.size(); if (twoByte) @@ -154,7 +154,7 @@ bool MemoryObject::load(MfcArchive &file) { return true; } -void MemoryObject::loadFile(Common::String filename) { +void MemoryObject::loadFile(const Common::String &filename) { debugC(5, kDebugLoading, "MemoryObject::loadFile(<%s>)", filename.c_str()); if (filename.empty()) @@ -501,7 +501,7 @@ Common::String genFileName(int superId, int sceneId, const char *ext) { } // Translates cp-1251..utf-8 -byte *transCyrillic(Common::String str) { +byte *transCyrillic(const Common::String &str) { byte *s = (byte *)str.c_str(); static byte tmp[1024]; diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 06b2872b54..bb8c9651da 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -68,7 +68,7 @@ public: MfcArchive(Common::WriteStream *file); Common::String readPascalString(bool twoByte = false); - void writePascalString(Common::String str, bool twoByte = false); + void writePascalString(const Common::String &str, bool twoByte = false); int readCount(); double readDouble(); CObject *parseClass(bool *isCopyReturned); @@ -117,7 +117,7 @@ public: virtual void save(MfcArchive &out) { error("Not implemented for obj type: %d", _objtype); } virtual ~CObject() {} - bool loadFile(Common::String fname); + bool loadFile(const Common::String &fname); }; class ObList : public Common::List<CObject *>, public CObject { @@ -145,7 +145,7 @@ class MemoryObject : CObject { virtual ~MemoryObject(); virtual bool load(MfcArchive &file); - void loadFile(Common::String filename); + void loadFile(const Common::String &filename); void load() { loadFile(_memfilename); } byte *getData(); byte *loadData(); @@ -181,7 +181,7 @@ class DWordArray : public Common::Array<int32>, public CObject { }; Common::String genFileName(int superId, int sceneId, const char *ext); -byte *transCyrillic(Common::String str); +byte *transCyrillic(const Common::String &str); } // End of namespace Fullpipe |