From 3b59bf759c2dd9890caed28466674247b9f1ddb4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Oct 2020 10:52:13 +0200 Subject: [PATCH] - Blood: there's no need to store the loadsave handlers in local variables that never get used. --- source/blood/src/actor.cpp | 3 +-- source/blood/src/ai.cpp | 4 +--- source/blood/src/callback.cpp | 4 ++-- source/blood/src/endgame.cpp | 3 +-- source/blood/src/eventq.cpp | 3 +-- source/blood/src/levels.cpp | 4 +--- source/blood/src/loadsave.cpp | 7 +------ source/blood/src/messages.cpp | 4 +--- source/blood/src/mirrors.cpp | 4 +--- source/blood/src/nnexts.cpp | 4 +--- source/blood/src/player.cpp | 4 +--- source/blood/src/preload.cpp | 2 -- source/blood/src/triggers.cpp | 4 +--- source/blood/src/view.cpp | 4 +--- source/blood/src/warp.cpp | 4 +--- source/blood/src/weapon.cpp | 22 ---------------------- 16 files changed, 15 insertions(+), 65 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index b1998f992..2acc5d179 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -6948,11 +6948,10 @@ void ActorLoadSave::Save(void) Write(gPost, sizeof(gPost)); } -static ActorLoadSave *myLoadSave; void ActorLoadSaveConstruct(void) { - myLoadSave = new ActorLoadSave(); + new ActorLoadSave(); } END_BLD_NS diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index 871f5cbdc..8e322be67 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -1757,11 +1757,9 @@ void AILoadSave::Save(void) Write(gGenDudeExtra, sizeof(gGenDudeExtra)); } -static AILoadSave *myLoadSave; - void AILoadSaveConstruct(void) { - myLoadSave = new AILoadSave(); + new AILoadSave(); } END_BLD_NS diff --git a/source/blood/src/callback.cpp b/source/blood/src/callback.cpp index eaaf49c92..1e32bedc4 100644 --- a/source/blood/src/callback.cpp +++ b/source/blood/src/callback.cpp @@ -606,7 +606,7 @@ void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) // ?? } } -void DropVoodoo(int nSprite) // unused +void DropVoodooCb(int nSprite) // unused { spritetype *pSprite = &sprite[nSprite]; int nOwner = actSpriteOwnerToSpriteId(pSprite); @@ -760,7 +760,7 @@ void(*gCallback[kCallbackMax])(int) = fxPodBloodSpray, fxPodBloodSplat, LeechStateTimer, - DropVoodoo, // unused + DropVoodooCb, // unused #ifdef NOONE_EXTENSIONS callbackUniMissileBurst, // the code is in nnexts.cpp callbackMakeMissileBlocking, // the code is in nnexts.cpp diff --git a/source/blood/src/endgame.cpp b/source/blood/src/endgame.cpp index f7a7ebf29..cfcf39837 100644 --- a/source/blood/src/endgame.cpp +++ b/source/blood/src/endgame.cpp @@ -289,11 +289,10 @@ void EndGameLoadSave::Save(void) CSecretMgr gSecretMgr; CKillMgr gKillMgr; -static EndGameLoadSave* myLoadSave; void EndGameLoadSaveConstruct(void) { - myLoadSave = new EndGameLoadSave(); + new EndGameLoadSave(); } diff --git a/source/blood/src/eventq.cpp b/source/blood/src/eventq.cpp index 81c509635..6e5777c6c 100644 --- a/source/blood/src/eventq.cpp +++ b/source/blood/src/eventq.cpp @@ -609,11 +609,10 @@ void EventQLoadSave::Save() Write(bucketHead, sizeof(bucketHead)); } -static EventQLoadSave *myLoadSave; void EventQLoadSaveConstruct(void) { - myLoadSave = new EventQLoadSave(); + new EventQLoadSave(); } END_BLD_NS diff --git a/source/blood/src/levels.cpp b/source/blood/src/levels.cpp index 0e08167a6..f9080687e 100644 --- a/source/blood/src/levels.cpp +++ b/source/blood/src/levels.cpp @@ -257,8 +257,6 @@ class LevelsLoadSave : public LoadSave }; -static LevelsLoadSave *myLoadSave; - void LevelsLoadSave::Load(void) { Read(&gNextLevel, sizeof(gNextLevel)); @@ -273,7 +271,7 @@ void LevelsLoadSave::Save(void) void LevelsLoadSaveConstruct(void) { - myLoadSave = new LevelsLoadSave(); + new LevelsLoadSave(); } END_BLD_NS diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 77924749b..b289e04ae 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -736,9 +736,6 @@ void MyLoadSave::Save(void) Write(skyInfo, sizeof(*skyInfo)); } -static MyLoadSave *myLoadSave; - - void ActorLoadSaveConstruct(void); void AILoadSaveConstruct(void); void EndGameLoadSaveConstruct(void); @@ -751,14 +748,13 @@ void SeqLoadSaveConstruct(void); void TriggersLoadSaveConstruct(void); void ViewLoadSaveConstruct(void); void WarpLoadSaveConstruct(void); -void WeaponLoadSaveConstruct(void); #ifdef NOONE_EXTENSIONS void NNLoadSaveConstruct(void); #endif void LoadSaveSetup(void) { - myLoadSave = new MyLoadSave(); + new MyLoadSave(); ActorLoadSaveConstruct(); AILoadSaveConstruct(); @@ -772,7 +768,6 @@ void LoadSaveSetup(void) TriggersLoadSaveConstruct(); ViewLoadSaveConstruct(); WarpLoadSaveConstruct(); - WeaponLoadSaveConstruct(); #ifdef NOONE_EXTENSIONS NNLoadSaveConstruct(); #endif diff --git a/source/blood/src/messages.cpp b/source/blood/src/messages.cpp index b7aa16109..b42485410 100644 --- a/source/blood/src/messages.cpp +++ b/source/blood/src/messages.cpp @@ -568,11 +568,9 @@ void MessagesLoadSave::Save() Write(&bPlayerCheated, sizeof(bPlayerCheated)); } -static MessagesLoadSave *myLoadSave; - void MessagesLoadSaveConstruct(void) { - myLoadSave = new MessagesLoadSave(); + new MessagesLoadSave(); } void InitCheats() diff --git a/source/blood/src/mirrors.cpp b/source/blood/src/mirrors.cpp index 50710ed9c..773829295 100644 --- a/source/blood/src/mirrors.cpp +++ b/source/blood/src/mirrors.cpp @@ -427,8 +427,6 @@ public: void Save(void); }; -static MirrorLoadSave *myLoadSave; - void MirrorLoadSave::Load(void) { #ifdef USE_OPENGL @@ -472,7 +470,7 @@ void MirrorLoadSave::Save(void) void MirrorLoadSaveConstruct(void) { - myLoadSave = new MirrorLoadSave(); + new MirrorLoadSave(); } END_BLD_NS diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index 40176f6ca..813a37d0b 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -5284,11 +5284,9 @@ void NNLoadSave::Save(void) Write(&gEventRedirectsUsed, sizeof(gEventRedirectsUsed)); } -static NNLoadSave* myLoadSave; - void NNLoadSaveConstruct(void) { - myLoadSave = new NNLoadSave(); + new NNLoadSave(); } /////////////////////////////////////////////////////////////////// diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 6ebadac23..65cfa9696 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -2210,11 +2210,9 @@ void PlayerLoadSave::Save(void) #endif } -static PlayerLoadSave *myLoadSave; - void PlayerLoadSaveConstruct(void) { - myLoadSave = new PlayerLoadSave(); + new PlayerLoadSave(); } END_BLD_NS diff --git a/source/blood/src/preload.cpp b/source/blood/src/preload.cpp index f5fcc7790..e225a1e9d 100644 --- a/source/blood/src/preload.cpp +++ b/source/blood/src/preload.cpp @@ -33,8 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -#define gotpic blafasl - int nPrecacheCount; void fxPrecache(HitList &hits); diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 734e7ef47..638ae3926 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -2309,11 +2309,9 @@ void TriggersLoadSave::Save() Write(basePath, sizeof(basePath)); } -static TriggersLoadSave *myLoadSave; - void TriggersLoadSaveConstruct(void) { - myLoadSave = new TriggersLoadSave(); + new TriggersLoadSave(); } END_BLD_NS diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index e60f0736d..a53974824 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -1064,8 +1064,6 @@ public: void Save(void); }; -static ViewLoadSave *myLoadSave; - static int messageTime; static char message[256]; @@ -1095,7 +1093,7 @@ void ViewLoadSave::Save(void) void ViewLoadSaveConstruct(void) { - myLoadSave = new ViewLoadSave(); + new ViewLoadSave(); } END_BLD_NS diff --git a/source/blood/src/warp.cpp b/source/blood/src/warp.cpp index 87fbf2ad9..609b2365d 100644 --- a/source/blood/src/warp.cpp +++ b/source/blood/src/warp.cpp @@ -323,11 +323,9 @@ void WarpLoadSave::Save() Write(gLowerLink, sizeof(gLowerLink)); } -static WarpLoadSave *myLoadSave; - void WarpLoadSaveConstruct(void) { - myLoadSave = new WarpLoadSave(); + new WarpLoadSave(); } END_BLD_NS diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 0daf7ca11..935728370 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -2545,26 +2545,4 @@ void sub_51340(spritetype *pMissile, int a2) } } -class WeaponLoadSave : public LoadSave -{ -public: - virtual void Load(); - virtual void Save(); -}; - -void WeaponLoadSave::Load() -{ -} - -void WeaponLoadSave::Save() -{ -} - -static WeaponLoadSave *myLoadSave; - -void WeaponLoadSaveConstruct(void) -{ - myLoadSave = new WeaponLoadSave(); -} - END_BLD_NS