aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/character.cpp5
-rw-r--r--engines/xeen/dialogs/dialogs_char_info.cpp6
2 files changed, 6 insertions, 5 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index afc013ba89..47ef0b8ecd 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -418,8 +418,9 @@ int Character::statColor(int amount, int threshold) {
int Character::statBonus(uint statValue) const {
int idx;
- for (idx = 0; Res.STAT_VALUES[idx] <= (int)statValue; ++idx)
- ;
+ for (idx = 0; idx < ARRAYSIZE(Res.STAT_VALUES) - 1; ++idx)
+ if (Res.STAT_VALUES[idx] > (int)statValue)
+ break;
return Res.STAT_BONUSES[idx];
}
diff --git a/engines/xeen/dialogs/dialogs_char_info.cpp b/engines/xeen/dialogs/dialogs_char_info.cpp
index aec8be5ee4..3923caf172 100644
--- a/engines/xeen/dialogs/dialogs_char_info.cpp
+++ b/engines/xeen/dialogs/dialogs_char_info.cpp
@@ -359,9 +359,9 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
// Basic attributes
stat1 = c.getStat((Attribute)attrib, false);
stat2 = c.getStat((Attribute)attrib, true);
- idx = 0;
- while (Res.STAT_VALUES[idx] <= (int)stat1)
- ++idx;
+ for (idx = 0; idx < ARRAYSIZE(Res.STAT_VALUES) - 1; ++idx)
+ if (Res.STAT_VALUES[idx] > (int)stat1)
+ break;
msg = Common::String::format(Res.CURRENT_MAXIMUM_RATING_TEXT, Res.STAT_NAMES[attrib],
stat1, stat2, Res.RATING_TEXT[idx]);