[Scummvm-git-logs] scummvm master -> 143cebf508e3035653f52a3c401279dee2c03c08
digitall
547637+digitall at users.noreply.github.com
Tue Mar 23 03:08:20 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
143cebf508 HDB: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Commit: 143cebf508e3035653f52a3c401279dee2c03c08
https://github.com/scummvm/scummvm/commit/143cebf508e3035653f52a3c401279dee2c03c08
Author: D G Turner (digitall at scummvm.org)
Date: 2021-03-23T03:07:56Z
Commit Message:
HDB: Fix Memset on Non-Trivial Structure GCC Compiler Warnings
Changed paths:
engines/hdb/ai-init.cpp
engines/hdb/ai.h
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp
index 4867db318a..3b929b1414 100644
--- a/engines/hdb/ai-init.cpp
+++ b/engines/hdb/ai-init.cpp
@@ -1277,17 +1277,25 @@ void AI::restartSystem() {
_player = nullptr;
// Clear the Action list
- memset(_actions, 0, sizeof(_actions));
+ for (uint i = 0; i < ARRAYSIZE(_actions); i++) {
+ _actions[i].clear();
+ }
// Clear Teleporter list
- memset(_teleporters, 0, sizeof(_teleporters));
+ for (uint i = 0; i < ARRAYSIZE(_teleporters); i++) {
+ _teleporters[i].clear();
+ }
_numTeleporters = 0;
// Clear the Auto-Action list
- memset(_autoActions, 0, sizeof(_autoActions));
+ for (uint i = 0; i < ARRAYSIZE(_autoActions); i++) {
+ _autoActions[i].clear();
+ }
// Clear the Callback List
- memset(_callbacks, 0, sizeof(_callbacks));
+ for (uint i = 0; i < ARRAYSIZE(_callbacks); i++) {
+ _callbacks[i].clear();
+ }
// Clear the Entity List
_ents->clear();
@@ -1296,7 +1304,9 @@ void AI::restartSystem() {
_floats->clear();
// Clear the Lua List
- memset(_luaList, 0, sizeof(_luaList));
+ for (uint i = 0; i < ARRAYSIZE(_luaList); i++) {
+ _luaList[i].clear();
+ }
_numLuaList = 0;
// Clear Anim Targets List
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index f383591a87..e05ad295ae 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -662,10 +662,18 @@ struct LuaT {
char luaFuncAction[32];
char luaFuncUse[32];
- LuaT() : x(0), y(0), value1(0), value2(0) {
- luaFuncInit[0] = 0;
- luaFuncAction[0] = 0;
- luaFuncUse[0] = 0;
+ LuaT() {
+ clear();
+ }
+
+ void clear() {
+ x = 0;
+ y = 0;
+ value1 = 0;
+ value2 = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncInit); i++) luaFuncInit[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncAction); i++) luaFuncAction[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncUse); i++) luaFuncUse[i] = 0;
}
};
@@ -676,10 +684,18 @@ struct ActionInfo {
char luaFuncUse[32];
char entityName[32];
- ActionInfo() : x1(0), y1(0), x2(0), y2(0) {
- luaFuncInit[0] = 0;
- luaFuncUse[0] = 0;
- entityName[0] = 0;
+ ActionInfo() {
+ clear();
+ }
+
+ void clear() {
+ x1 = 0;
+ y1 = 0;
+ x2 = 0;
+ y2 = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncInit); i++) luaFuncInit[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncUse); i++) luaFuncUse[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(entityName); i++) entityName[i] = 0;
}
};
@@ -694,9 +710,25 @@ struct TeleInfo {
char luaFuncUse1[32];
char luaFuncUse2[32];
- TeleInfo() : x1(0), y1(0), x2(0), y2(0), dir1(DIR_NONE), dir2(DIR_NONE), level1(0), level2(0), usable1(0), usable2(0), anim1(0), anim2(0) {
- luaFuncUse1[0] = 0;
- luaFuncUse2[0] = 0;
+ TeleInfo() {
+ clear();
+ }
+
+ void clear() {
+ x1 = 0;
+ y1 = 0;
+ x2 = 0;
+ y2 = 0;
+ dir1 = DIR_NONE;
+ dir2 = DIR_NONE;
+ level1 = 0;
+ level2 = 0;
+ usable1 = 0;
+ usable2 = 0;
+ anim1 = 0;
+ anim2 = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncUse1); i++) luaFuncUse1[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncUse2); i++) luaFuncUse2[i] = 0;
}
};
@@ -714,10 +746,17 @@ struct AutoAction {
char luaFuncUse[32];
char entityName[32];
- AutoAction() : x(0), y(0), activated(false) {
- luaFuncInit[0] = 0;
- luaFuncUse[0] = 0;
- entityName[0] = 0;
+ AutoAction() {
+ clear();
+ }
+
+ void clear() {
+ x = 0;
+ y = 0;
+ activated = false;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncInit); i++) luaFuncInit[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(luaFuncUse); i++) luaFuncUse[i] = 0;
+ for (uint i = 0; i < ARRAYSIZE(entityName); i++) entityName[i] = 0;
}
};
@@ -758,7 +797,16 @@ struct Callback {
uint16 x, y;
uint16 delay;
- Callback() : type(NO_FUNCTION), x(0), y(0), delay(0) {}
+ Callback() {
+ clear();
+ }
+
+ void clear() {
+ type = NO_FUNCTION;
+ x = 0;
+ y = 0;
+ delay = 0;
+ }
};
struct Fairystone {
More information about the Scummvm-git-logs
mailing list