share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 10227 0b848d595f22
parent 10044 33e64afccd3b
child 10228 947cadb40bc5
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Apr 16 11:18:39 2014 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Fri Apr 25 14:22:59 2014 +0400
@@ -359,7 +359,7 @@
                                         loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
 
         -- end game if its at round limit
-        if roundNumber == roundLimit then
+        if roundNumber >= roundLimit then
                 for i = 0, (numhhs-1) do
                         if GetHogClan(hhs[i]) ~= bestClan then
                                 SetEffect(hhs[i], heResurrectable, 0)
@@ -515,22 +515,21 @@
 end
 
 function PlaceWayPoint(x,y)
-
-        if (wpCount < wpLimit) then -- seems to not work with a hedgehog nil chek
+    if not racerActive then
+        if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
 
-                wpX[wpCount] = x
-                wpY[wpCount] = y
-                wpCol[wpCount] = 0xffffffff
-                wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
-                                                                                                                                                --100
-                SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
+            wpX[wpCount] = x
+            wpY[wpCount] = y
+            wpCol[wpCount] = 0xffffffff
+            wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
+                                                                                                                                            
+            SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
 
-                wpCount = wpCount + 1
+            wpCount = wpCount + 1
 
-                AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
-
+            AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
         end
-
+    end
 end
 
 function onSpecialPoint(x,y,flag)
@@ -671,7 +670,6 @@
 
                                 if (CheckWaypoints() == true) then
                                         AdjustScores()
-                                        racerActive = false
                                         DisableTumbler()
                                 end