Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
authorWuzzy <Wuzzy2@mail.ru>
Fri, 02 Nov 2018 10:31:08 +0100
changeset 14091 a5be3ef4bbbe
parent 14090 abb42ba345b6
child 14092 bc25c5ff2ca2
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
share/hedgewars/Data/Scripts/OfficialChallengeHashes.lua
share/hedgewars/Data/Scripts/OfficialChallenges.lua
share/hedgewars/Data/Scripts/TechMaps.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Fri Nov 02 09:45:54 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Fri Nov 02 10:31:08 2018 +0100
@@ -118,6 +118,8 @@
 local waypointCursor = false
 local waypointPreview = nil
 
+local officialChallenge
+
 --------------------------
 -- hog and team tracking variales
 --------------------------
@@ -710,6 +712,7 @@
         roundN = 0
         lastRound = TotalRounds
         RoundHasChanged = false
+        officialChallenge = detectMapWithDigest()
 
 	if GetBackgroundBrightness() == 1 then
 		-- Dark waypoint colour theme
@@ -1094,15 +1097,13 @@
         raceType = "mixed race"
     end
 
-    map = detectMapWithDigest()
-
     for i = 0, (numTeams-1) do
         if teamScore[i] < MAX_TURN_TIME then
-            DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
+            DeclareAchievement(raceType, teamNameArr[i], officialChallenge, teamScore[i])
         end
     end
 
-    if map ~= nil and fastCount > 0 then
+    if officialChallenge ~= nil and fastCount > 0 then
         StartGhostPoints(fastCount)
 
         for i = 0, (fastCount - 1) do
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Fri Nov 02 09:45:54 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Fri Nov 02 10:31:08 2018 +0100
@@ -699,7 +699,6 @@
 	if mapID == nil then
 		mapID = 2 + GetRandom(7)
 	end
-	WriteLnToConsole("TechRacer: Using map "..tostring(mapID))
 
 	addHashData(mapID)
 
@@ -911,6 +910,8 @@
 	roundN = 0
 	lastRound = TotalRounds
 	RoundHasChanged = false
+	WriteLnToConsole("TechRacer: Using map #"..tostring(mapID-1).." (mapID="..tostring(mapID)..")")
+	officialChallenge = detectMapWithDigest()
 
 	RebuildTeamInfo()
 
@@ -1252,15 +1253,13 @@
 		raceType = "mixed race"
 	end
 
-	map = detectMapWithDigest()
-
 	for i = 0, (numTeams-1) do
 		if teamScore[i] < MAX_TURN_TIME then
-			DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
+			DeclareAchievement(raceType, teamNameArr[i], officialChallenge, teamScore[i])
 		end
 	end
 
-	if map ~= nil and fastCount > 0 then
+	if officialChallenge ~= nil and fastCount > 0 then
 		StartGhostPoints(fastCount)
 
 		for i = 0, (fastCount - 1) do
