Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

No longer save default map, max players and map hash. Patch originall…

…y by vexed. Closes ticket:3618
  • Loading branch information...
commit 398f77ede082063bd1bc607d5814e9630f663967 1 parent 2c28226
Per Inge Mathisen authored August 02, 2012
1  ChangeLog
@@ -2,6 +2,7 @@
2 2
  * General:
3 3
    * Change: Allow multiple AIs with similar names (commit:ee95d785bdfd72a490863d7cdb3f504f88f9eecd)
4 4
    * Change: Increase the maximum number of terrain tiles (commit:ab44eafb7bd1daa2d0f4efe367673b4c2985a05d)
  5
+   * Change: No longer save last map played (ticket:3618)
5 6
    * Fix: Saving the game might crash it (ticket:3620, commit:fdb1c0b52153d3368ae79e8f0befdd2744b43692)
6 7
    * Fix: Qt backend compatibility with Qt 4.8.2 (ticket:3562, commit:df32833ab8b17e6db5815b7eca9f5fe01a5b7f8f)
7 8
    * Fix: Scavengers in challenges were always disabled (ticket:3630, commit:95677b02b9959b05372e7dc10286fe184bfd6cdd)
40  src/configuration.cpp
@@ -95,19 +95,12 @@ bool loadConfig()
95 95
 	war_setMPcolour(ini.value("colourMP", -1).toInt());  // default is random (-1)
96 96
 	sstrcpy(game.name, ini.value("gameName", _("My Game")).toString().toUtf8().constData());
97 97
 	sstrcpy(sPlayer, ini.value("playerName", _("Player")).toString().toUtf8().constData());
98  
-	if (ini.contains("mapName") && ini.contains("maxPlayers"))
99  
-	{
100  
-		sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
101  
-		game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
102  
-		game.maxPlayers = ini.value("maxPlayers").toInt();	// FIXME: horrible kluge, MUST match map above
103  
-	}
104  
-	else
105  
-	{
106  
-		// Set a default map to prevent hosting games without a map.
107  
-		sstrcpy(game.map, "Sk-Rush");
108  
-		game.hash.setZero();
109  
-		game.maxPlayers = 4;
110  
-	}
  98
+
  99
+	// Set a default map to prevent hosting games without a map.
  100
+	sstrcpy(game.map, "Sk-Rush");
  101
+	game.hash.setZero();
  102
+	game.maxPlayers = 4;
  103
+
111 104
 	game.power = ini.value("power", LEV_MED).toInt();
112 105
 	game.base = ini.value("base", CAMP_BASE).toInt();
113 106
 	game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
@@ -268,9 +261,12 @@ bool reloadMPConfig(void)
268 261
 				sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
269 262
 			}
270 263
 		}
271  
-		ini.setValue("mapName", game.map);				//  map name
272  
-		ini.setValue("mapHash", game.hash.toString().c_str());          //  map hash
273  
-		ini.setValue("maxPlayers", game.maxPlayers);		// maxPlayers
  264
+
  265
+		// Set a default map to prevent hosting games without a map.
  266
+		sstrcpy(game.map, "Sk-Rush");
  267
+		game.hash.setZero();
  268
+		game.maxPlayers = 4;
  269
+
274 270
 		ini.setValue("power", game.power);				// power
275 271
 		ini.setValue("base", game.base);				// size of base
276 272
 		ini.setValue("alliance", game.alliance);		// allow alliances
@@ -284,12 +280,12 @@ bool reloadMPConfig(void)
284 280
 	{
285 281
 		sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
286 282
 	}
287  
-	if (ini.contains("mapName") && ini.contains("maxPlayers"))
288  
-	{
289  
-		sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
290  
-		game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
291  
-		game.maxPlayers = ini.value("maxPlayers").toInt();	// FIXME: horrible kluge, MUST match map above
292  
-	}
  283
+
  284
+	// Set a default map to prevent hosting games without a map.
  285
+	sstrcpy(game.map, "Sk-Rush");
  286
+	game.hash.setZero();
  287
+	game.maxPlayers = 4;
  288
+
293 289
 	game.power = ini.value("power", LEV_MED).toInt();
294 290
 	game.base = ini.value("base", CAMP_BASE).toInt();
295 291
 	game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
1  src/frontend.cpp
@@ -300,6 +300,7 @@ static void SPinit(void)
300 300
 		playercolor = 0;	// default is green
301 301
 	}
302 302
 	setPlayerColour(0, playercolor);
  303
+	game.hash.setZero();	// must reset this to zero
303 304
 }
304 305
 
305 306
 bool runSinglePlayerMenu(void)

0 notes on commit 398f77e

Please sign in to comment.
Something went wrong with that request. Please try again.