Fixes issue with max / min player bug in host screen.

Basically, when you pick a 2/4/8p map, we didn't save that info along with the map.  This resulted in possibly starting 2/4/8p games with the wrong number of players set. (ie, 8p map with 4 players, or 2p map with 4 players)


Closes ticket #10  (I think it was 10--trac is down)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6734 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-02-28 02:04:09 +00:00
parent ca447ad076
commit f4fb5a269b
1 changed files with 21 additions and 5 deletions

View File

@ -439,6 +439,21 @@ BOOL loadConfig(void)
if(getWarzoneKeyString("mapName", sBuf))
{
sstrcpy(game.map, sBuf);
if (getWarzoneKeyNumeric("maxPlayers", &val))
{
game.maxPlayers = val;
}
else
{
debug(LOG_WARNING, "Invalid or not found maxPlayers parameter for map %s", game.map);
debug(LOG_WARNING, "Reseting map to default parameters.");
// we don't have maxPlayers set, so fall back to defaults.
game.maxPlayers = 4; //4 is for the DEFAULTMAPNAME map (rush)
sstrcpy(game.map, DEFAULTMAPNAME);
setWarzoneKeyString("mapName", game.map);
setWarzoneKeyNumeric("maxPlayers",game.maxPlayers);
}
}
else
{
@ -705,16 +720,17 @@ BOOL saveConfig(void)
debug( LOG_NEVER, "Writing multiplay prefs to registry\n" );
if(NetPlay.bHost && ingame.localJoiningInProgress)
{
setWarzoneKeyString("gameName", game.name); // last hosted game
setWarzoneKeyString("gameName", game.name); // last hosted game
}
setWarzoneKeyString("mapName", game.map); // map name
setWarzoneKeyNumeric("power", game.power); // power
setWarzoneKeyNumeric("maxPlayers",game.maxPlayers); // maxPlayers
setWarzoneKeyNumeric("power", game.power); // power
setWarzoneKeyNumeric("type", game.type); // game type
setWarzoneKeyNumeric("base", game.base); // size of base
setWarzoneKeyNumeric("fog", game.fog); // fog 'o war
setWarzoneKeyNumeric("alliance", game.alliance); // allow alliances
setWarzoneKeyNumeric("fog", game.fog); // fog 'o war
setWarzoneKeyNumeric("alliance", game.alliance); // allow alliances
setWarzoneKeyString("playerName",(char*)sPlayer); // player name
setWarzoneKeyString("phrase0", ingame.phrases[0]); // phrases
setWarzoneKeyString("phrase0", ingame.phrases[0]); // phrases
setWarzoneKeyString("phrase1", ingame.phrases[1]);
setWarzoneKeyString("phrase2", ingame.phrases[2]);
setWarzoneKeyString("phrase3", ingame.phrases[3]);