--- a/share/hedgewars/Data/Scripts/OfficialChallengeHashes.lua	Fri Nov 02 09:45:54 2018 +0100
+++ b/share/hedgewars/Data/Scripts/OfficialChallengeHashes.lua	Fri Nov 02 10:31:08 2018 +0100
@@ -1,31 +1,32 @@
 official_racer_maps = {
-    ["Border,60526986531,838018718"] = "Racer Challenge #1"
-    , ["Border,71022545335,-490229244"] = "Racer Challenge #2"
-    , ["Border,40469748943,806689586"] = "Racer Challenge #3"
-    , ["85940488650,-134869715"] = "Racer Challenge #4"
-    , ["62080348735,-661895109"] = "Racer Challenge #5"
-    , ["56818170733,479034891"] = "Racer Challenge #6"
-    , ["Border,25372705797,1770509913"] = "Racer Challenge #7"
-    , ["Border,10917540013,1902370941"] = "Racer Challenge #8"
-    , ["Border,43890274319,185940363"] = "Racer Challenge #9"
-    , ["Border,27870148394,751885839"] = "Racer Challenge #10"
-    , ["Border,22647869226,178845011"] = "Racer Challenge #11"
-    , ["Border,46954401793,706743197"] = "Racer Challenge #12"
-    , ["Border,60760377667,157242054"] = "Racer Challenge #13"
-    , ["Border,51825989393,-1585582638"] = "Racer Challenge #14"
-    , ["81841189250,256715557"] = "Racer Challenge #15"
-    , ["Border,44246064625,-528106034"] = "Racer Challenge #16"
-    , ["60906776802,-1389184823"] = "Racer Challenge #17"
-    , ["Border,70774747774,-534640804"] = "Racer Challenge #18"
-    , ["Border,50512019610,-1839546856"] = "Racer Challenge #19"
-    , ["60715683005,-281312897"] = "Racer Challenge #20"
+    ["Border,60526986531,-1902170174"] = "Racer Challenge #1"
+    , ["Border,71022545335,-68467181"] = "Racer Challenge #2"
+    , ["Border,40469748943,-1955933813"] = "Racer Challenge #3"
+    , ["85940488650,1891067114"] = "Racer Challenge #4"
+    , ["62080348735,186146414"] = "Racer Challenge #5"
+    , ["56818170733,1680930033"] = "Racer Challenge #6"
+    , ["Border,25372705797,-2143001865"] = "Racer Challenge #7"
+    , ["Border,10917540013,1294253786"] = "Racer Challenge #8"
+    , ["Border,43890274319,-691113420"] = "Racer Challenge #9"
+    , ["Border,27870148394,1263586737"] = "Racer Challenge #10"
+    , ["Border,22647869226,-1011473400"] = "Racer Challenge #11"
+    , ["Border,46954401793,-164671701"] = "Racer Challenge #12"
+    , ["Border,60760377667,458374282"] = "Racer Challenge #13"
+    , ["Border,51825989393,-589164698"] = "Racer Challenge #14"
+    , ["81841189250,-1216146050"] = "Racer Challenge #15"
+    , ["Border,44246064625,-898958339"] = "Racer Challenge #16"
+    -- TODO: Add Racer Challenge #17
+    --, ["?????,?????"] = "Racer Challenge #17"
+    , ["Border,70774747774,1976202242"] = "Racer Challenge #18"
+    , ["Border,50512019610,122061403"] = "Racer Challenge #19"
+    , ["60715683005,45638031"] = "Racer Challenge #20"
 -- tech racer
-    , ["Border,19661006772,-975391975"] = "Tech Racer #1"
-    , ["Border,19661306766,-975391975"] = "Tech Racer #2"
-    , ["Border,19661606760,-975391975"] = "Tech Racer #3"
-    , ["Border,19661906754,-975391975"] = "Tech Racer #4"
-    , ["Border,19662206748,-975391975"] = "Tech Racer #5"
-    , ["Border,19662506742,-975391975"] = "Tech Racer #6"
-    , ["Border,19662806736,-975391975"] = "Tech Racer #7"
-    , ["Border,19663106730,-975391975"] = "Tech Racer #8"
+    , ["Border,19661006772,634694529"] = "Tech Racer #1"
+    , ["Border,19661306766,634694529"] = "Tech Racer #2"
+    , ["Border,19661606760,634694529"] = "Tech Racer #3"
+    , ["Border,19661906754,634694529"] = "Tech Racer #4"
+    , ["Border,19662206748,634694529"] = "Tech Racer #5"
+    , ["Border,19662506742,634694529"] = "Tech Racer #6"
+    , ["Border,19662806736,634694529"] = "Tech Racer #7"
+    , ["Border,19663106730,634694529"] = "Tech Racer #8"
 }
--- a/share/hedgewars/Data/Scripts/OfficialChallenges.lua	Fri Nov 02 09:45:54 2018 +0100
+++ b/share/hedgewars/Data/Scripts/OfficialChallenges.lua	Fri Nov 02 10:31:08 2018 +0100
@@ -27,7 +27,11 @@
             mapString = "Border," .. mapString
         end
 
-        --WriteLnToConsole(mapString)
-        return(official_racer_maps[mapString])
+        WriteLnToConsole("OfficialChallenges: Hash: "..mapString)
+        local map = official_racer_maps[mapString]
+        if map ~= nil then
+            WriteLnToConsole("OfficialChallenges: Detected official challenge: "..map)
+        end
+        return map
     end
 end
--- a/share/hedgewars/Data/Scripts/TechMaps.lua	Fri Nov 02 09:45:54 2018 +0100
+++ b/share/hedgewars/Data/Scripts/TechMaps.lua	Fri Nov 02 10:31:08 2018 +0100
@@ -102,7 +102,7 @@
 	if mapID == nil then
 		mapID = 2 + GetRandom(7)
 	end
-	WriteLnToConsole("TechRacer preview: Using map "..tostring(mapID))
+	WriteLnToConsole("TechRacer preview: Using map #"..tostring(mapID-1).." (mapID="..tostring(mapID)..")")
 
     TemplateFilter = 0