From 41e576bbb503505981fa7291979ecc3536b1eec4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 28 Jan 2019 03:02:25 +0100 Subject: [PATCH] - removed the intermediate P_SpawnPlayer inline --- src/g_game.cpp | 6 +++--- src/g_level.cpp | 2 +- src/g_levellocals.h | 8 +------- src/p_mobj.cpp | 2 +- src/p_saveg.cpp | 2 +- src/p_setup.cpp | 2 +- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 9cf44bf9c..b6c4cd4ad 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1503,7 +1503,7 @@ void FLevelLocals::DeathMatchSpawnPlayer (int playernum) } } } - AActor *mo = P_SpawnPlayer(spot, playernum); + AActor *mo = SpawnPlayer(spot, playernum); if (mo != NULL) P_PlayerStartStomp(mo); } @@ -1649,13 +1649,13 @@ void FLevelLocals::DoReborn (int playernum, bool freshbot) playerstarts[playernum].type != 0 && CheckSpot (playernum, &playerstarts[playernum])) { - AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum); + AActor *mo = SpawnPlayer(&playerstarts[playernum], playernum); if (mo != NULL) P_PlayerStartStomp(mo, true); } else { // try to spawn at any random player's spot FPlayerStart *start = PickPlayerStart(playernum, PPS_FORCERANDOM); - AActor *mo = P_SpawnPlayer(start, playernum); + AActor *mo = SpawnPlayer(start, playernum); if (mo != NULL) P_PlayerStartStomp(mo, true); } } diff --git a/src/g_level.cpp b/src/g_level.cpp index 37c1bbc22..5cc253a6d 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1379,7 +1379,7 @@ int G_FinishTravel () // The player being spawned here is a short lived dummy and // must not start any ENTER script or big problems will happen. - pawndup = P_SpawnPlayer(start, pnum, SPF_TEMPPLAYER); + pawndup = level.SpawnPlayer(start, pnum, SPF_TEMPPLAYER); if (pawndup != NULL) { if (!(changeflags & CHANGELEVEL_KEEPFACING)) diff --git a/src/g_levellocals.h b/src/g_levellocals.h index d28728986..5d1feaadf 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -207,7 +207,7 @@ public: int Massacre(bool baddies = false, FName cls = NAME_None); AActor *SpawnMapThing(FMapThing *mthing, int position); AActor *SpawnMapThing(int index, FMapThing *mt, int position); - AActor *SpawnPlayer(FPlayerStart *mthing, int playernum, int flags); + AActor *SpawnPlayer(FPlayerStart *mthing, int playernum, int flags = 0); void StartLightning(); void ForceLightning(int mode); void ClearDynamic3DFloorData(); @@ -641,12 +641,6 @@ inline bool line_t::hitSkyWall(AActor* mo) const mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this)); } -// Work for later. -inline AActor *P_SpawnPlayer(FPlayerStart *mthing, int playernum, int flags = 0) -{ - return level.SpawnPlayer(mthing, playernum, flags); -} - // This must later be extended to return an array with all levels. // It is meant for code that needs to iterate over all levels to make some global changes, e.g. configuation CCMDs. inline TArrayView AllLevels() diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 52d371f3d..bbd7a4eaa 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5338,7 +5338,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position) } if (!deathmatch && !(flags2 & LEVEL2_RANDOMPLAYERSTARTS)) { - return P_SpawnPlayer(&start, pnum, (flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); + return SpawnPlayer(&start, pnum, (flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); } return NULL; } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 06fc8c613..a1d68b235 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -889,7 +889,7 @@ void FLevelLocals::SpawnExtraPlayers() if (playeringame[i] && players[i].mo == NULL) { players[i].playerstate = PST_ENTER; - P_SpawnPlayer(&playerstarts[i], i, (flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); + SpawnPlayer(&playerstarts[i], i, (flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); } } } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d557236ac..405892c35 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -458,7 +458,7 @@ void P_SetupLevel(FLevelLocals *Level, int position, bool newGame) { players[i].mo = nullptr; FPlayerStart *mthing = Level->PickPlayerStart(i); - P_SpawnPlayer(mthing, i, (Level->flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); + Level->SpawnPlayer(mthing, i, (Level->flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0); } } }