aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-02-12 21:20:45 -0500
committerPaul Gilbert2018-02-12 21:20:45 -0500
commit519f52a6351e2d7053a421d29fbf89b20e3f3f86 (patch)
tree672aa6528744b656acd2fa6332d90858b51bf876
parent8559be1598066a822d20e6ebaab87a5765d402e0 (diff)
downloadscummvm-rg350-519f52a6351e2d7053a421d29fbf89b20e3f3f86.tar.gz
scummvm-rg350-519f52a6351e2d7053a421d29fbf89b20e3f3f86.tar.bz2
scummvm-rg350-519f52a6351e2d7053a421d29fbf89b20e3f3f86.zip
XEEN: Fix Valgrind reported issues
-rw-r--r--engines/xeen/combat.cpp3
-rw-r--r--engines/xeen/map.cpp2
2 files changed, 4 insertions, 1 deletions
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);