[Scummvm-git-logs] scummvm master -> 22766a339f6c19c901d4dec609dcd4db34309f02
digitall
547637+digitall at users.noreply.github.com
Tue Jul 20 08:43:28 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:
22766a339f HDB: Reduce GCC Compiler Warnings
Commit: 22766a339f6c19c901d4dec609dcd4db34309f02
https://github.com/scummvm/scummvm/commit/22766a339f6c19c901d4dec609dcd4db34309f02
Author: D G Turner (digitall at scummvm.org)
Date: 2021-07-20T09:40:16+01:00
Commit Message:
HDB: Reduce GCC Compiler Warnings
These warnings occur from -Wcast-function-type due to the casting between
FuncPtr and EntFuncPtr. This change reduces the number of these required,
but further work will be needed to remove this fully without causing a
regression in game function.
Changed paths:
engines/hdb/ai-init.cpp
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp
index 09640c231f..9600dd51cc 100644
--- a/engines/hdb/ai-init.cpp
+++ b/engines/hdb/ai-init.cpp
@@ -677,16 +677,13 @@ AIEntTypeInfo aiEntList[] = {
{ END_AI_TYPES, nullptr, nullptr, nullptr, nullptr }
};
-struct FuncLookUp {
+struct {
FuncPtr function;
const char *funcName;
-};
-
-FuncLookUp aiFuncList[] = {
+} aiFuncList[] = {
{aiPlayerInit, "aiPlayerInit"},
{aiPlayerInit2, "aiPlayerInit2"},
{aiPlayerAction, "aiPlayerAction"},
- {(FuncPtr)aiPlayerDraw, "aiPlayerDraw"},
{aiGemAttackInit, "aiGemAttackInit"},
{aiGemAttackAction, "aiGemAttackAction"},
{aiDollyInit, "aiDollyInit"},
@@ -765,14 +762,12 @@ FuncLookUp aiFuncList[] = {
{aiShockBotInit, "aiShockBotInit"},
{aiShockBotInit2, "aiShockBotInit2"},
{aiShockBotAction, "aiShockBotAction"},
- {(FuncPtr)aiShockBotShock, "aiShockBotShock"},
{aiOmniBotMissileInit, "aiOmniBotMissileInit"},
{aiOmniBotMissileInit2, "aiOmniBotMissileInit2"},
{aiOmniBotMissileAction, "aiOmniBotMissileAction"},
{aiSlugAttackInit, "aiSlugAttackInit"},
{aiSlugAttackInit2, "aiSlugAttackInit2"},
{aiSlugAttackAction, "aiSlugAttackAction"},
- {(FuncPtr)aiSlugAttackDraw, "aiSlugAttackDraw"},
{aiDeadWorkerInit, "aiDeadWorkerInit"},
{aiDeadWorkerInit2, "aiDeadWorkerInit2"},
{aiWorkerInit, "aiWorkerInit"},
@@ -800,13 +795,11 @@ FuncLookUp aiFuncList[] = {
{aiOmniBotAction, "aiOmniBotAction"},
{aiOmniBotMove, "aiOmniBotMove"},
{aiLaserAction, "aiLaserAction"},
- {(FuncPtr)aiLaserDraw, "aiLaserDraw"},
{aiLaserInit, "aiLaserInit"},
{aiLaserInit2, "aiLaserInit2"},
{aiDiverterInit, "aiDiverterInit"},
{aiDiverterInit2, "aiDiverterInit2"},
{aiDiverterAction, "aiDiverterAction"},
- {(FuncPtr)aiDiverterDraw, "aiDiverterDraw"},
{aiRightBotInit, "aiRightBotInit"},
{aiRightBotInit2, "aiRightBotInit2"},
{aiRightBotAction, "aiRightBotAction"},
@@ -820,12 +813,10 @@ FuncLookUp aiFuncList[] = {
{aiMeerkatLookAround, "aiMeerkatLookAround" },
{aiMeerkatInit, "aiMeerkatInit"},
{aiMeerkatInit2, "aiMeerkatInit2"},
- {(FuncPtr)aiMeerkatDraw, "aiMeerkatDraw"},
{aiMeerkatAction, "aiMeerkatAction"},
{aiFatFrogInit, "aiFatFrogInit"},
{aiFatFrogInit2, "aiFatFrogInit2"},
{aiFatFrogAction, "aiFatFrogAction"},
- {(FuncPtr)aiFatFrogTongueDraw, "aiFatFrogTongueDraw"},
{aiGoodFairyInit, "aiGoodFairyInit"},
{aiGoodFairyInit2, "aiGoodFairyInit2"},
{aiGoodFairyAction, "aiGoodFairyAction"},
@@ -836,7 +827,6 @@ FuncLookUp aiFuncList[] = {
{aiGatePuddleInit2, "aiGatePuddleInit2"},
{aiGatePuddleAction, "aiGatePuddleAction"},
{aiIcePuffSnowballAction, "aiIcePuffSnowballAction" },
- {(FuncPtr)aiIcePuffSnowballDraw, "aiIcePuffSnowballDraw"},
{aiIcePuffInit, "aiIcePuffInit"},
{aiIcePuffInit2, "aiIcePuffInit2"},
{aiIcePuffAction, "aiIcePuffAction"},
@@ -848,7 +838,6 @@ FuncLookUp aiFuncList[] = {
{aiDragonAction, "aiDragonAction"},
{aiDragonUse, "aiDragonUse" },
{aiDragonWake, "aiDragonWake"},
- {(FuncPtr)aiDragonDraw, "aiDragonDraw"},
{aiEnvelopeGreenInit, "aiEnvelopeGreenInit"},
{aiEnvelopeGreenInit2, "aiEnvelopeGreenInit2"},
{aiGemBlueInit, "aiGemBlueInit"},
@@ -909,6 +898,22 @@ FuncLookUp aiFuncList[] = {
{nullptr, nullptr}
};
+struct {
+ EntFuncPtr function;
+ const char *funcName;
+} aiEntFuncList[] = {
+ {aiPlayerDraw, "aiPlayerDraw"},
+ {aiShockBotShock, "aiShockBotShock"},
+ {aiSlugAttackDraw, "aiSlugAttackDraw"},
+ {aiLaserDraw, "aiLaserDraw"},
+ {aiDiverterDraw, "aiDiverterDraw"},
+ {aiMeerkatDraw, "aiMeerkatDraw"},
+ {aiFatFrogTongueDraw, "aiFatFrogTongueDraw"},
+ {aiIcePuffSnowballDraw, "aiIcePuffSnowballDraw"},
+ {aiDragonDraw, "aiDragonDraw"},
+ {nullptr, nullptr}
+};
+
AI::AI() {
_ents = new Common::Array<AIEntity *>;
_floats = new Common::Array<AIEntity *>;
@@ -1261,6 +1266,12 @@ const char *AI::funcLookUp(FuncPtr function) {
return aiFuncList[i].funcName;
i++;
}
+ i = 0;
+ while (aiEntFuncList[i].funcName) {
+ if ((FuncPtr)aiEntFuncList[i].function == function)
+ return aiEntFuncList[i].funcName;
+ i++;
+ }
return nullptr;
}
@@ -1274,6 +1285,12 @@ FuncPtr AI::funcLookUp(const char *function) {
return aiFuncList[i].function;
i++;
}
+ i = 0;
+ while (aiEntFuncList[i].funcName) {
+ if (!scumm_stricmp(aiEntFuncList[i].funcName, function))
+ return (FuncPtr)aiEntFuncList[i].function;
+ i++;
+ }
return nullptr;
}
More information about the Scummvm-git-logs
mailing list