CON_SETCFGNAME: sets the name of the cfg during CON compile if a cfg wasn't specified on the command line

git-svn-id: https://svn.eduke32.com/eduke32@986 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-17 09:57:36 +00:00
parent 81d0ea972d
commit 63e5850a86
2 changed files with 30 additions and 0 deletions

View file

@ -470,6 +470,7 @@ const char *keyw[] =
"activatecheat", // 333 "activatecheat", // 333
"setgamepalette", // 334 "setgamepalette", // 334
"setdefname", // 335 "setdefname", // 335
"setcfgname", // 336
"<null>" "<null>"
}; };
@ -4602,6 +4603,34 @@ repeatcase:
} }
return 0; return 0;
case CON_SETCFGNAME:
{
scriptptr--;
while (isaltok(*textptr) == 0)
{
if (*textptr == 0x0a) line_number++;
textptr++;
if (*textptr == 0) break;
}
j = 0;
while (isaltok(*textptr))
{
tempbuf[j] = *(textptr++);
j++;
}
tempbuf[j] = '\0';
if (Bstrcmp(setupfilename,"duke3d.cfg") == 0) // not set to something else via -cfg
{
char temp[BMAX_PATH];
Bstrcpy(temp,tempbuf);
CONFIG_WriteSetup();
Bstrcpy(setupfilename,temp);
CONFIG_ReadSetup();
}
initprintf("Using config file '%s'.\n",setupfilename);
}
return 0;
case CON_DEFINEGAMETYPE: case CON_DEFINEGAMETYPE:
scriptptr--; scriptptr--;
transnum(LABEL_DEFINE); transnum(LABEL_DEFINE);

View file

@ -846,4 +846,5 @@ enum keywords
CON_ACTIVATECHEAT, // 333 CON_ACTIVATECHEAT, // 333
CON_SETGAMEPALETTE, // 334 CON_SETGAMEPALETTE, // 334
CON_SETDEFNAME, // 335 CON_SETDEFNAME, // 335
CON_SETCFGNAME, // 336
}; };