aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/lol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/lol.cpp')
-rw-r--r--engines/kyra/lol.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index f64e4f85f2..aed8f5c965 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -963,7 +963,7 @@ void LoLEngine::startupNew() {
_availableSpells[0] = 0;
setupScreenDims();
- memset(_globalScriptVars2, 0x100, 8);
+ Common::fill(_globalScriptVars2, ARRAYEND(_globalScriptVars2), 0x100);
static const int selectIds[] = { -9, -1, -8, -5 };
assert(_charSelection >= 0);
@@ -1060,6 +1060,10 @@ void LoLEngine::writeSettings() {
void LoLEngine::readSettings() {
_monsterDifficulty = ConfMan.getInt("monster_difficulty");
+ if (_monsterDifficulty < 0 || _monsterDifficulty > 2) {
+ _monsterDifficulty = CLIP(_monsterDifficulty, 0, 2);
+ warning("LoLEngine: Config file contains invalid difficulty setting.");
+ }
_smoothScrollingEnabled = ConfMan.getBool("smooth_scrolling");
_floatingCursorsEnabled = ConfMan.getBool("floating_cursors");
@@ -1989,8 +1993,7 @@ int LoLEngine::playCharacterScriptChat(int charId, int mode, int restorePortrait
stopPortraitSpeechAnim();
if (charId < 0) {
- charId = ch = (_rnd.getRandomNumber(0x7fff) * countActiveCharacters()) / 0x8000;
- ch = _rnd.getRandomNumber(countActiveCharacters() - 1);
+ charId = ch = _rnd.getRandomNumber(countActiveCharacters() - 1);
} else if (charId > 0) {
int i = 0;