Re: [Warzone-dev] [BUG fix] Saves/loads max players correctly.

2009-02-27 Thread bugs buggy
On 5/14/08, Dennis Schridde  wrote:
> Am Mittwoch, 14. Mai 2008 06:00:56 schrieb bugs buggy:
>
> > Fixes the bug where we would save the map, but not max players, so you
>  > could have a 8p map with only 4p, or worse, a 2p map with 4p.
>
> This is for saving the map into the config, so on next start the same map will
>  be selected in the multiplayer options?
>
>
>  > Index: src/configuration.c
>  > ===
>  > --- src/configuration.c   (revision 5107)
>  > +++ src/configuration.c   (working copy)
>  > @@ -407,6 +407,21 @@
>  >   if(getWarzoneKeyString("mapName", sBuf))
>  >   {
>  >   sstrcpy(game.map, sBuf);
>  > + if (getWarzoneKeyNumeric("maxPlayers", &val))
>
> This queries the config, not the map, right?
>  I am a bit curious why not.
>
Patch back from the dead ;)

Better late than never?

We don't parse the map then.
Now, when player picks a map, and enters game, it will save last map
(as it did before), and this time, also save how many players map has.
(it didn't do this before).

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] [BUG fix] Saves/loads max players correctly.

2008-05-14 Thread Dennis Schridde
Am Mittwoch, 14. Mai 2008 06:00:56 schrieb bugs buggy:
> Fixes the bug where we would save the map, but not max players, so you
> could have a 8p map with only 4p, or worse, a 2p map with 4p.
This is for saving the map into the config, so on next start the same map will 
be selected in the multiplayer options?

> Index: src/configuration.c
> ===
> --- src/configuration.c   (revision 5107)
> +++ src/configuration.c   (working copy)
> @@ -407,6 +407,21 @@
>   if(getWarzoneKeyString("mapName", sBuf))
>   {
>   sstrcpy(game.map, sBuf);
> + if (getWarzoneKeyNumeric("maxPlayers", &val))
This queries the config, not the map, right?
I am a bit curious why not.

--Dennis


signature.asc
Description: This is a digitally signed message part.
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


[Warzone-dev] [BUG fix] Saves/loads max players correctly.

2008-05-13 Thread bugs buggy
Fixes the bug where we would save the map, but not max players, so you
could have a 8p map with only 4p, or worse, a 2p map with 4p.

Also fixes formatting of comments a bit.


Index: src/configuration.c
===
--- src/configuration.c (revision 5107)
+++ src/configuration.c (working copy)
@@ -407,6 +407,21 @@
if(getWarzoneKeyString("mapName", sBuf))
{
sstrcpy(game.map, sBuf);
+   if (getWarzoneKeyNumeric("maxPlayers", &val))
+   {
+   game.maxPlayers = val;
+   }
+   else
+   {
+   debug(LOG_ERROR,"Invalid or not found maxPlayers 
parameter for map
%s",game.map);
+   debug(LOG_ERROR,"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
{
@@ -658,20 +673,21 @@
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("phrase1", ingame.phrases[1]);
-   setWarzoneKeyString("phrase2", ingame.phrases[2]);
-   setWarzoneKeyString("phrase3", ingame.phrases[3]);
-   setWarzoneKeyString("phrase4", ingame.phrases[4]);
+   setWarzoneKeyString("phrase0", ingame.phrases[0]);  
// phrases
+   setWarzoneKeyString("phrase1", ingame.phrases[1]);  
// unused ?
+   setWarzoneKeyString("phrase2", ingame.phrases[2]);  
// unused ?
+   setWarzoneKeyString("phrase3", ingame.phrases[3]);  
// unused ?
+   setWarzoneKeyString("phrase4", ingame.phrases[4]);  
// unused ?
}

return closeWarzoneKey();

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev