aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorD G Turner2019-09-13 22:41:41 +0100
committerD G Turner2019-09-13 22:41:41 +0100
commitc01598484e3ad00b231e54a430db224cefc65da0 (patch)
treeaaf27bb632cb5822f026a411608faa15e4b6a97c /engines/hdb
parent1a3d24f220e215f806080309876982eb805da12b (diff)
downloadscummvm-rg350-c01598484e3ad00b231e54a430db224cefc65da0.tar.gz
scummvm-rg350-c01598484e3ad00b231e54a430db224cefc65da0.tar.bz2
scummvm-rg350-c01598484e3ad00b231e54a430db224cefc65da0.zip
HDB: Fix Some GCC Compiler Warnings
These were of the type memset of a complex structure.
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/ai-inventory.cpp18
-rw-r--r--engines/hdb/ai.h16
2 files changed, 22 insertions, 12 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp
index cc1a28162c..272d41dc89 100644
--- a/engines/hdb/ai-inventory.cpp
+++ b/engines/hdb/ai-inventory.cpp
@@ -92,13 +92,11 @@ void AI::clearInventory() {
int keepslot = 0;
for (int i = 0; i < _numInventory; i++) {
if (!_inventory[i].keep) {
- memset(&_inventory[i], 0, sizeof(InvEnt));
+ _inventory[i].reset();
} else {
if (i != keepslot) {
_inventory[keepslot] = _inventory[i];
- _inventory[keepslot].ent = _inventory[i].ent;
- _inventory[keepslot].keep = _inventory[i].keep;
- memset(&_inventory[i], 0, sizeof(InvEnt));
+ _inventory[i].reset();
}
keepslot++;
}
@@ -154,10 +152,10 @@ bool AI::removeInvItem(const char *string, int amount) {
for (int i = _numInventory - 1; i >= 0; i--)
if (strstr(_inventory[i].ent.entityName, string)) {
int j = i;
- memset(&_inventory[j], 0, sizeof(InvEnt));
+ _inventory[j].reset();
while (j < _numInventory - 1) {
- memcpy(&_inventory[j], &_inventory[j + 1], sizeof(InvEnt));
- memset(&_inventory[j + 1], 0, sizeof(InvEnt));
+ _inventory[j] = _inventory[j + 1];
+ _inventory[j + 1].reset();
j++;
}
_numInventory--;
@@ -228,10 +226,10 @@ bool AI::removeInvItemType(AIType which, int amount) {
for (int i = 0; i < _numInventory; i++) {
if (_inventory[i].ent.type == which) {
int j = i;
- memset(&_inventory[j], 0, sizeof(InvEnt));
+ _inventory[j].reset();
while (j < _numInventory - 1) {
- memcpy(&_inventory[j], &_inventory[j + 1], sizeof(InvEnt));
- memset(&_inventory[j + 1], 0, sizeof(InvEnt));
+ _inventory[j] = _inventory[j + 1];
+ _inventory[j + 1].reset();
j++;
}
_numInventory--;
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index 572ab79186..86c3709aeb 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -456,7 +456,7 @@ struct AIEntity {
int16 moverightFrames;
Tile *moverightGfx[kMaxAnimFrames];
- AIEntity() {
+ void reset() {
luaFuncInit[0] = 0;
luaFuncAction[0] = 0;
luaFuncUse[0] = 0;
@@ -543,6 +543,11 @@ struct AIEntity {
moverightGfx[i] = NULL;
}
}
+
+ AIEntity() {
+ reset();
+ }
+
~AIEntity() {
}
@@ -602,7 +607,14 @@ struct InvEnt {
uint16 keep;
AIEntity ent;
- InvEnt() : keep(0) {}
+ void reset() {
+ keep = 0;
+ ent.reset();
+ }
+
+ InvEnt() {
+ reset();
+ }
};
struct DlvEnt {