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()))
|
||||
end
|
||||
|
||||
local ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
local function changelevel(player, ...)
|
||||
if not doyoudare(player) then
|
||||
return
|
||||
@ -418,6 +416,8 @@ local function changelevel(player, ...)
|
||||
end
|
||||
|
||||
local mapnum = 0
|
||||
local A = string.byte("A")
|
||||
|
||||
if tonumber(p) != nil then
|
||||
-- Non extended map numbers
|
||||
if tonumber(q) == nil then
|
||||
@ -427,11 +427,12 @@ local function changelevel(player, ...)
|
||||
mapnum = tonumber(p) * 10 + tonumber(q)
|
||||
else
|
||||
--Extended map numbers
|
||||
p = ALPH:find(p) - 1
|
||||
p = string.byte(p) - A
|
||||
local qn = tonumber(q)
|
||||
if qn == nil then
|
||||
qn = ALPH:find(q) + 9
|
||||
qn = string.byte(q) - A + 10
|
||||
end
|
||||
|
||||
mapnum = 36 * p + qn + 100
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user