share/hedgewars/Data/Scripts/OfficialChallenges.lua
author nemo
Tue, 18 Sep 2018 19:30:55 -0400
changeset 13823 a623657da787
parent 13818 9c3f793cfe82
child 13824 552f0d5ab3e7
permissions -rw-r--r--
restore old land hashes which in theory should not have changed in .24
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
     1
local maps = {
13823
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     2
    ["Border,60526986531,838018718"] = "Racer Challenge #1"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     3
    , ["Border,71022545335,-490229244"] = "Racer Challenge #2"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     4
    , ["Border,40469748943,806689586"] = "Racer Challenge #3"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     5
    , ["85940488650,-134869715"] = "Racer Challenge #4"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     6
    , ["62080348735,-661895109"] = "Racer Challenge #5"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     7
    , ["56818170733,479034891"] = "Racer Challenge #6"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     8
    , ["Border,25372705797,1770509913"] = "Racer Challenge #7"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
     9
    , ["Border,10917540013,1902370941"] = "Racer Challenge #8"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    10
    , ["Border,43890274319,185940363"] = "Racer Challenge #9"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    11
    , ["Border,27870148394,751885839"] = "Racer Challenge #10"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    12
    , ["Border,22647869226,178845011"] = "Racer Challenge #11"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    13
    , ["Border,46954401793,706743197"] = "Racer Challenge #12"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    14
    , ["Border,60760377667,157242054"] = "Racer Challenge #13"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    15
    , ["Border,51825989393,-1585582638"] = "Racer Challenge #14"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    16
    , ["81841189250,256715557"] = "Racer Challenge #15"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    17
    , ["Border,44246064625,-528106034"] = "Racer Challenge #16"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    18
    , ["60906776802,-1389184823"] = "Racer Challenge #17"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    19
    , ["Border,70774747774,-534640804"] = "Racer Challenge #18"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    20
    , ["Border,50512019610,-1839546856"] = "Racer Challenge #19"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    21
    , ["60715683005,-281312897"] = "Racer Challenge #20"
11546
59bf29b4f523 Tech racer maps detection
unc0rr
parents: 11545
diff changeset
    22
-- tech racer
13823
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    23
    , ["Border,19661006772,-975391975"] = "Tech Racer #1"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    24
    , ["Border,19661306766,-975391975"] = "Tech Racer #2"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    25
    , ["Border,19661606760,-975391975"] = "Tech Racer #3"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    26
    , ["Border,19661906754,-975391975"] = "Tech Racer #4"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    27
    , ["Border,19662206748,-975391975"] = "Tech Racer #5"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    28
    , ["Border,19662506742,-975391975"] = "Tech Racer #6"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    29
    , ["Border,19662806736,-975391975"] = "Tech Racer #7"
a623657da787 restore old land hashes which in theory should not have changed in .24
nemo
parents: 13818
diff changeset
    30
    , ["Border,19663106730,-975391975"] = "Tech Racer #8"
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    31
    }
11542
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    32
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    33
-- modified Adler hash
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    34
local hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    35
local hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    36
local hashModule = 299993
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    37
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    38
function resetHash()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    39
    hashA = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    40
    hashB = 0
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    41
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    42
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    43
function addHashData(i)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    44
    hashA = (hashA + i + 65536) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    45
    hashB = (hashB + hashA) % hashModule
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    46
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    47
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    48
function hashDigest()
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    49
    return(hashB * hashModule + hashA)
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    50
end
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    51
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    52
function detectMapWithDigest()
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    53
    if RopePercent == 100 and MinesNum == 0 then
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    54
        mapString = hashDigest() .. "," .. LandDigest
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    55
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    56
        if band(GameFlags, gfBorder) ~= 0 then
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    57
            mapString = "Border," .. mapString
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    58
        end
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    59
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    60
        --WriteLnToConsole(mapString)
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    61
        return(maps[mapString])
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
    62
    end
11542
64a5ab2c4f00 Attempt to implement hash for special points to detect tech racer maps
unC0Rr
parents: 11535
diff changeset
    63
end