Skip to content

Commit

Permalink
No longer save default map, max players and map hash. Patch originall…
Browse files Browse the repository at this point in the history
…y by vexed. Closes ticket:3618
  • Loading branch information
perim committed Aug 2, 2012
1 parent 2c28226 commit 398f77e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -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)
Expand Down
40 changes: 18 additions & 22 deletions src/configuration.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/frontend.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 398f77e

Please sign in to comment.