forked from Not/srb2k-leaderboard
use ascii arithmetic to find letter values
This commit is contained in:
parent
07dca46c92
commit
f3ec32384a
@ -395,8 +395,6 @@ local function mapNotExists(player, map)
|
|||||||
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
||||||
end
|
end
|
||||||
|
|
||||||
local ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
||||||
|
|
||||||
local function changelevel(player, ...)
|
local function changelevel(player, ...)
|
||||||
if not doyoudare(player) then
|
if not doyoudare(player) then
|
||||||
return
|
return
|
||||||
@ -418,6 +416,8 @@ local function changelevel(player, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local mapnum = 0
|
local mapnum = 0
|
||||||
|
local A = string.byte("A")
|
||||||
|
|
||||||
if tonumber(p) != nil then
|
if tonumber(p) != nil then
|
||||||
-- Non extended map numbers
|
-- Non extended map numbers
|
||||||
if tonumber(q) == nil then
|
if tonumber(q) == nil then
|
||||||
@ -427,11 +427,12 @@ local function changelevel(player, ...)
|
|||||||
mapnum = tonumber(p) * 10 + tonumber(q)
|
mapnum = tonumber(p) * 10 + tonumber(q)
|
||||||
else
|
else
|
||||||
--Extended map numbers
|
--Extended map numbers
|
||||||
p = ALPH:find(p) - 1
|
p = string.byte(p) - A
|
||||||
local qn = tonumber(q)
|
local qn = tonumber(q)
|
||||||
if qn == nil then
|
if qn == nil then
|
||||||
qn = ALPH:find(q) + 9
|
qn = string.byte(q) - A + 10
|
||||||
end
|
end
|
||||||
|
|
||||||
mapnum = 36 * p + qn + 100
|
mapnum = 36 * p + qn + 100
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user