From: Rudolf Polzer Date: Mon, 9 Jan 2012 20:08:18 +0000 (+0100) Subject: func_plat: do not crash if broken X-Git-Tag: xonotic-v0.6.0~188^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6aed52a49a83ac3336e45eca9a57cd72956d2a68;p=xonotic%2Fxonotic-data.pk3dir.git func_plat: do not crash if broken --- diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index a556d6d0b..087a048c3 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -57,7 +57,17 @@ void plat_spawn_inside_trigger() tmax_y = tmin_y + 1; } - setsize (trigger, tmin, tmax); + if(tmin_x > tmax_x) + if(tmin_y > tmax_y) + if(tmin_z > tmax_z) + { + setsize (trigger, tmin, tmax); + return; + } + + // otherwise, something is fishy... + remove(trigger); + objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn"); } void plat_hit_top() @@ -235,10 +245,10 @@ void spawnfunc_func_plat() self.pos2 = self.origin; self.pos2_z = self.origin_z - self.height; - plat_spawn_inside_trigger (); // the "start moving" trigger - self.reset = plat_reset; plat_reset(); + + plat_spawn_inside_trigger (); // the "start moving" trigger }