From 117733ad0abd673261381dc72bb5415708be9290 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 14 Sep 2019 00:07:47 +0100 Subject: HDB: Fix More GCC Compiler Warnings --- engines/hdb/ai-inventory.cpp | 2 +- engines/hdb/ai-waypoint.cpp | 4 +++- engines/hdb/ai.h | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 272d41dc89..3c8d2c2b55 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -303,7 +303,7 @@ bool AI::completeDelivery(const char *id) { for (int i = 0; i < _numDeliveries; i++) { if (!scumm_stricmp(_deliveries[i].id, id)) { for (; i < _numDeliveries; i++) - memcpy(&_deliveries[i], &_deliveries[i + 1], sizeof(_deliveries[0])); + _deliveries[i] = _deliveries[i + 1]; _numDeliveries--; if (g_hdb->isPPC()) g_hdb->_sound->playSound(SND_QUEST_COMPLETE); diff --git a/engines/hdb/ai-waypoint.cpp b/engines/hdb/ai-waypoint.cpp index 702e41b243..a10b70d483 100644 --- a/engines/hdb/ai-waypoint.cpp +++ b/engines/hdb/ai-waypoint.cpp @@ -246,7 +246,9 @@ void AI::removeFirstWaypoint() { } void AI::clearWaypoints() { - memset(&_waypoints[0], 0, sizeof(_waypoints)); + for (uint8 i = 0; i < ARRAYSIZE(_waypoints); i++) { + _waypoints[i].reset(); + } _numWaypoints = 0; } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 37fc7efb3c..600fcaf5c6 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -644,7 +644,15 @@ struct DlvEnt { struct Waypoint { int x, y, level; - Waypoint() : x(0), y(0), level(0) {} + void reset() { + x = 0; + y = 0; + level = 0; + } + + Waypoint() { + reset(); + } }; struct LuaT { -- cgit v1.2.3