mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Support hex constants in scriptfile_getsymbolvalue()
git-svn-id: https://svn.eduke32.com/eduke32@5822 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ae5f941ad0
commit
47edac436b
1 changed files with 14 additions and 0 deletions
|
@ -349,6 +349,20 @@ static char *getsymbtabspace(int32_t reqd)
|
|||
|
||||
int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val)
|
||||
{
|
||||
if (Bstrlen(name) > 2)
|
||||
{
|
||||
if (tolower(name[1]) == 'x') // hex constants
|
||||
{
|
||||
int64_t x;
|
||||
sscanf(name + 2, "%" PRIx64 "", &x);
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX))
|
||||
initprintf("warning: number 0x%" PRIx64 " truncated to 32 bits.\n", x);
|
||||
|
||||
*val = x;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
char *scanner = symbtab;
|
||||
|
||||
if (!symbtab) return 0;
|
||||
|
|
Loading…
Reference in a new issue