r1760 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Jul 18 08:56:03 EDT 2006
Author: div0
Date: 2006-07-18 08:56:03 -0400 (Tue, 18 Jul 2006)
New Revision: 1760
Modified:
trunk/data/qcsrc/server/g_world.qc
Log:
fix for "winning" message in draw games
added support for dm_mapname.sizes files (first line: min players, second line: max players, untested)
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2006-07-14 21:39:26 UTC (rev 1759)
+++ trunk/data/qcsrc/server/g_world.qc 2006-07-18 12:56:03 UTC (rev 1760)
@@ -416,6 +416,25 @@
return cvar("g_maplist_index");
}
+float MapHasRightSize(string map)
+{
+ // open map size restriction file
+ float fh;
+ fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ);
+ if(fh >= 0)
+ {
+ float mapmin, mapmax;
+ mapmin = stof(fgets(fh));
+ mapmax = stof(fgets(fh));
+ fclose(fh);
+ if(player_count < mapmin)
+ return FALSE;
+ if(player_count > mapmax)
+ return FALSE;
+ }
+ return TRUE;
+}
+
void() GotoNextMap =
{
//local string nextmap;
@@ -463,6 +482,8 @@
local float lOldCurrent;
local float lBeforeCurrent;
local float pass;
+ local float found_but_wrong_size;
+ found_but_wrong_size = FALSE;
if(TryFile(strcat("maps/", cvar_string("nextmap"), ".mapcfg")))
{
@@ -511,7 +532,7 @@
}
if( lOldCurrent == lCurrent ) {
// we couldn't find a valid map at all
- if (pass == 1)
+ if (pass == 1 && !found_but_wrong_size)
{
bprint( "Maplist is bad/messed up. Not one good mapcfg can be found in it! Resetting it to default map list.\n" );
cvar_set("g_maplist", cvar_string("g_maplist_defaultlist"));
@@ -527,14 +548,21 @@
cvar_set( "g_maplist_index", ftos( lCurrent ) );
- lFilename = strcat( "maps/", argv( lCurrent ), ".mapcfg" );
+ lFilename = strzone(strcat( "maps/", argv( lCurrent ), ".mapcfg" ));
if( TryFile( lFilename ) ) {
- localcmd(strcat("exec \"", lFilename ,"\"\n"));
- pass = 2; // exit the outer loop
- break;
+ if((pass == 2) || MapHasRightSize(argv(lCurrent)))
+ {
+ localcmd(strcat("exec \"", lFilename ,"\"\n"));
+ strunzone(lFilename);
+ pass = 2; // exit the outer loop
+ break;
+ }
+ else
+ found_but_wrong_size = TRUE;
} else {
dprint( "Couldn't find '", lFilename, "'..\n" );
}
+ strunzone(lFilename);
//changelevel( argv( lCurrent ) );
}
strunzone(temp);
@@ -1239,7 +1267,10 @@
if(checkrules_overtimeend)
if(status != WINNING_NEVER)
+ {
+ ClearWinners();
status = WINNING_YES;
+ }
if(status == WINNING_YES)
NextLevel();
More information about the nexuiz-commits
mailing list