aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/actor.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-07-29 13:56:47 +0300
committerThanasis Antoniou2019-07-29 13:57:56 +0300
commitc8a23cc401ecef6deac468766aba185bf8633db7 (patch)
tree162b16146345b5d650be0e8c272122f0b3097991 /engines/bladerunner/actor.cpp
parent70126b9685912bbce290511210ab6bcccd40bcd3 (diff)
downloadscummvm-rg350-c8a23cc401ecef6deac468766aba185bf8633db7.tar.gz
scummvm-rg350-c8a23cc401ecef6deac468766aba185bf8633db7.tar.bz2
scummvm-rg350-c8a23cc401ecef6deac468766aba185bf8633db7.zip
BLADERUNNER: Fix unsorted args for getRandomNumberRng
Fix for bug #11034
Diffstat (limited to 'engines/bladerunner/actor.cpp')
-rw-r--r--engines/bladerunner/actor.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index e52cebf2b7..4f91218a50 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -976,7 +976,7 @@ void Actor::modifyFriendlinessToOther(int otherActorId, signed int change) {
}
void Actor::setFriendlinessToOther(int otherActorId, int friendliness) {
- _friendlinessToOther[otherActorId] = friendliness;
+ _friendlinessToOther[otherActorId] = CLIP(friendliness, 0, 100);
}
bool Actor::checkFriendlinessAndHonesty(int otherActorId) {
@@ -995,19 +995,19 @@ bool Actor::checkFriendlinessAndHonesty(int otherActorId) {
}
void Actor::setHonesty(int honesty) {
- _honesty = honesty;
+ _honesty = CLIP(honesty, 0, 100);
}
void Actor::setIntelligence(int intelligence) {
- _intelligence = intelligence;
+ _intelligence = CLIP(intelligence, 0, 100);
}
void Actor::setStability(int stability) {
- _stability = stability;
+ _stability = CLIP(stability, 0, 100);
}
void Actor::setCombatAggressiveness(int combatAggressiveness) {
- _combatAggressiveness = combatAggressiveness;
+ _combatAggressiveness = CLIP(combatAggressiveness, 0, 100);
}
void Actor::setInvisible(bool isInvisible) {
@@ -1064,15 +1064,18 @@ void Actor::setTarget(bool target) {
}
void Actor::setCurrentHP(int hp) {
- _currentHP = hp;
+ _currentHP = CLIP(hp, 0, 100);
if (hp > 0) {
retire(false, 0, 0, -1);
}
}
void Actor::setHealth(int hp, int maxHp) {
- _currentHP = hp;
- _maxHP = maxHp;
+ if (hp > maxHp) {
+ hp = maxHp;
+ }
+ _currentHP = CLIP(hp, 0, 100);
+ _maxHP = CLIP(maxHp, 0, 100);
if (hp > 0) {
retire(false, 0, 0, -1);
}