Skip to content

Commit

Permalink
WAGE: Get rid of Common::String import
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent 45afdbb commit 34f9a13
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 75 deletions.
6 changes: 3 additions & 3 deletions engines/wage/entities.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
68 changes: 34 additions & 34 deletions engines/wage/entities.h
Expand Up @@ -113,7 +113,7 @@ class Designed {
Designed() : _design(NULL), _designBounds(NULL), _classType(UNKNOWN) {}
~Designed();

String _name;
Common::String _name;
Design *_design;
Common::Rect *_designBounds;
OperandType _classType;
Expand All @@ -124,7 +124,7 @@ class Designed {

void setDesignBounds(Common::Rect *bounds);

String toString() { return _name; }
Common::String toString() { return _name; }
};

class Chr : public Designed {
Expand All @@ -149,10 +149,10 @@ class Chr : public Designed {
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;
Expand All @@ -171,20 +171,20 @@ class Chr : public Designed {
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;
Expand All @@ -195,13 +195,13 @@ class Chr : public Designed {
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;
Expand Down Expand Up @@ -229,7 +229,7 @@ class Chr : public Designed {
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 {
Expand Down Expand Up @@ -261,19 +261,19 @@ class Obj : public Designed {
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) {
Expand Down Expand Up @@ -302,15 +302,15 @@ class Scene : public Designed {
};

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;
Expand All @@ -319,7 +319,7 @@ class Scene : public Designed {
ChrList _chrs;

Scene();
Scene(String name, Common::SeekableReadStream *data);
Scene(Common::String name, Common::SeekableReadStream *data);
~Scene();

Common::Rect *getTextBounds() {
Expand All @@ -333,10 +333,10 @@ class Scene : public Designed {

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;
};

Expand Down
2 changes: 1 addition & 1 deletion engines/wage/gui.cpp
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions engines/wage/script.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions engines/wage/script.h
Expand Up @@ -61,7 +61,7 @@ class Script {
WageEngine *_engine;
World *_world;
int _loopCount;
String *_inputText;
Common::String *_inputText;
Designed *_inputClick;
bool _handled;

Expand All @@ -73,7 +73,7 @@ class Script {
Designed *designed;
Scene *scene;
int16 number;
String *string;
Common::String *string;
Designed *inputClick;
} _value;
OperandType _type;
Expand All @@ -99,7 +99,7 @@ class Script {
_type = type;
}

Operand(String *value, OperandType type) {
Operand(Common::String *value, OperandType type) {
_value.string = value;
_type = type;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ class Script {
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();
Expand Down
2 changes: 1 addition & 1 deletion engines/wage/util.cpp
Expand Up @@ -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':
Expand Down
12 changes: 6 additions & 6 deletions engines/wage/wage.cpp
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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]);
Expand All @@ -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]);
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 4 additions & 6 deletions engines/wage/wage.h
Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -200,15 +198,15 @@ class WageEngine : public Engine {

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();
Expand Down
8 changes: 4 additions & 4 deletions engines/wage/world.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 34f9a13

Please sign in to comment.