mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
New command "qstrcmp"
qstrcmp <quote1> <quote2> <var> Compare two quotes. <var> returns zero if they are identical, -1 if the first quote comes first in alphabetical order, 1 if it comes later. Note that the lexicographical order is rudimentary, for example "Player 2" is considered greater than "Player 10". Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6609 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
97fd71c3db
commit
1cbf5e36e1
3 changed files with 21 additions and 0 deletions
|
@ -382,6 +382,7 @@ static tokenmap_t const vm_keywords[] =
|
||||||
{ "qspawnvar", CON_QSPAWNVAR },
|
{ "qspawnvar", CON_QSPAWNVAR },
|
||||||
{ "qsprintf", CON_QSPRINTF },
|
{ "qsprintf", CON_QSPRINTF },
|
||||||
{ "qstrcat", CON_QSTRCAT },
|
{ "qstrcat", CON_QSTRCAT },
|
||||||
|
{ "qstrcmp", CON_QSTRCMP },
|
||||||
{ "qstrcpy", CON_QSTRCPY },
|
{ "qstrcpy", CON_QSTRCPY },
|
||||||
{ "qstrdim", CON_QSTRDIM },
|
{ "qstrdim", CON_QSTRDIM },
|
||||||
{ "qstrlen", CON_QSTRLEN },
|
{ "qstrlen", CON_QSTRLEN },
|
||||||
|
@ -4778,6 +4779,7 @@ DO_DEFSTATE:
|
||||||
|
|
||||||
case CON_CANSEESPR:
|
case CON_CANSEESPR:
|
||||||
case CON_UPDATESECTOR:
|
case CON_UPDATESECTOR:
|
||||||
|
case CON_QSTRCMP:
|
||||||
C_GetManyVars(2);
|
C_GetManyVars(2);
|
||||||
C_GetNextVarType(GAMEVAR_READONLY);
|
C_GetNextVarType(GAMEVAR_READONLY);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1168,6 +1168,7 @@ enum ScriptKeywords_t
|
||||||
CON_ACTORSOUND, // 408
|
CON_ACTORSOUND, // 408
|
||||||
CON_STARTSCREEN, // 409
|
CON_STARTSCREEN, // 409
|
||||||
CON_SCREENPAL, // 410
|
CON_SCREENPAL, // 410
|
||||||
|
CON_QSTRCMP, // 411
|
||||||
CON_END
|
CON_END
|
||||||
};
|
};
|
||||||
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
||||||
|
|
|
@ -2245,6 +2245,24 @@ skip_check:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CON_QSTRCMP:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int const quote1 = Gv_GetVarX(*insptr++);
|
||||||
|
int const quote2 = Gv_GetVarX(*insptr++);
|
||||||
|
int const gameVar = *insptr++;
|
||||||
|
|
||||||
|
if (EDUKE32_PREDICT_FALSE(apStrings[quote1] == NULL || apStrings[quote2] == NULL))
|
||||||
|
{
|
||||||
|
CON_ERRPRINTF("null quote %d\n", apStrings[quote1] ? quote2 : quote1);
|
||||||
|
Gv_SetVarX(gameVar, -2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gv_SetVarX(gameVar, strcmp(apStrings[quote1], apStrings[quote2]));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
case CON_GETPNAME:
|
case CON_GETPNAME:
|
||||||
case CON_QSTRNCAT:
|
case CON_QSTRNCAT:
|
||||||
case CON_QSTRCAT:
|
case CON_QSTRCAT:
|
||||||
|
|
Loading…
Reference in a new issue