Menudef bool arguments expect integers Fix
This commit is contained in:
parent
2db3f7bc45
commit
0418bec4b1
1 changed files with 67 additions and 28 deletions
|
|
@ -511,20 +511,33 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
|||
}
|
||||
else if (args[i]->isIntCompatible())
|
||||
{
|
||||
char *endp;
|
||||
int v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
int v;
|
||||
|
||||
if (sc.Compare("true"))
|
||||
{
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
v = 1;
|
||||
}
|
||||
else if (sc.Compare("false"))
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *endp;
|
||||
v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args[i] == TypeBool) v = !!v;
|
||||
params.Push(v);
|
||||
if (args[i] == TypeBool) v = !!v;
|
||||
params.Push(v);
|
||||
}
|
||||
else if (args[i]->isFloat())
|
||||
{
|
||||
|
|
@ -1114,19 +1127,32 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc, int i
|
|||
}
|
||||
else if (args[i]->isIntCompatible())
|
||||
{
|
||||
char *endp;
|
||||
int v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
int v;
|
||||
|
||||
if (sc.Compare("true"))
|
||||
{
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
v = 1;
|
||||
}
|
||||
else if (sc.Compare("false"))
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *endp;
|
||||
v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
}
|
||||
// Color ranges need to be marked for option menu items to support an older feature where a boolean number could be passed instead.
|
||||
v |= 0x12340000;
|
||||
}
|
||||
// Color ranges need to be marked for option menu items to support an older feature where a boolean number could be passed instead.
|
||||
v |= 0x12340000;
|
||||
}
|
||||
if (args[i] == TypeBool) v = !!v;
|
||||
params.Push(v);
|
||||
|
|
@ -1403,16 +1429,29 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc)
|
|||
}
|
||||
else if (args[i]->isIntCompatible())
|
||||
{
|
||||
char* endp;
|
||||
int v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
int v;
|
||||
|
||||
if (sc.Compare("true"))
|
||||
{
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
v = 1;
|
||||
}
|
||||
else if (sc.Compare("false"))
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char* endp;
|
||||
v = (int)strtoll(sc.String, &endp, 0);
|
||||
if (*endp != 0)
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
// special check for font color ranges.
|
||||
v = V_FindFontColor(sc.String);
|
||||
if (v == CR_UNTRANSLATED && !sc.Compare("untranslated"))
|
||||
{
|
||||
// todo: check other data types that may get used.
|
||||
sc.ScriptError("Integer expected, got %s", sc.String);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args[i] == TypeBool) v = !!v;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue