From 519f52a6351e2d7053a421d29fbf89b20e3f3f86 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 12 Feb 2018 21:20:45 -0500 Subject: XEEN: Fix Valgrind reported issues --- engines/xeen/combat.cpp | 3 ++- engines/xeen/map.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 8afe48da15..e7502d6437 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -467,7 +467,8 @@ void Combat::moveMonsters() { for (uint idx = 0; idx < map._mobData._monsters.size(); ++idx) { MazeMonster &monster = map._mobData._monsters[idx]; - if (monster._position.y < 32) { + if ((uint)monster._position.y < 32) { + assert((uint)monster._position.x < 32); _monsterMap[monster._position.y][monster._position.x]++; } } diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index aab806ff98..f3c00dd96d 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -112,6 +112,7 @@ MonsterStruct::MonsterStruct(Common::String name, int experience, int hp, int ar void MonsterStruct::synchronize(Common::SeekableReadStream &s) { char name[16]; + Common::fill(name, name + 16, '\0'); s.read(name, 16); name[15] = '\0'; _name = Common::String(name); @@ -147,6 +148,7 @@ void MonsterStruct::synchronize(Common::SeekableReadStream &s) { _fx = s.readByte(); char attackVoc[10]; + Common::fill(attackVoc, attackVoc + 10, '\0'); s.read(attackVoc, 9); attackVoc[9] = '\0'; _attackVoc = Common::String(attackVoc); -- cgit v1.2.3