]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Fix the worst cases of divisions by zero
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 18 Nov 2011 23:53:10 +0000 (01:53 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 18 Nov 2011 23:53:10 +0000 (01:53 +0200)
data/qcsrc/server/bot/havocbot/vore_ai.qc
data/qcsrc/server/cl_physics.qc
data/qcsrc/server/vore.qc

index c308e27aa2578bd4da62f96a5da4887f7b91dbf8..729bd3c030954ba5d3eef86d2c98ac394767e77a 100644 (file)
@@ -138,7 +138,7 @@ void Vore_AI()
                if(self.status_teamhealing > 1) // if we are teamhealing, there's nothing to do from here on
                        return;
 
-               if(!cvar("g_vore_reversescoring")) // when reverse scoring is on, it's in the interest of the prey to get eaten, so the predator has nothing to fear
+               if(prey.classname == "player" && !cvar("g_vore_reversescoring")) // when reverse scoring is on, it's in the interest of the prey to get eaten, so the predator has nothing to fear
                {
                        if(skill >= 3) // make bots aware of this from skill 3 and up
                                fear *= 1 + self.stomach_load / self.stomach_maxload; // the bigger our stomach, the less we want to put someone else in there
index 5f3ebe4cd125b7ebae94a6a800af79873a5ae820..7f25bb205209c4e08c690c53030e05aef48c2c52 100644 (file)
@@ -507,14 +507,17 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        if(speedclamp)\r
                accelqw = -accelqw;\r
 \r
-       if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight\r
-               wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed");\r
-       if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster\r
-               wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; \r
-       if(self.swallow_progress_prey) // cut speed based on swallow progress for prey\r
-               wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey"));\r
-       if(self.swallow_progress_pred) // cut speed based on swallow progress for preds\r
-               wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred"));\r
+       if(self.classname == "player")\r
+       {\r
+               if(cvar("g_balance_vore_load_pred_weight") > 0) // apply stomach weight\r
+                       wishspeed /= 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_speed");\r
+               if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster\r
+                       wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; \r
+               if(self.swallow_progress_prey) // cut speed based on swallow progress for prey\r
+                       wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey"));\r
+               if(self.swallow_progress_pred) // cut speed based on swallow progress for preds\r
+                       wishspeed *= 1 - (self.swallow_progress_pred * cvar("g_balance_vore_swallow_speed_cutspd_pred"));\r
+       }\r
 \r
        if(cvar("sv_gameplayfix_q2airaccelerate"))\r
                wishspeed0 = wishspeed;\r
index 57d78ac2d4709be96ddde83889eb2c5f1c054b11..1688588ef5afbcf98f06f46372e681ca887f6a40 100644 (file)
@@ -155,6 +155,8 @@ void Vore_StomachLoad_Apply()
 {\r
        // apply stomach weight that makes you heavier and larger the more you eat\r
        // slowing the player is done in cl_physics.qc\r
+       if(self.classname != "player")\r
+               return;\r
 \r
        entity e;\r
        float prey_mass;\r