[Scummvm-git-logs] scummvm master -> 04409da6de128779d21f4d60a4b954c6e7600718

digitall 547637+digitall at users.noreply.github.com
Tue Jul 20 06:34:06 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:
04409da6de HDB: Minor Improvements for Code Readability


Commit: 04409da6de128779d21f4d60a4b954c6e7600718
    https://github.com/scummvm/scummvm/commit/04409da6de128779d21f4d60a4b954c6e7600718
Author: D G Turner (digitall at scummvm.org)
Date: 2021-07-20T07:33:19+01:00

Commit Message:
HDB: Minor Improvements for Code Readability

No functional change.

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 3b929b1414..09640c231f 100644
--- a/engines/hdb/ai-init.cpp
+++ b/engines/hdb/ai-init.cpp
@@ -677,6 +677,11 @@ AIEntTypeInfo aiEntList[] = {
 	{ END_AI_TYPES,			nullptr,					nullptr,					nullptr,					nullptr }
 };
 
+struct FuncLookUp {
+	FuncPtr function;
+	const char *funcName;
+};
+
 FuncLookUp aiFuncList[] = {
 	{aiPlayerInit,				"aiPlayerInit"},
 	{aiPlayerInit2,				"aiPlayerInit2"},
@@ -1246,7 +1251,7 @@ void AI::clearPersistent() {
 	_numGems = _numGooCups = _numMonkeystones = _numInventory = _numDeliveries = 0;
 }
 
-const char *AI::funcLookUp(void(*function)(AIEntity *e)) {
+const char *AI::funcLookUp(FuncPtr function) {
 	if (!function)
 		return nullptr;
 
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index e05ad295ae..f0960e8bdd 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -383,6 +383,10 @@ struct AIStateDef {
 	const char *name;
 };
 
+// Structs for Function Table Lookup for SaveGames
+typedef void(*FuncPtr)(AIEntity *);
+typedef void(*EntFuncPtr)(AIEntity *, int, int);
+
 struct AIEntity {
 	AIType type;
 	AIState state;
@@ -390,11 +394,11 @@ struct AIEntity {
 
 	Tile *draw;											// Current frame to draw
 
-	void (*aiInit)(AIEntity *e);						// func ptr to init routine
-	void (*aiInit2)(AIEntity *e);						// func ptr to init2 routine - graphic init only (this for LoadGame functionality)
-	void (*aiAction)(AIEntity *e);						// func ptr to action routine
-	void (*aiUse)(AIEntity *e);							// func ptr to use routine
-	void (*aiDraw)(AIEntity *e, int x, int y);			// func ptr to extra drawing routine (only for special stuff) - pass in mapx, mapy
+	FuncPtr aiInit;										// func ptr to init routine
+	FuncPtr aiInit2;									// func ptr to init2 routine - graphic init only (this for LoadGame functionality)
+	FuncPtr aiAction;									// func ptr to action routine
+	FuncPtr aiUse;										// func ptr to use routine
+	EntFuncPtr aiDraw;									// func ptr to extra drawing routine (only for special stuff) - pass in mapx, mapy
 
 	char		luaFuncInit[32];						// Lua function for Init (always called after entity's init). These are ptrs into the map header.
 	char		luaFuncAction[32];						// Lua function for Action
@@ -555,32 +559,22 @@ struct AIEntity {
 	void load(Common::InSaveFile *in);
 };
 
-// Structs for Function Table Lookup for SaveGames
-typedef void(*FuncPtr)(AIEntity *);
-typedef void(*EntFuncPtr)(AIEntity *, int, int);
-
 struct AIEntTypeInfo {
 	AIType type;
 	const char *luaName;
 	AIStateDef *stateDef;
-	void (*initFunc)(AIEntity *e);
-	void (*initFunc2)(AIEntity *e);
-};
-
-struct FuncLookUp {
-	void(*function)(AIEntity *e);
-	const char *funcName;
+	FuncPtr initFunc;
+	FuncPtr initFunc2;
 };
 
 extern AIEntTypeInfo aiEntList[];
-extern FuncLookUp aiFuncList[];
 
 struct AIEntLevel2 {
 	uint16 x;
 	uint16 y;
 	Tile *draw;
 	AIEntity *e;
-	void(*aiDraw)(AIEntity *e, int x, int y);
+	EntFuncPtr aiDraw;
 	uint32 stunnedWait;
 
 	AIEntLevel2() : x(0), y(0), draw(nullptr), e(nullptr), aiDraw(nullptr), stunnedWait(0) {}
@@ -885,7 +879,7 @@ public:
 	void init();
 	void clearPersistent();
 	void restartSystem();
-	const char *funcLookUp(void(*function)(AIEntity *e));
+	const char *funcLookUp(FuncPtr function);
 	FuncPtr funcLookUp(const char *function);
 	void save(Common::OutSaveFile *out);
 	void loadSaveFile(Common::InSaveFile *in);




More information about the Scummvm-git-logs mailing list