From c7b6cd705f790a23bc8b81b84f1697e486f56283 Mon Sep 17 00:00:00 2001
From: RedEnchilada <redenchilada@derpymail.com>
Date: Mon, 3 Aug 2015 19:27:10 -0500
Subject: [PATCH] Separate P_LoadThings into two functions to make the next
 commit cleaner

---
 src/p_setup.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/p_setup.c b/src/p_setup.c
index c836d601c6..3491669c7d 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -850,7 +850,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum)
 //
 // P_LoadThings
 //
-static void P_LoadThings(lumpnum_t lumpnum)
+static void P_PrepareThings(lumpnum_t lumpnum)
 {
 	size_t i;
 	mapthing_t *mt;
@@ -888,6 +888,15 @@ static void P_LoadThings(lumpnum_t lumpnum)
 	}
 	Z_Free(datastart);
 
+}
+
+static void P_LoadThings(void)
+{
+	size_t i;
+	mapthing_t *mt;
+
+	// Loading the things lump itself into memory is now handled in P_PrepareThings, above
+
 	mt = mapthings;
 	numhuntemeralds = 0;
 	for (i = 0; i < nummapthings; i++, mt++)
@@ -2123,7 +2132,8 @@ void P_LoadThingsOnly(void)
 
 	P_LevelInitStuff();
 
-	P_LoadThings(lastloadedmaplumpnum + ML_THINGS);
+	P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+	P_LoadThings();
 
 	P_SpawnSecretItems(true);
 }
@@ -2540,11 +2550,13 @@ boolean P_SetupLevel(boolean skipprecip)
 
 	P_MapStart();
 
+	P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+
 #ifdef ESLOPE
 	P_ResetDynamicSlopes();
 #endif
 
-	P_LoadThings(lastloadedmaplumpnum + ML_THINGS);
+	P_LoadThings();
 
 	P_SpawnSecretItems(loademblems);
 
-- 
GitLab