Modify Racer script so it could work with special points
authorunc0rr
Mon, 30 Sep 2013 22:46:48 +0400
changeset 9483 14ad1ac00ac9
parent 9481 fbf61ef67c7b
child 9485 3dee8a3b0406
Modify Racer script so it could work with special points
QTfrontend/drawmapscene.cpp
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/QTfrontend/drawmapscene.cpp	Mon Sep 30 13:43:55 2013 -0400
+++ b/QTfrontend/drawmapscene.cpp	Mon Sep 30 22:46:48 2013 +0400
@@ -193,6 +193,8 @@
         removeItem(items().first());
     }
 
+    items().clear();
+
     oldPaths = paths;
 
     paths.clear();
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Mon Sep 30 13:43:55 2013 -0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Mon Sep 30 22:46:48 2013 +0400
@@ -92,6 +92,10 @@
 local currY = {}
 local currCount = 0
 
+local specialPointsX = {}
+local specialPointsY = {}
+local specialPointsCount = 0
+
 --------------------------
 -- hog and team tracking variales
 --------------------------
@@ -489,6 +493,10 @@
         lastRound = TotalRounds
         RoundHasChanged = false -- true
 
+        for i = 0, (specialPointsCount-1) do
+                PlaceWayPoint(specialPointsX[i], specialPointsY[i])
+        end
+
         RebuildTeamInfo()
 
         ShowMission     (
@@ -501,7 +509,7 @@
                                 "", 4, 4000
                                 )
 
-	TryRepositionHogs()
+        TryRepositionHogs()
 
 end
 
@@ -525,13 +533,15 @@
 end
 
 function onSpecialPoint(x,y,flag)
-    PlaceWayPoint(x,y)
+    specialPointsX[specialPointsCount] = x
+    specialPointsY[specialPointsCount] = y
+    specialPointsCount = specialPointsCount + 1
 end
 
 function onNewTurn()
 
         CheckForNewRound()
-	TryRepositionHogs()
+        TryRepositionHogs()
 
         racerActive = false