diff options
author | Eugene Sandulenko | 2016-01-27 11:11:02 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:12:53 +0100 |
commit | 34f9a1375dec7bf6b42104fd5ffed0c36c112130 (patch) | |
tree | 83162408ca872f30236fe4e515a55062e29fe8da | |
parent | 45afdbbd5c9e5ddb8ac470b0b05dcb65f1f75d39 (diff) | |
download | scummvm-rg350-34f9a1375dec7bf6b42104fd5ffed0c36c112130.tar.gz scummvm-rg350-34f9a1375dec7bf6b42104fd5ffed0c36c112130.tar.bz2 scummvm-rg350-34f9a1375dec7bf6b42104fd5ffed0c36c112130.zip |
WAGE: Get rid of Common::String import
-rw-r--r-- | engines/wage/entities.cpp | 6 | ||||
-rw-r--r-- | engines/wage/entities.h | 68 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 2 | ||||
-rw-r--r-- | engines/wage/script.cpp | 6 | ||||
-rw-r--r-- | engines/wage/script.h | 8 | ||||
-rw-r--r-- | engines/wage/util.cpp | 2 | ||||
-rw-r--r-- | engines/wage/wage.cpp | 12 | ||||
-rw-r--r-- | engines/wage/wage.h | 10 | ||||
-rw-r--r-- | engines/wage/world.cpp | 8 | ||||
-rw-r--r-- | engines/wage/world.h | 26 |
10 files changed, 73 insertions, 75 deletions
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index 5149fb3d3c..85ce8cf7ad 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -96,7 +96,7 @@ Scene::Scene() { _visited = false; } -Scene::Scene(String name, Common::SeekableReadStream *data) { +Scene::Scene(Common::String name, Common::SeekableReadStream *data) { _name = name; _classType = SCENE; _design = new Design(data); @@ -200,7 +200,7 @@ const char *Scene::getFontName() { return "Unknown"; } -Obj::Obj(String name, Common::SeekableReadStream *data) { +Obj::Obj(Common::String name, Common::SeekableReadStream *data) { _name = name; _classType = OBJ; _currentOwner = NULL; @@ -285,7 +285,7 @@ void Obj::resetState(Chr *owner, Scene *scene) { warning("STUB: Obj::resetState()"); } -Chr::Chr(String name, Common::SeekableReadStream *data) { +Chr::Chr(Common::String name, Common::SeekableReadStream *data) { _name = name; _classType = CHR; _design = new Design(data); diff --git a/engines/wage/entities.h b/engines/wage/entities.h index aaaaee5928..a9066fe91b 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -113,7 +113,7 @@ public: Designed() : _design(NULL), _designBounds(NULL), _classType(UNKNOWN) {} ~Designed(); - String _name; + Common::String _name; Design *_design; Common::Rect *_designBounds; OperandType _classType; @@ -124,7 +124,7 @@ public: void setDesignBounds(Common::Rect *bounds); - String toString() { return _name; } + Common::String toString() { return _name; } }; class Chr : public Designed { @@ -149,10 +149,10 @@ public: NUMBER_OF_ARMOR_TYPES = 4 }; - Chr(String name, Common::SeekableReadStream *data); + Chr(Common::String name, Common::SeekableReadStream *data); int _index; - String _initialScene; + Common::String _initialScene; int _gender; bool _nameProperNoun; bool _playerCharacter; @@ -171,20 +171,20 @@ public: int _rejectsOffers; int _followsOpponent; - String _initialSound; - String _scoresHitSound; - String _receivesHitSound; - String _dyingSound; + Common::String _initialSound; + Common::String _scoresHitSound; + Common::String _receivesHitSound; + Common::String _dyingSound; - String _nativeWeapon1; - String _operativeVerb1; + Common::String _nativeWeapon1; + Common::String _operativeVerb1; int _weaponDamage1; - String _weaponSound1; + Common::String _weaponSound1; - String _nativeWeapon2; - String _operativeVerb2; + Common::String _nativeWeapon2; + Common::String _operativeVerb2; int _weaponDamage2; - String _weaponSound2; + Common::String _weaponSound2; int _winningWeapons; int _winningMagic; @@ -195,13 +195,13 @@ public: int _losingRun; int _losingOffer; - String _initialComment; - String _scoresHitComment; - String _receivesHitComment; - String _makesOfferComment; - String _rejectsOfferComment; - String _acceptsOfferComment; - String _dyingWords; + Common::String _initialComment; + Common::String _scoresHitComment; + Common::String _receivesHitComment; + Common::String _makesOfferComment; + Common::String _rejectsOfferComment; + Common::String _acceptsOfferComment; + Common::String _dyingWords; Scene *_currentScene; ObjArray _inventory; @@ -229,7 +229,7 @@ public: class Obj : public Designed { public: Obj() : _currentOwner(NULL), _currentScene(NULL) {} - Obj(String name, Common::SeekableReadStream *data); + Obj(Common::String name, Common::SeekableReadStream *data); ~Obj(); enum ObjectType { @@ -261,19 +261,19 @@ public: int _attackType; int _numberOfUses; bool _returnToRandomScene; - String _sceneOrOwner; - String _clickMessage; - String _failureMessage; - String _useMessage; + Common::String _sceneOrOwner; + Common::String _clickMessage; + Common::String _failureMessage; + Common::String _useMessage; Scene *_currentScene; Chr *_currentOwner; int _type; uint _accuracy; - String _operativeVerb; + Common::String _operativeVerb; int _damage; - String _sound; + Common::String _sound; public: void setCurrentOwner(Chr *currentOwner) { @@ -302,15 +302,15 @@ public: }; Script *_script; - String _text; + Common::String _text; Common::Rect *_textBounds; int _fontSize; int _fontType; // 3 => Geneva, 22 => Courier, param to TextFont() function bool _blocked[4]; - String _messages[4]; + Common::String _messages[4]; int _soundFrequency; // times a minute, max 3600 int _soundType; - String _soundName; + Common::String _soundName; int _worldX; int _worldY; bool _visited; @@ -319,7 +319,7 @@ public: ChrList _chrs; Scene(); - Scene(String name, Common::SeekableReadStream *data); + Scene(Common::String name, Common::SeekableReadStream *data); ~Scene(); Common::Rect *getTextBounds() { @@ -333,10 +333,10 @@ public: class Sound { public: - Sound(String name, Common::SeekableReadStream *data) : _name(name), _data(data) {} + Sound(Common::String name, Common::SeekableReadStream *data) : _name(name), _data(data) {} ~Sound() { } - String _name; + Common::String _name; Common::SeekableReadStream *_data; }; diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 5bebc396b8..967628b3ad 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -409,7 +409,7 @@ enum { kConOverscan = 3 }; -void Gui::flowText(String &str) { +void Gui::flowText(Common::String &str) { Common::StringArray wrappedLines; int textW = _consoleTextArea.width() - kConWPadding * 2; const Graphics::Font *font = getConsoleFont(); diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp index 410186e6ff..78ec766358 100644 --- a/engines/wage/script.cpp +++ b/engines/wage/script.cpp @@ -80,7 +80,7 @@ void Script::printLine(int offset) { } } -bool Script::execute(World *world, int loopCount, String *inputText, Designed *inputClick, WageEngine *engine) { +bool Script::execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick, WageEngine *engine) { _world = world; _loopCount = loopCount; _inputText = inputText; @@ -384,10 +384,10 @@ void Script::assign(byte operandType, int uservar, uint16 value) { } Script::Operand *Script::readStringOperand() { - String *sb; + Common::String *sb; bool allDigits = true; - sb = new String(); + sb = new Common::String(); while (true) { byte c = _data->readByte(); diff --git a/engines/wage/script.h b/engines/wage/script.h index 143a93dc4d..39fbbc52d0 100644 --- a/engines/wage/script.h +++ b/engines/wage/script.h @@ -61,7 +61,7 @@ private: WageEngine *_engine; World *_world; int _loopCount; - String *_inputText; + Common::String *_inputText; Designed *_inputClick; bool _handled; @@ -73,7 +73,7 @@ private: Designed *designed; Scene *scene; int16 number; - String *string; + Common::String *string; Designed *inputClick; } _value; OperandType _type; @@ -99,7 +99,7 @@ private: _type = type; } - Operand(String *value, OperandType type) { + Operand(Common::String *value, OperandType type) { _value.string = value; _type = type; } @@ -149,7 +149,7 @@ private: public: void print(); void printLine(int offset); - bool execute(World *world, int loopCount, String *inputText, Designed *inputClick, WageEngine *engine); + bool execute(World *world, int loopCount, Common::String *inputText, Designed *inputClick, WageEngine *engine); private: Operand *readOperand(); diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp index 1216a275b0..2586c2884e 100644 --- a/engines/wage/util.cpp +++ b/engines/wage/util.cpp @@ -87,7 +87,7 @@ Common::Rect *readRect(Common::SeekableReadStream *in) { return new Common::Rect(x1, y1, x2, y2); } -const char *getIndefiniteArticle(String &word) { +const char *getIndefiniteArticle(Common::String &word) { switch (word[0]) { case 'a': case 'A': case 'e': case 'E': diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp index 6f3f4b28c9..de5f9e1526 100644 --- a/engines/wage/wage.cpp +++ b/engines/wage/wage.cpp @@ -196,11 +196,11 @@ void WageEngine::processEvents() { } } -void WageEngine::playSound(String soundName) { +void WageEngine::playSound(Common::String soundName) { warning("STUB: WageEngine::playSound(%s)", soundName.c_str()); } -void WageEngine::setMenu(String soundName) { +void WageEngine::setMenu(Common::String soundName) { warning("STUB: WageEngine::setMenu"); } @@ -268,7 +268,7 @@ void WageEngine::performInitialSetup() { for (uint i = 0; i < _world->_orderedObjs.size(); i++) { Obj *obj = _world->_orderedObjs[i]; if (!obj->_sceneOrOwner.equalsIgnoreCase(STORAGESCENE)) { - String location = obj->_sceneOrOwner; + Common::String location = obj->_sceneOrOwner; location.toLowercase(); if (_world->_scenes.contains(location)) { _world->move(obj, _world->_scenes[location]); @@ -288,7 +288,7 @@ void WageEngine::performInitialSetup() { for (uint i = 0; i < _world->_orderedChrs.size(); i++) { Chr *chr = _world->_orderedChrs[i]; if (!chr->_initialScene.equalsIgnoreCase(STORAGESCENE)) { - String key = chr->_initialScene; + Common::String key = chr->_initialScene; key.toLowercase(); if (_world->_scenes.contains(key)) { _world->move(chr, _world->_scenes[key]); @@ -313,7 +313,7 @@ void WageEngine::doClose() { warning("STUB: doClose()"); } -Scene *WageEngine::getSceneByName(String &location) { +Scene *WageEngine::getSceneByName(Common::String &location) { Scene *scene; if (location.equals("random@")) { scene = _world->getRandomScene(); @@ -354,7 +354,7 @@ void WageEngine::onMove(Designed *what, Designed *from, Designed *to) { if (to == _world->_storageScene) { int returnTo = chr->_returnTo; if (returnTo != Chr::RETURN_TO_STORAGE) { - String returnToSceneName; + Common::String returnToSceneName; if (returnTo == Chr::RETURN_TO_INITIAL_SCENE) { returnToSceneName = chr->_initialScene; returnToSceneName.toLowercase(); diff --git a/engines/wage/wage.h b/engines/wage/wage.h index 416c8b28e9..65bfa9109a 100644 --- a/engines/wage/wage.h +++ b/engines/wage/wage.h @@ -74,8 +74,6 @@ typedef Common::Array<Chr *> ChrArray; typedef Common::List<Obj *> ObjList; typedef Common::List<Chr *> ChrList; -using Common::String; - enum OperandType { OBJ = 0, CHR = 1, @@ -111,7 +109,7 @@ enum { Common::String readPascalString(Common::SeekableReadStream *in); Common::Rect *readRect(Common::SeekableReadStream *in); -const char *getIndefiniteArticle(String &word); +const char *getIndefiniteArticle(Common::String &word); const char *prependGenderSpecificPronoun(int gender); const char *getGenderSpecificPronoun(int gender, bool capitalize); @@ -200,15 +198,15 @@ public: Common::String _inputText; - void playSound(String soundName); - void setMenu(String soundName); + void playSound(Common::String soundName); + void setMenu(Common::String soundName); void appendText(const char *str); void gameOver(); bool saveDialog(); Obj *getOffer(); Chr *getMonster(); void processEvents(); - Scene *getSceneByName(String &location); + Scene *getSceneByName(Common::String &location); void onMove(Designed *what, Designed *from, Designed *to); void encounter(Chr *player, Chr *chr); void redrawScene(); diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index cead6ae49d..fbb72457a1 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -180,7 +180,7 @@ bool World::loadWorld(Common::MacResManager *resMan) { scene->_fontType = res->readUint16BE(); scene->_fontSize = res->readUint16BE(); - String text; + Common::String text; while (res->pos() < res->size()) { char c = res->readByte(); if (c == 0x0d) @@ -299,8 +299,8 @@ bool World::loadWorld(Common::MacResManager *resMan) { Common::StringArray *World::readMenu(Common::SeekableReadStream *res) { res->skip(10); int enableFlags = res->readUint32BE(); - String menuName = readPascalString(res); - String menuItem = readPascalString(res); + Common::String menuName = readPascalString(res); + Common::String menuItem = readPascalString(res); int menuItemNumber = 1; Common::String menu; byte itemData[4]; @@ -339,7 +339,7 @@ Common::StringArray *World::readMenu(Common::SeekableReadStream *res) { return result; } -void World::loadExternalSounds(String fname) { +void World::loadExternalSounds(Common::String fname) { Common::File in; in.open(fname); diff --git a/engines/wage/world.h b/engines/wage/world.h index ba1aa164c1..cb7239122d 100644 --- a/engines/wage/world.h +++ b/engines/wage/world.h @@ -58,7 +58,7 @@ public: ~World(); bool loadWorld(Common::MacResManager *resMan); - void loadExternalSounds(String fname); + void loadExternalSounds(Common::String fname); Common::String *loadStringFromDITL(Common::MacResManager *resMan, int resourceId, int itemIndex); void move(Obj *obj, Chr *chr); void move(Obj *obj, Scene *scene, bool skipSort = false); @@ -70,17 +70,17 @@ public: WageEngine *_engine; - String _name; - String _aboutMessage; - String _soundLibrary1; - String _soundLibrary2; + Common::String _name; + Common::String _aboutMessage; + Common::String _soundLibrary1; + Common::String _soundLibrary2; bool _weaponMenuDisabled; Script *_globalScript; - Common::HashMap<String, Scene *> _scenes; - Common::HashMap<String, Obj *> _objs; - Common::HashMap<String, Chr *> _chrs; - Common::HashMap<String, Sound *> _sounds; + Common::HashMap<Common::String, Scene *> _scenes; + Common::HashMap<Common::String, Obj *> _objs; + Common::HashMap<Common::String, Chr *> _chrs; + Common::HashMap<Common::String, Sound *> _sounds; Common::Array<Scene *> _orderedScenes; ObjArray _orderedObjs; ChrArray _orderedChrs; @@ -102,7 +102,7 @@ public: void addScene(Scene *room) { if (room->_name.size() != 0) { - String s = room->_name; + Common::String s = room->_name; s.toLowercase(); _scenes[s] = room; } @@ -110,7 +110,7 @@ public: } void addObj(Obj *obj) { - String s = obj->_name; + Common::String s = obj->_name; s.toLowercase(); _objs[s] = obj; obj->_index = _orderedObjs.size(); @@ -118,7 +118,7 @@ public: } void addChr(Chr *chr) { - String s = chr->_name; + Common::String s = chr->_name; s.toLowercase(); _chrs[s] = chr; chr->_index = _orderedChrs.size(); @@ -126,7 +126,7 @@ public: } void addSound(Sound *sound) { - String s = sound->_name; + Common::String s = sound->_name; s.toLowercase(); _sounds[s] = sound; _orderedSounds.push_back(sound); |