mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
LunaCON: qgetsysstr/STR_MAP*NAME: add informative err. msg. for void vol/lev.
git-svn-id: https://svn.eduke32.com/eduke32@4379 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
10a0e82736
commit
5be1c322b2
1 changed files with 10 additions and 9 deletions
|
@ -873,18 +873,19 @@ function _qgetsysstr(qdst, what, pli)
|
||||||
|
|
||||||
local idx = ffiC.ud.volume_number*con_lang.MAXLEVELS + ffiC.ud.level_number
|
local idx = ffiC.ud.volume_number*con_lang.MAXLEVELS + ffiC.ud.level_number
|
||||||
local MAXIDX = ffi.sizeof(ffiC.MapInfo) / ffi.sizeof(ffiC.MapInfo[0])
|
local MAXIDX = ffi.sizeof(ffiC.MapInfo) / ffi.sizeof(ffiC.MapInfo[0])
|
||||||
|
local mapnamep = (what == ffiC.STR_MAPNAME)
|
||||||
|
|
||||||
if (what == ffiC.STR_MAPNAME) then
|
if (mapnamep or what == ffiC.STR_MAPFILENAME) then
|
||||||
assert(not (idx >= MAXIDX+0ULL))
|
assert(not (idx >= MAXIDX+0ULL))
|
||||||
local src = ffiC.MapInfo[idx].name
|
local src = mapnamep and ffiC.MapInfo[idx].name or ffiC.MapInfo[idx].filename
|
||||||
assert(src ~= nil)
|
if (src == nil) then
|
||||||
quote_strcpy(dst, src)
|
error(format("attempted access to %s of non-existent map (vol=%d, lev=%d)",
|
||||||
elseif (what == ffiC.STR_MAPFILENAME) then
|
mapnamep and "name" or "file name",
|
||||||
assert(not (idx >= MAXIDX+0ULL))
|
ffiC.ud.volume_number, ffiC.ud.level_number), 2)
|
||||||
local src = ffiC.MapInfo[idx].filename
|
end
|
||||||
assert(src ~= nil)
|
|
||||||
quote_strcpy(dst, src)
|
quote_strcpy(dst, src)
|
||||||
elseif (what == ffiC.STR_PLAYERNAME) then
|
elseif (what == ffiC.STR_PLAYERNAME) then
|
||||||
|
check_player_idx(pli)
|
||||||
ffi.copy(dst, ffiC.g_player[pli].user_name, ffi.sizeof(ffiC.g_player[0].user_name))
|
ffi.copy(dst, ffiC.g_player[pli].user_name, ffi.sizeof(ffiC.g_player[0].user_name))
|
||||||
elseif (what == ffiC.STR_VERSION) then
|
elseif (what == ffiC.STR_VERSION) then
|
||||||
ffi.copy(dst, EDUKE32_VERSION_STR)
|
ffi.copy(dst, EDUKE32_VERSION_STR)
|
||||||
|
@ -892,7 +893,7 @@ function _qgetsysstr(qdst, what, pli)
|
||||||
ffi.copy(dst, "multiplayer not yet implemented") -- TODO_MP
|
ffi.copy(dst, "multiplayer not yet implemented") -- TODO_MP
|
||||||
elseif (what == ffiC.STR_VOLUMENAME) then
|
elseif (what == ffiC.STR_VOLUMENAME) then
|
||||||
local vol = ffiC.ud.volume_number
|
local vol = ffiC.ud.volume_number
|
||||||
assert(not (vol >= con_lang.MAXVOLUMES+0ULL))
|
bcheck.volume_number(vol)
|
||||||
ffi.copy(dst, ffiC.EpisodeNames[vol], ffi.sizeof(ffiC.EpisodeNames[0]))
|
ffi.copy(dst, ffiC.EpisodeNames[vol], ffi.sizeof(ffiC.EpisodeNames[0]))
|
||||||
else
|
else
|
||||||
error("unknown system string ID "..what, 2)
|
error("unknown system string ID "..what, 2)
|
||||||
|
|
Loading…
Reference in a new issue