CON: Add undefinecheat.

git-svn-id: https://svn.eduke32.com/eduke32@6679 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-02-20 11:55:20 +00:00
parent 5bd6f6e28f
commit 7a30b3452f
2 changed files with 21 additions and 0 deletions

View file

@ -505,6 +505,7 @@ static tokenmap_t const vm_keywords[] =
{ "time", CON_TIME },
{ "tip", CON_TIP },
{ "tossweapon", CON_TOSSWEAPON },
{ "undefinecheat", CON_UNDEFINECHEAT },
{ "undefinegamefunc", CON_UNDEFINEGAMEFUNC },
{ "undefinelevel", CON_UNDEFINELEVEL },
{ "undefineskill", CON_UNDEFINESKILL },
@ -583,6 +584,7 @@ static tokenmap_t const vm_keywords[] =
{ "print", CON_QUOTE },
{ "dc", CON_DEFINECHEAT },
{ "udc", CON_UNDEFINECHEAT },
{ "ck", CON_CHEATKEYS },
{ "qputs", CON_REDEFINEQUOTE },
@ -5898,6 +5900,24 @@ repeatcase:
g_scriptPtr -= 2;
continue;
case CON_UNDEFINECHEAT:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
j = *g_scriptPtr;
if (EDUKE32_PREDICT_FALSE((unsigned)j >= NUMCHEATS))
{
initprintf("%s:%d: error: cheat undefinition attempts to undefine nonexistent cheat.\n",g_scriptFileName,g_lineNumber);
g_errorCnt++;
C_NextLine();
continue;
}
CheatStrings[j][0] = '\0';
continue;
case CON_DEFINECHEAT:
g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE);

View file

@ -1222,6 +1222,7 @@ enum ScriptKeywords_t
CON_IFVARVARB, // 421
CON_IFVARBE, // 422
CON_IFVARVARBE, // 423
CON_UNDEFINECHEAT, // 424
CON_END
};
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua