Fix a misleading error message, if map was empty...

...(random map genaration fail), we only give the proper warning when
placing leader not units (and so returned an "invalid position" in the
later case). Now directly abort if no map.  Thanks to mihoshi to have
provided a test case for this (patch #11380)
This commit is contained in:
Ali El Gariani 2008-03-26 22:07:27 +00:00
parent dd6c1ad37b
commit b011baced1

View file

@ -59,6 +59,10 @@ void get_player_info(const config& cfg, game_state& gamestate,
{
player_info *player = NULL;
if(map.empty()) {
throw game::load_game_failed("Map not found");
}
if(cfg["controller"] == "human" ||
cfg["controller"] == "network" ||
cfg["persistent"] == "1") {
@ -134,9 +138,6 @@ void get_player_info(const config& cfg, game_state& gamestate,
// Otherwise start it at the map-given starting position.
gamemap::location start_pos(cfg, &gamestate);
if(map.empty()) {
throw game::load_game_failed("Map not found");
}
if(cfg["x"].empty() && cfg["y"].empty()) {
start_pos = map.starting_position(side);
}