aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-25 19:49:41 +0100
committerEugene Sandulenko2016-02-14 17:12:53 +0100
commitb5d55fdf2b171ef6ff8f56d49b9f350283fde242 (patch)
tree3c565ff1ab851668a396821a97f9c5498c13e5d4 /engines/wage
parentadc5b87cb6e52f7fa22d8395020121249718e5e4 (diff)
downloadscummvm-rg350-b5d55fdf2b171ef6ff8f56d49b9f350283fde242.tar.gz
scummvm-rg350-b5d55fdf2b171ef6ff8f56d49b9f350283fde242.tar.bz2
scummvm-rg350-b5d55fdf2b171ef6ff8f56d49b9f350283fde242.zip
WAGE: Implement decrementUses()
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/combat.cpp18
-rw-r--r--engines/wage/entities.cpp4
-rw-r--r--engines/wage/entities.h7
3 files changed, 23 insertions, 6 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp
index 2f87119fe3..4a043311b8 100644
--- a/engines/wage/combat.cpp
+++ b/engines/wage/combat.cpp
@@ -232,7 +232,23 @@ void WageEngine::performAttack(Chr *attacker, Chr *victim, Obj *weapon) {
}
void WageEngine::decrementUses(Obj *obj) {
- warning("STUB: decrementUses()");
+ int numberOfUses = obj->_numberOfUses;
+ if (numberOfUses != -1) {
+ numberOfUses--;
+ if (numberOfUses > 0) {
+ obj->_numberOfUses = numberOfUses;
+ } else {
+ if (!obj->_failureMessage.empty()) {
+ appendText(obj->_failureMessage.c_str());
+ }
+ if (obj->_returnToRandomScene) {
+ _world->move(obj, _world->getRandomScene());
+ } else {
+ _world->move(obj, _world->_storageScene);
+ }
+ obj->resetState(obj->_currentOwner, obj->_currentScene);
+ }
+ }
}
bool WageEngine::attackHit(Chr *attacker, Chr *victim, Obj *weapon, int targetIndex) {
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 747d4861d4..5149fb3d3c 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -281,6 +281,10 @@ Designed *Obj::removeFromCharOrScene() {
return from;
}
+void Obj::resetState(Chr *owner, Scene *scene) {
+ warning("STUB: Obj::resetState()");
+}
+
Chr::Chr(String name, Common::SeekableReadStream *data) {
_name = name;
_classType = CHR;
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 58cc82a894..aaaaee5928 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -288,13 +288,10 @@ public:
_currentOwner = NULL;
}
- void decrementNumberOfUses() {
- if (_numberOfUses != -1)
- _numberOfUses--;
- }
-
Chr *removeFromChr();
Designed *removeFromCharOrScene();
+
+ void resetState(Chr *owner, Scene *scene);
};
class Scene : public Designed {