Avoid triggering an assertion when a duplicated side definition exists

(bug #7252).
This commit is contained in:
Mark de Wever 2008-01-01 19:54:07 +00:00
parent 4e5b76ccaf
commit 35d122f02d
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,8 @@ Version 1.3.13+svn:
* WML engine:
* Fixed a problem where two [recall]s in a SP game could get an out of sync
recruitment
* avoid triggering an assertion when a duplicated side definition exists
(bug #7252)
* miscellaneous and bug fixes:
* when loading a unit some traits didn't get applied correctly but got
fixed in a later state. This could lead to some units not leveling

View file

@ -23,8 +23,10 @@
#include "game_errors.hpp"
#include "game_preferences.hpp"
#include "gamestatus.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "team.hpp"
#include "wml_exception.hpp"
#define LOG_NG LOG_STREAM(info, engine)
#define ERR_NG LOG_STREAM(err, engine)
@ -148,6 +150,11 @@ void get_player_info(const config& cfg, game_state& gamestate,
lexical_cast<std::string>(side) + ".");
}
utils::string_map symbols;
symbols["side"] = lexical_cast<std::string>(side);
VALIDATE(units.count(start_pos) == 0,
t_string(vgettext("Duplicate side definition for side '$side|' found.", symbols)));
new_unit.new_turn();
units.add(new std::pair<gamemap::location,unit>(map.starting_position(new_unit.side()), new_unit));
LOG_NG << "initializing side '" << cfg["side"] << "' at "