]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
func_plat: do not crash if broken
authorRudolf Polzer <divverent@alientrap.org>
Mon, 9 Jan 2012 20:08:18 +0000 (21:08 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 9 Jan 2012 20:08:18 +0000 (21:08 +0100)
qcsrc/server/t_plats.qc

index a556d6d0bb192dd72d9417d2535a7eafa3e82aac..087a048c30c84177de7cb17e97a74e32b3158ede 100644 (file)
@@ -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
 }