Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@perim perim authored
Showing with 20 additions and 22 deletions.
  1. +1 −0  ChangeLog
  2. +18 −22 src/configuration.cpp
  3. +1 −0  src/frontend.cpp
View
1  ChangeLog
@@ -2,6 +2,7 @@
* General:
* Change: Allow multiple AIs with similar names (commit:ee95d785bdfd72a490863d7cdb3f504f88f9eecd)
* Change: Increase the maximum number of terrain tiles (commit:ab44eafb7bd1daa2d0f4efe367673b4c2985a05d)
+ * Change: No longer save last map played (ticket:3618)
* Fix: Saving the game might crash it (ticket:3620, commit:fdb1c0b52153d3368ae79e8f0befdd2744b43692)
* Fix: Qt backend compatibility with Qt 4.8.2 (ticket:3562, commit:df32833ab8b17e6db5815b7eca9f5fe01a5b7f8f)
* Fix: Scavengers in challenges were always disabled (ticket:3630, commit:95677b02b9959b05372e7dc10286fe184bfd6cdd)
View
40 src/configuration.cpp
@@ -95,19 +95,12 @@ bool loadConfig()
war_setMPcolour(ini.value("colourMP", -1).toInt()); // default is random (-1)
sstrcpy(game.name, ini.value("gameName", _("My Game")).toString().toUtf8().constData());
sstrcpy(sPlayer, ini.value("playerName", _("Player")).toString().toUtf8().constData());
- if (ini.contains("mapName") && ini.contains("maxPlayers"))
- {
- sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
- game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
- game.maxPlayers = ini.value("maxPlayers").toInt(); // FIXME: horrible kluge, MUST match map above
- }
- else
- {
- // Set a default map to prevent hosting games without a map.
- sstrcpy(game.map, "Sk-Rush");
- game.hash.setZero();
- game.maxPlayers = 4;
- }
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
game.power = ini.value("power", LEV_MED).toInt();
game.base = ini.value("base", CAMP_BASE).toInt();
game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
@@ -268,9 +261,12 @@ bool reloadMPConfig(void)
sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
}
}
- ini.setValue("mapName", game.map); // map name
- ini.setValue("mapHash", game.hash.toString().c_str()); // map hash
- ini.setValue("maxPlayers", game.maxPlayers); // maxPlayers
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
ini.setValue("power", game.power); // power
ini.setValue("base", game.base); // size of base
ini.setValue("alliance", game.alliance); // allow alliances
@@ -284,12 +280,12 @@ bool reloadMPConfig(void)
{
sstrcpy(game.name, ini.value("gameName").toString().toUtf8().constData());
}
- if (ini.contains("mapName") && ini.contains("maxPlayers"))
- {
- sstrcpy(game.map, ini.value("mapName").toString().toUtf8().constData());
- game.hash.fromString(ini.value("mapHash").toString().toUtf8().constData());
- game.maxPlayers = ini.value("maxPlayers").toInt(); // FIXME: horrible kluge, MUST match map above
- }
+
+ // Set a default map to prevent hosting games without a map.
+ sstrcpy(game.map, "Sk-Rush");
+ game.hash.setZero();
+ game.maxPlayers = 4;
+
game.power = ini.value("power", LEV_MED).toInt();
game.base = ini.value("base", CAMP_BASE).toInt();
game.alliance = ini.value("alliance", NO_ALLIANCES).toInt();
View
1  src/frontend.cpp
@@ -300,6 +300,7 @@ static void SPinit(void)
playercolor = 0; // default is green
}
setPlayerColour(0, playercolor);
+ game.hash.setZero(); // must reset this to zero
}
bool runSinglePlayerMenu(void)
Please sign in to comment.
Something went wrong with that request. Please try again.