From 205d27acbd9391ca90703a83ca37eba64fb41ad7 Mon Sep 17 00:00:00 2001
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Sun, 18 Mar 2012 17:00:55 +0200
Subject: [PATCH] Fix a bug causing consumable items to be instantly
 regurgitated in Arena games, if eating them before the match starts

---
 data/qcsrc/server/cl_client.qc |  6 +++---
 data/qcsrc/server/vore.qc      | 15 +++++++++------
 data/qcsrc/server/vore.qh      |  2 +-
 docs/TODO.txt                  |  4 +++-
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc
index e185bf68..dcc68204 100644
--- a/data/qcsrc/server/cl_client.qc
+++ b/data/qcsrc/server/cl_client.qc
@@ -591,7 +591,7 @@ void PutObserverInServer (void)
 		WriteEntity(MSG_ONE, self);
 	}
 
-	Vore_Disconnect();
+	Vore_Disconnect(TRUE);
 
 	kh_Key_DropAll(self, TRUE);
 
@@ -860,7 +860,7 @@ void PutClientInServer (void)
 
 		RemoveGrabber(self); // Wazat's Grabber
 
-		Vore_Disconnect();
+		Vore_Disconnect(TRUE);
 		self.swallow_progress_pred = self.swallow_progress_prey = 0;
 
 		self.classname = "player";
@@ -1631,7 +1631,7 @@ void ClientDisconnect (void)
 		return;
 	}
 
-	Vore_Disconnect();
+	Vore_Disconnect(TRUE);
 
 	CheatShutdownClient();
 
diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc
index 837a5210..e26b6a62 100644
--- a/data/qcsrc/server/vore.qc
+++ b/data/qcsrc/server/vore.qc
@@ -450,7 +450,7 @@ void Vore_Regurgitate(entity e)
 	e.predator = world;
 }
 
-void Vore_Disconnect()
+void Vore_Disconnect(float consumables)
 {
 	// frees prey from their predators when someone disconnects or goes spectating, or in other circumstances
 	entity e;
@@ -467,10 +467,13 @@ void Vore_Disconnect()
 			Vore_Regurgitate(head);
 	}
 	// remove consumable items when we disconnect
-	for(e = world; (e = find(e, classname, "consumable")); )
+	if(consumables)
 	{
-		if(e.predator == self)
-			Item_Consumable_Remove(e, TRUE);
+		for(e = world; (e = find(e, classname, "consumable")); )
+		{
+			if(e.predator == self)
+				Item_Consumable_Remove(e, TRUE);
+		}
 	}
 
 	self.stomach_load = self.gravity = 0; // prevents a bug
@@ -776,12 +779,12 @@ void Vore()
 	// apply delays and skip the vore system under some circumstances
 	if(!cvar("g_vore")) // the vore system is disabled
 	{
-		Vore_Disconnect();
+		Vore_Disconnect(TRUE);
 		return;
 	}
 	if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins
 	{
-		Vore_Disconnect();
+		Vore_Disconnect(FALSE);
 		return;
 	}
 	if(self.spectatee_status)
diff --git a/data/qcsrc/server/vore.qh b/data/qcsrc/server/vore.qh
index a03b4e15..86f400d7 100644
--- a/data/qcsrc/server/vore.qh
+++ b/data/qcsrc/server/vore.qh
@@ -1,7 +1,7 @@
 const float vore_steptime = 0.1;
 
 void Vore();
-void Vore_Disconnect();
+void Vore_Disconnect(float consumables);
 .float regurgitate_prepare;
 
 entity Swallow_player_check();
diff --git a/docs/TODO.txt b/docs/TODO.txt
index 7ddf2743..25d138d0 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -166,4 +166,6 @@
 
 - +0.8: In Race and RaceCTS, having a big belly should give you some boost or bonus
 
-- 0.7 | 0.8: Is it right to get screen flashes when team healing?
\ No newline at end of file
+- 0.7 | 0.8: Is it right to get screen flashes when team healing?
+
+- 0.8: Why am I not seeing frags and death in the scoreboard in Team Deathmatch?
\ No newline at end of file
-- 
2.39.5