]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
handle an entity being antilag-takenback multiple times
authorRudolf Polzer <divverent@xonotic.org>
Thu, 27 Oct 2011 08:28:42 +0000 (10:28 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 27 Oct 2011 08:29:16 +0000 (10:29 +0200)
qcsrc/server/antilag.qc

index 69d291a4ed69018848e0ebccb7c897b250b922d1..0f6434eab68e3330c5807a4f46c664e8721cdf9f 100644 (file)
@@ -3,6 +3,7 @@
 .float antilag_times[ANTILAG_MAX_ORIGINS];
 .float antilag_index;
 .vector antilag_saved_origin;
+.float antilag_takenback;
 
 .float antilag_debug;
 
@@ -89,17 +90,24 @@ vector antilag_takebackavgvelocity(entity e, float t0, float t1)
 
 void antilag_takeback(entity e, float t)
 {
-    if(e.vehicle)
-        antilag_takeback(e.vehicle, t);
+       if(e.vehicle)
+               antilag_takeback(e.vehicle, t);
+
+       if(!e.antilag_takenback)
+               e.antilag_saved_origin = e.origin;
 
-       e.antilag_saved_origin = e.origin;
        setorigin(e, antilag_takebackorigin(e, t));
+       e.antilag_takenback = TRUE;
 }
 
 void antilag_restore(entity e)
 {
-    if(e.vehicle)
-        antilag_restore(e.vehicle);
+       if(e.vehicle)
+               antilag_restore(e.vehicle);
+
+       if(!e.antilag_takenback)
+               return;
 
        setorigin(e, e.antilag_saved_origin);
+       e.antilag_takenback = FALSE;
 }