Racer: Clean up “did not finish” mess
authorWuzzy <almikes@aol.com>
Wed, 13 Apr 2016 14:14:33 +0200
changeset 11935 4ed643879c0f
parent 11934 167de692f2d7
child 11936 a01a890093f3
Racer: Clean up “did not finish” mess
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Apr 13 14:02:53 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Apr 13 14:14:33 2016 +0200
@@ -133,8 +133,8 @@
 
 local cGear = nil
 
-local bestClan = nil
-local bestTime = nil
+local bestClan = 10
+local bestTime = 1000000
 
 local gameBegun = false
 local gameOver = false
@@ -205,7 +205,7 @@
                 teamNameArr[i] = " "
                 teamSize[i] = 0
                 teamIndex[i] = 0
-                teamScore[i] = 100000
+                teamScore[i] = 1000000
         end
         numTeams = 0
 
@@ -334,12 +334,7 @@
 end
 
 function AdjustScores()
-
-        if bestTime == nil then
-                bestTime = 100000
-                bestClan = 10
-                bestTimeComment = "N/A"
-        end
+	bestTimeComment = loc("Did not finish")
 
         newScore = false
 
@@ -363,7 +358,7 @@
                 end
         end
 
-        if bestTime ~= 100000 then
+        if bestTime ~= 1000000 then
                 bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000))
         end
 
@@ -415,10 +410,10 @@
 
         totalComment = ""
         for i = 0, (TeamsCount-1) do
-                        if teamNameArr[i] ~= " " and teamScore[i] ~= -1 then
+                        if teamNameArr[i] ~= " " and teamScore[i] ~= 1000000 then
                                 teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|"
                         else
-                                teamComment[i] = string.format(loc("%s: N/A"), teamNameArr[i]) .. "|"
+                                teamComment[i] = string.format(loc("%s: Did not finish"), teamNameArr[i]) .. "|"
                         end
                         totalComment = totalComment .. teamComment[i]
         end
@@ -438,7 +433,7 @@
                 local sortedTeams = {}
                 local k = 1
                 for i = 0, TeamsCount-1 do
-                        if teamScore[i] ~= 100000 and teamNameArr[i] ~= " " then
+                        if teamScore[i] ~= 1000000 and teamNameArr[i] ~= " " then
                                sortedTeams[k] = {}
                                sortedTeams[k].name = teamNameArr[i]
                                sortedTeams[k].score = teamScore[i]
@@ -815,7 +810,7 @@
     map = detectMapWithDigest()
 
     for i = 0, (numTeams-1) do
-        if teamScore[i] < 100000 then
+        if teamScore[i] < 1000000 then
             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
         end
     end