mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
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.
This commit is contained in:
+30
-13
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user