mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
M32Script: when failing to compile a state with a menu name, don't keep the
menu entry. git-svn-id: https://svn.eduke32.com/eduke32@2154 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
086dcf383d
commit
3aac0c1bd4
2 changed files with 15 additions and 5 deletions
|
@ -43,6 +43,7 @@ typedef struct
|
|||
{
|
||||
int32_t currentStateIdx;
|
||||
ofstype currentStateOfs; // the offset to the start of the currently parsed states' code
|
||||
char *curStateMenuName;
|
||||
int32_t currentEvent;
|
||||
ofstype parsingEventOfs;
|
||||
|
||||
|
@ -57,7 +58,7 @@ typedef struct
|
|||
} compilerstate_t;
|
||||
|
||||
static compilerstate_t cs;
|
||||
static compilerstate_t cs_default = {-1, -1, -1, -1, 0, 0, NULL, NULL, 0, 0, 0, 0};
|
||||
static compilerstate_t cs_default = {-1, -1, NULL, -1, -1, 0, 0, NULL, NULL, 0, 0, 0, 0};
|
||||
////// -------------------
|
||||
|
||||
instype *script = NULL;
|
||||
|
@ -1831,15 +1832,17 @@ static int32_t C_ParseCommand(void)
|
|||
statesinfo[j].numlocals = 0;
|
||||
Bsprintf(g_szCurrentBlockName, "%s", statesinfo[j].name);
|
||||
|
||||
if (cs.curStateMenuName)
|
||||
Bfree(cs.curStateMenuName);
|
||||
cs.curStateMenuName = NULL;
|
||||
|
||||
if (C_GetKeyword() < 0)
|
||||
{
|
||||
ofstype *oscriptptr = g_scriptPtr;
|
||||
|
||||
if (C_GetNextVarOrString() == 1) // inline string
|
||||
{
|
||||
const char *menufuncname = (const char *)(oscriptptr+1);
|
||||
registerMenuFunction(menufuncname, j);
|
||||
|
||||
cs.curStateMenuName = Bstrdup((const char *)(oscriptptr+1));
|
||||
g_scriptPtr = oscriptptr;
|
||||
}
|
||||
else
|
||||
|
@ -1969,6 +1972,13 @@ static int32_t C_ParseCommand(void)
|
|||
g_scriptPtr -= osize;
|
||||
}
|
||||
|
||||
if (cs.curStateMenuName)
|
||||
{
|
||||
registerMenuFunction(cs.curStateMenuName, j);
|
||||
Bfree(cs.curStateMenuName);
|
||||
cs.curStateMenuName = NULL;
|
||||
}
|
||||
|
||||
g_didDefineSomething = 1;
|
||||
|
||||
cs.currentStateOfs = -1;
|
||||
|
|
|
@ -3073,7 +3073,7 @@ dodefault:
|
|||
"Please e-mail the file mapster32.log along with every M32 file\n"
|
||||
"you're using and instructions how to reproduce this error to\n"
|
||||
"helixhorned@gmail.com.\n\n"
|
||||
"Thank you!");
|
||||
"Thank you!\n");
|
||||
vm.flags |= VMFLAG_ERROR;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue