Fix two harmless warnings and reindent one switch block.

Also, make G_LoadAddon() local to game.c.

git-svn-id: https://svn.eduke32.com/eduke32@3711 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-25 21:10:25 +00:00
parent a628cbdd13
commit 3e9b1be6fb
2 changed files with 75 additions and 76 deletions

View file

@ -10146,7 +10146,7 @@ void G_MaybeAllocPlayer(int32_t pnum)
#endif #endif
} }
void G_LoadAddon(void) static void G_LoadAddon(void)
{ {
struct grpfile * grp; struct grpfile * grp;
int32_t crc = 0; // compiler-happy int32_t crc = 0; // compiler-happy
@ -10170,7 +10170,6 @@ void G_LoadAddon(void)
if (grp && FindGroup(DUKE15_CRC)) if (grp && FindGroup(DUKE15_CRC))
{ {
int32_t i;
struct grpfile *grp; struct grpfile *grp;
clearGrpNamePtr(); clearGrpNamePtr();

View file

@ -71,93 +71,93 @@ static void LoadList(const char * filename)
scriptfile_addsymbolvalue("DUKECB_CRC", DUKECB_CRC); scriptfile_addsymbolvalue("DUKECB_CRC", DUKECB_CRC);
scriptfile_addsymbolvalue("DUKENW_CRC", DUKENW_CRC); scriptfile_addsymbolvalue("DUKENW_CRC", DUKENW_CRC);
enum
{
T_GRPINFO,
T_GAMENAME,
T_CRC,
T_SIZE,
T_DEPCRC,
T_SCRIPTNAME,
T_DEFNAME,
T_FLAGS,
};
static const tokenlist profiletokens[] =
{
{ "grpinfo", T_GRPINFO },
};
while (!scriptfile_eof(script)) while (!scriptfile_eof(script))
{ {
enum
{
T_GRPINFO,
T_GAMENAME,
T_CRC,
T_SIZE,
T_DEPCRC,
T_SCRIPTNAME,
T_DEFNAME,
T_FLAGS,
};
static const tokenlist profiletokens[] =
{
{ "grpinfo", T_GRPINFO },
};
int32_t token = getatoken(script,profiletokens,sizeof(profiletokens)/sizeof(tokenlist)); int32_t token = getatoken(script,profiletokens,sizeof(profiletokens)/sizeof(tokenlist));
switch (token) switch (token)
{ {
case T_GRPINFO: case T_GRPINFO:
{
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
char *gname = NULL, *gscript = NULL, *gdef = NULL;
static const tokenlist grpinfotokens[] =
{ {
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC; { "name", T_GAMENAME },
char *gname = NULL, *gscript = NULL, *gdef = NULL; { "scriptname", T_SCRIPTNAME },
{ "defname", T_DEFNAME },
{ "crc", T_CRC },
{ "dependency", T_DEPCRC },
{ "size", T_SIZE },
{ "flags", T_FLAGS },
static const tokenlist grpinfotokens[] = };
if (scriptfile_getbraces(script,&grpend)) break;
while (script->textptr < grpend)
{
int32_t token = getatoken(script,grpinfotokens,sizeof(grpinfotokens)/sizeof(tokenlist));
switch (token)
{ {
{ "name", T_GAMENAME }, case T_GAMENAME:
{ "scriptname", T_SCRIPTNAME }, scriptfile_getstring(script,&gname); break;
{ "defname", T_DEFNAME }, case T_SCRIPTNAME:
{ "crc", T_CRC }, scriptfile_getstring(script,&gscript); break;
{ "dependency", T_DEPCRC }, case T_DEFNAME:
{ "size", T_SIZE }, scriptfile_getstring(script,&gdef); break;
{ "flags", T_FLAGS },
}; case T_FLAGS:
scriptfile_getsymbol(script,&gflags); break;
if (scriptfile_getbraces(script,&grpend)) break; case T_DEPCRC:
scriptfile_getsymbol(script,&gdepcrc); break;
while (script->textptr < grpend) case T_CRC:
{ scriptfile_getsymbol(script,&gcrcval); break;
int32_t token = getatoken(script,grpinfotokens,sizeof(grpinfotokens)/sizeof(tokenlist)); case T_SIZE:
scriptfile_getnumber(script,&gsize); break;
switch (token) default:
{ break;
case T_GAMENAME:
scriptfile_getstring(script,&gname); break;
case T_SCRIPTNAME:
scriptfile_getstring(script,&gscript); break;
case T_DEFNAME:
scriptfile_getstring(script,&gdef); break;
case T_FLAGS:
scriptfile_getsymbol(script,&gflags); break;
case T_DEPCRC:
scriptfile_getsymbol(script,&gdepcrc); break;
case T_CRC:
scriptfile_getsymbol(script,&gcrcval); break;
case T_SIZE:
scriptfile_getnumber(script,&gsize); break;
default:
break;
}
fg = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile));
fg->next = listgrps;
listgrps = fg;
if (gname)
fg->name = Bstrdup(gname);
fg->size = gsize;
fg->crcval = gcrcval;
fg->dependency = gdepcrc;
fg->game = gflags;
if (gscript)
fg->scriptname = dup_filename(gscript);
if (gdef)
fg->defname = dup_filename(gdef);
} }
}
fg = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile));
fg->next = listgrps;
listgrps = fg;
if (gname)
fg->name = Bstrdup(gname);
fg->size = gsize;
fg->crcval = gcrcval;
fg->dependency = gdepcrc;
fg->game = gflags;
if (gscript)
fg->scriptname = dup_filename(gscript);
if (gdef)
fg->defname = dup_filename(gdef);
}
break; break;
}
default: default:
break; break;
} }