From 4f948b3309225dfdda5f78ddffa684decdccb1f4 Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 4 Nov 2011 21:31:57 +0100 Subject: KYRA: replace invalid memset call and add a warning --- engines/kyra/lol.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index bba21bb5da..182b734e11 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -896,7 +896,7 @@ void LoLEngine::startupNew() { _availableSpells[0] = 0; setupScreenDims(); - memset(_globalScriptVars2, 0x100, 8); + Common::set_to(_globalScriptVars2, ARRAYEND(_globalScriptVars2), 0x100); static const int selectIds[] = { -9, -1, -8, -5 }; assert(_charSelection >= 0); @@ -993,6 +993,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"); -- cgit v1.2.3