diff options
author | Eugene Sandulenko | 2016-01-27 11:02:52 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:12:53 +0100 |
commit | 45afdbbd5c9e5ddb8ac470b0b05dcb65f1f75d39 (patch) | |
tree | 5783f58293940cbf6011c1257baefc8ac30a56a0 | |
parent | a9b7b0463056e23b0bcd229876e7d4285e2b5f5e (diff) | |
download | scummvm-rg350-45afdbbd5c9e5ddb8ac470b0b05dcb65f1f75d39.tar.gz scummvm-rg350-45afdbbd5c9e5ddb8ac470b0b05dcb65f1f75d39.tar.bz2 scummvm-rg350-45afdbbd5c9e5ddb8ac470b0b05dcb65f1f75d39.zip |
WAGE: Implement handleOfferCommand()
-rw-r--r-- | engines/wage/combat.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp index d1f5d2639c..f769e17312 100644 --- a/engines/wage/combat.cpp +++ b/engines/wage/combat.cpp @@ -737,7 +737,31 @@ void WageEngine::wearObj(Obj *o, int pos) { bool WageEngine::handleOfferCommand(const char *target) { - warning("STUB: handleOfferCommand"); + Chr *player = _world->_player; + Chr *enemy = getMonster(); + + if (enemy != NULL) { + Common::String t(target); + t.toLowercase(); + + for (ObjArray::const_iterator it = player->_inventory.begin(); it != player->_inventory.end(); ++it) { + Common::String n((*it)->_name); + n.toLowercase(); + + if (t.contains(n)) { + if ((*it)->_value < enemy->_rejectsOffers) { + appendText("Your offer is rejected."); + } else { + appendText("Your offer is accepted."); + appendText(enemy->_acceptsOfferComment.c_str()); + _world->move(*it, enemy); + _world->move(enemy, _world->_storageScene); + } + + return true; + } + } + } return false; } |