diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/combat.cpp | 18 | ||||
-rw-r--r-- | engines/wage/entities.cpp | 9 | ||||
-rw-r--r-- | engines/wage/entities.h | 2 | ||||
-rw-r--r-- | engines/wage/wage.cpp | 6 |
4 files changed, 23 insertions, 12 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp index 7261a55482..cdf336f9f4 100644 --- a/engines/wage/combat.cpp +++ b/engines/wage/combat.cpp @@ -77,7 +77,8 @@ void WageEngine::encounter(Chr *player, Chr *chr) { appendText(chr->_initialComment); if (chr->_armor[Chr::HEAD_ARMOR] != NULL) { - msg = chr->getNameWithDefiniteArticle(true); + msg = chr->getDefiniteArticle(true); + msg += chr->_name; msg += " is wearing "; msg += getIndefiniteArticle(chr->_armor[Chr::HEAD_ARMOR]->_name); msg += "."; @@ -195,14 +196,25 @@ void WageEngine::performMove(Chr *chr, int validMoves) { } void WageEngine::performOffer(Chr *attacker, Chr *victim) { - warning("STUB: performOffer()"); + /* TODO: choose in a smarter way? */ + Obj *obj = attacker->_inventory[0]; + Common::String msg(attacker->getDefiniteArticle(true)); + msg += attacker->_name; + msg += " offers "; + msg += obj->_namePlural ? "some " : getIndefiniteArticle(obj->_name); + msg += obj->_name; + msg += "."; + + _offer = obj; } void WageEngine::performTake(Chr *npc, Obj *obj) { - Common::String msg(npc->getNameWithDefiniteArticle(true)); + Common::String msg(npc->getDefiniteArticle(true)); + msg += npc->_name; msg += " picks up the "; msg += getIndefiniteArticle(obj->_name); msg += obj->_name; + msg += "."; _world->move(obj, npc); } diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index 64e919b978..8472e7844b 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -432,14 +432,11 @@ int Chr::wearObjIfPossible(Obj *obj) { return -1; } -String &Chr::getNameWithDefiniteArticle(bool capitalize) { - Common::String *res = new Common::String; - +const char *Chr::getDefiniteArticle(bool capitalize) { if (!_nameProperNoun) - *res += capitalize ? "The " : "the "; - *res += _name; + return capitalize ? "The " : "the "; - return *res; + return ""; } diff --git a/engines/wage/entities.h b/engines/wage/entities.h index 5f1c968424..362e9b59c5 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -221,7 +221,7 @@ public: WeaponArray *getWeapons(bool includeMagic); ObjArray *getMagicalObjects(); - String &getNameWithDefiniteArticle(bool capitalize); + const char *getDefiniteArticle(bool capitalize); public: bool hasNativeWeapon1() { diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp index c1b654f132..37a6031940 100644 --- a/engines/wage/wage.cpp +++ b/engines/wage/wage.cpp @@ -433,13 +433,15 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) { Common::String msg; if (followed) { - msg = prevMonster->getNameWithDefiniteArticle(true); + msg = prevMonster->getDefiniteArticle(true); + msg += prevMonster->_name; msg += " follows you."; appendText(msg); _world->move(prevMonster, playerScene); } else { msg = "You escape "; - msg += prevMonster->getNameWithDefiniteArticle(false); + msg += prevMonster->getDefiniteArticle(false); + msg += prevMonster->_name; msg += "."; appendText(msg); } |