C-CON: Modify the parsing of definevolumename and defineskillname so that they only look for the text before a newline.

// valid
definevolumename 3     <text>

// invalid
definevolumename 3
<text>

git-svn-id: https://svn.eduke32.com/eduke32@5089 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-25 06:28:09 +00:00
parent 49c85f644d
commit a14109da20

View file

@ -1328,7 +1328,17 @@ static int32_t ispecial(const char c)
return 0; return 0;
} }
#define C_NextLine() while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++ static void C_NextLine(void)
{
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
textptr++;
}
static void C_SkipSpace(void)
{
while (*textptr == ' ' || *textptr == '\t')
textptr++;
}
static int32_t C_SkipComments(void) static int32_t C_SkipComments(void)
{ {
@ -5498,7 +5508,8 @@ repeatcase:
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; g_scriptPtr--;
j = *g_scriptPtr; j = *g_scriptPtr;
C_SkipComments();
C_SkipSpace();
if (EDUKE32_PREDICT_FALSE((unsigned)j > MAXVOLUMES-1)) if (EDUKE32_PREDICT_FALSE((unsigned)j > MAXVOLUMES-1))
{ {
@ -5553,7 +5564,8 @@ repeatcase:
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; g_scriptPtr--;
j = *g_scriptPtr; j = *g_scriptPtr;
C_SkipComments();
C_SkipSpace();
if (EDUKE32_PREDICT_FALSE((unsigned)j > NUMGAMEFUNCTIONS-1)) if (EDUKE32_PREDICT_FALSE((unsigned)j > NUMGAMEFUNCTIONS-1))
{ {
@ -5605,7 +5617,8 @@ repeatcase:
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; g_scriptPtr--;
j = *g_scriptPtr; j = *g_scriptPtr;
C_SkipComments();
C_SkipSpace();
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSKILLS)) if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSKILLS))
{ {
@ -5779,7 +5792,7 @@ repeatcase:
{ {
initprintf("%s:%d: error: level file name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH); initprintf("%s:%d: error: level file name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH);
g_numCompilerErrors++; g_numCompilerErrors++;
while (*textptr != ' ' && *textptr != '\t') textptr++; C_SkipSpace();
break; break;
} }
} }
@ -5801,7 +5814,7 @@ repeatcase:
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
textptr += 5; textptr += 5;
while (*textptr == ' ' || *textptr == '\t') textptr++; C_SkipSpace();
// cheap hack, 0.99 doesn't have the 3D Realms time // cheap hack, 0.99 doesn't have the 3D Realms time
if (*(textptr+2) == ':') if (*(textptr+2) == ':')
@ -5811,7 +5824,7 @@ repeatcase:
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
textptr += 5; textptr += 5;
while (*textptr == ' ' || *textptr == '\t') textptr++; C_SkipSpace();
} }
else if (g_scriptVersion == 10) g_scriptVersion = 9; else if (g_scriptVersion == 10) g_scriptVersion = 9;
@ -5870,8 +5883,7 @@ repeatcase:
i = 0; i = 0;
while (*textptr == ' ' || *textptr == '\t') C_SkipSpace();
textptr++;
if (tw == CON_REDEFINEQUOTE) if (tw == CON_REDEFINEQUOTE)
{ {
@ -5941,8 +5953,7 @@ repeatcase:
} }
g_scriptPtr--; g_scriptPtr--;
i = 0; i = 0;
while (*textptr == ' ' || *textptr == '\t') C_SkipSpace();
textptr++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ')
{ {
CheatStrings[k][i] = Btolower(*textptr); CheatStrings[k][i] = Btolower(*textptr);