fix mapname autocompletion

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4067 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-12-26 12:59:58 +00:00
parent 77a2abc834
commit a415196823
3 changed files with 22 additions and 11 deletions
+7 -8
View File
@@ -268,16 +268,15 @@ int numspawn[3], maploaded = 0, numflagspawn[2];
bool load_world(char *mname) // still supports all map formats that have existed since the earliest cube betas!
{
int loadmillis = SDL_GetTicks();
bool isofficial = true;
setnames(mname);
maploaded = getfilesize(ocgzname);
gzFile f = opengzfile(ocgzname, "rb9");
if(!f)
if(maploaded > 0)
{
maploaded = getfilesize(cgzname);
f = opengzfile(cgzname, "rb9");
isofficial = false;
s_strcpy(cgzname, ocgzname);
s_strcpy(mcfname, omcfname);
}
else maploaded = getfilesize(cgzname);
gzFile f = opengzfile(cgzname, "rb9");
if(!f) { conoutf("\f3could not read map %s", cgzname); return false; }
header tmp;
memset(&tmp, 0, sizeof(header));
@@ -411,14 +410,14 @@ bool load_world(char *mname) // still supports all map formats that have
if(f) gzclose(f);
c2skeepalive();
calclight();
conoutf("read map %s (%d milliseconds)", isofficial ? ocgzname : cgzname, SDL_GetTicks()-loadmillis);
conoutf("read map %s (%d milliseconds)", cgzname, SDL_GetTicks()-loadmillis);
conoutf("%s", hdr.maptitle);
pushscontext(IEXC_MAPCFG); // untrusted altogether
persistidents = false;
execfile("config/default_map_settings.cfg");
execfile(pcfname);
execfile(isofficial ? omcfname : mcfname);
execfile(mcfname);
persistidents = true;
popscontext();