DEADSOFTWARE

net: sync moving items and flags
[d2df-sdl.git] / src / game / g_map.pas
index 20bfa3bf1bee93ff29bc5471cb86a60cf214941a..39a6692f2b228df76f4274e25abc139397a58b8a 100644 (file)
@@ -54,6 +54,7 @@ type
     CaptureTime: LongWord;
     Animation:   TAnimation;
     Direction:   TDirection;
+    NeedSend:    Boolean;
   end;
 
 function  g_Map_Load(Res: String): Boolean;
@@ -2567,8 +2568,13 @@ begin
         begin
           if gFlags[a].Animation <> nil then gFlags[a].Animation.Update();
 
+          Obj.oldX := Obj.X;
+          Obj.oldY := Obj.Y;
+
           m := g_Obj_Move(@Obj, True, True);
 
+          NeedSend := NeedSend or (Obj.X <> Obj.oldX) or (Obj.Y <> Obj.oldY);
+
           if gTime mod (GAME_TICK*2) <> 0 then Continue;
 
           // Ñîïðîòèâëåíèå âîçäóõà
@@ -3153,6 +3159,9 @@ begin
       Direction := FlagPoints[Flag]^.Direction;
       State := FLAG_STATE_NORMAL;
     end;
+    Obj.oldX := Obj.X;
+    Obj.oldY := Obj.Y;
+    NeedSend := False; // the event will take care of this
     Count := -1;
   end;
 end;