]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Safer implementation for removing consumable items
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 1 Feb 2012 14:44:48 +0000 (16:44 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 1 Feb 2012 14:44:48 +0000 (16:44 +0200)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/progs.src
data/qcsrc/server/t_items.qc
data/qcsrc/server/t_items.qh [new file with mode: 0644]
data/qcsrc/server/vore.qc

index 0dfec051bf7948b28cf4d9b76889baa0194399b4..23ad32412ddb3fb536d10e5c3d3c12b991fa67dd 100644 (file)
@@ -586,13 +586,6 @@ void PutObserverInServer (void)
        }\r
 \r
        Vore_Disconnect();\r
-       entity e;\r
-       for(e = world; (e = find(e, classname, "consumable")); )\r
-       {\r
-               // remove consumable items when we spectate\r
-               if(e.predator == self)\r
-                       Item_Consumable_Remove(e, TRUE);\r
-       }\r
 \r
        kh_Key_DropAll(self, TRUE);\r
 \r
@@ -863,12 +856,6 @@ void PutClientInServer (void)
 \r
                Vore_Disconnect();\r
                self.swallow_progress_pred = self.swallow_progress_prey = 0;\r
-               for(e = world; (e = find(e, classname, "consumable")); )\r
-               {\r
-                       // remove consumable items when we respawn\r
-                       if(e.predator == self)\r
-                               Item_Consumable_Remove(e, FALSE);\r
-               }\r
 \r
                self.classname = "player";\r
                self.wasplayer = TRUE;\r
@@ -1638,13 +1625,6 @@ void ClientDisconnect (void)
        }\r
 \r
        Vore_Disconnect();\r
-       entity e;\r
-       for(e = world; (e = find(e, classname, "consumable")); )\r
-       {\r
-               // remove consumable items when we disconnect\r
-               if(e.predator == self)\r
-                       Item_Consumable_Remove(e, TRUE);\r
-       }\r
 \r
        CheatShutdownClient();\r
 \r
index 4755d45d5da00462a53f53ff362092e7b9153f51..e9ce6eb6d85df97b94d6e01ae6e7261f1dbaec1e 100644 (file)
@@ -52,6 +52,8 @@ playerdemo.qh
 \r
 vore.qh\r
 \r
+t_items.qh\r
+\r
 scores_rules.qc\r
 \r
 miscfunctions.qc\r
index 69ff60da05c4514ff6ff66c2b69fbd6e15223a38..f785c3bca16080bcb40eaf984c128d387ea320e3 100644 (file)
@@ -221,7 +221,6 @@ void Item_ScheduleInitialRespawn(entity e)
 \r
 .float inithealth, initdmg;\r
 .float item_digestion_step;\r
-void Item_Consumable_Remove(entity e, float regurgitate);\r
 void Item_Consumable_Think()\r
 {\r
        if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
diff --git a/data/qcsrc/server/t_items.qh b/data/qcsrc/server/t_items.qh
new file mode 100644 (file)
index 0000000..0526110
--- /dev/null
@@ -0,0 +1 @@
+void Item_Consumable_Remove(entity e, float regurgitate);\r
index ef7f0291b236b7a5fdae257a5cabba39d64ac953..87baed61be5e6ff458900ddd304e09c48648f612 100644 (file)
@@ -430,6 +430,7 @@ void Vore_Regurgitate(entity e)
 void Vore_Disconnect()\r
 {\r
        // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
+       entity e;\r
 \r
        // prey disconnects or goes spectating while inside someone's belly\r
        if(self.stat_eaten)\r
@@ -442,6 +443,12 @@ void Vore_Disconnect()
                if(head.predator == self)\r
                        Vore_Regurgitate(head);\r
        }\r
+       // remove consumable items when we disconnect\r
+       for(e = world; (e = find(e, classname, "consumable")); )\r
+       {\r
+               if(e.predator == self)\r
+                       Item_Consumable_Remove(e, TRUE);\r
+       }\r
 \r
        self.stomach_load = self.gravity = 0; // prevents a bug\r
        Vore_GurgleSound(); // stop the gurgling sound\r