diff options
author | Eugene Sandulenko | 2015-12-24 14:12:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-27 15:41:01 +0100 |
commit | f76eb1831cce8177a3cc477fb1e5d4954635f982 (patch) | |
tree | 8143b0b71bbcdbc36c5b7d8ec9008719ce73ebed /engines/wage/script.cpp | |
parent | 88faad5d08bc10272f04ebc1ce122b8b446d31a8 (diff) | |
download | scummvm-rg350-f76eb1831cce8177a3cc477fb1e5d4954635f982.tar.gz scummvm-rg350-f76eb1831cce8177a3cc477fb1e5d4954635f982.tar.bz2 scummvm-rg350-f76eb1831cce8177a3cc477fb1e5d4954635f982.zip |
WAGE: Implemented object taking logic
Diffstat (limited to 'engines/wage/script.cpp')
-rw-r--r-- | engines/wage/script.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp index 5ef1b6e209..dcb993a2a9 100644 --- a/engines/wage/script.cpp +++ b/engines/wage/script.cpp @@ -178,16 +178,14 @@ bool Script::execute(World *world, int loopCount, String *inputText, Designed *i delete weapons; } -/* // TODO: weapons, offer, etc... - } else if (inputClick instanceof Obj) { - Obj obj = (Obj) inputClick; - if (obj.getType() != Obj.IMMOBILE_OBJECT) { + } else if (_inputClick->_classType == OBJ) { + Obj *obj = (Obj *)_inputClick; + if (obj->_type != Obj::IMMOBILE_OBJECT) { takeObj(obj); } else { - appendText(obj.getClickMessage()); + appendText(obj->_clickMessage); } -*/ } return _handled; @@ -737,6 +735,27 @@ bool Script::evalClickCondition(Operand *lhs, const char *op, Operand *rhs) { return false; } +void Script::takeObj(Obj *obj) { + if (_world->_player->_inventory.size() >= _world->_player->_maximumCarriedObjects) { + appendText("Your pack is full, you must drop something."); + } else { + _world->move(obj, _world->_player); + int type = _world->_player->wearObjIfPossible(obj); + if (type == Chr::HEAD_ARMOR) { + appendText(String("You are now wearing the ") + obj->_name + "."); + } else if (type == Chr::BODY_ARMOR) { + appendText(String("You are now wearing the ") + obj->_name + "."); + } else if (type == Chr::SHIELD_ARMOR) { + appendText(String("You are now wearing the ") + obj->_name + "."); + } else if (type == Chr::MAGIC_ARMOR) { + appendText(String("You are now wearing the ") + obj->_name + "."); + } else { + appendText(String("You now have the ") + obj->_name + "."); + } + appendText(obj->_clickMessage); + } +} + void Script::processMove() { warning("STUB: processMove"); } |