--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua Tue Feb 09 15:27:55 2016 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua Fri Feb 12 17:03:42 2016 +0300
@@ -551,6 +551,9 @@
end
function onSpecialPoint(x,y,flag)
+ addHashData(x)
+ addHashData(y)
+ addHashData(flag)
specialPointsX[specialPointsCount] = x
specialPointsY[specialPointsCount] = y
specialPointsCount = specialPointsCount + 1
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Tue Feb 09 15:27:55 2016 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Fri Feb 12 17:03:42 2016 +0300
@@ -724,6 +724,9 @@
end
function onSpecialPoint(x,y,flag)
+ addHashData(x)
+ addHashData(y)
+ addHashData(flag)
specialPointsX[specialPointsCount] = x
specialPointsY[specialPointsCount] = y
specialPointsFlag[specialPointsCount] = flag
@@ -1270,7 +1273,7 @@
raceType = "mixed race"
end
- map = detectMap()
+ map = detectMapWithDigest()
for i = 0, (numTeams-1) do
if teamScore[i] < 100000 then
--- a/share/hedgewars/Data/Scripts/OfficialChallenges.lua Tue Feb 09 15:27:55 2016 -0500
+++ b/share/hedgewars/Data/Scripts/OfficialChallenges.lua Fri Feb 12 17:03:42 2016 +0300
@@ -45,3 +45,26 @@
end
end
end
+
+-- modified Adler hash
+local hashA = 0
+local hashB = 0
+local hashModule = 299993
+
+function resetHash()
+ hashA = 0
+ hashB = 0
+end
+
+function addHashData(i)
+ hashA = (hashA + i + 65536) % hashModule
+ hashB = (hashB + hashA) % hashModule
+end
+
+function hashDigest()
+ return(hashB * hashModule + hashA)
+end
+
+function detectMapWithDigest()
+ return("map " .. hashDigest())
+end