Fixed a bug with the validate_side(...) check in unit::unit(...).
The symptom was failure of any scenario to load which has a 'move_unit_fake' command in it. The check is now bypassed for "dummy" units.
This commit is contained in:
parent
96d6d04bf7
commit
373fd7b49e
3 changed files with 5 additions and 5 deletions
|
@ -421,7 +421,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
const std::string& type = cfg["type"];
|
||||
const game_data::unit_type_map::const_iterator itor = game_data_ptr->unit_types.find(type);
|
||||
if(itor != game_data_ptr->unit_types.end()) {
|
||||
unit dummy_unit(&itor->second,0);
|
||||
unit dummy_unit(&itor->second,0,false,true);
|
||||
const std::vector<std::string> xvals = config::split(cfg["x"]);
|
||||
const std::vector<std::string> yvals = config::split(cfg["y"]);
|
||||
std::vector<gamemap::location> path;
|
||||
|
|
|
@ -57,7 +57,7 @@ unit::unit(game_data& data, const config& cfg) : state_(STATE_NORMAL),
|
|||
}
|
||||
|
||||
//constructor for creating a new unit
|
||||
unit::unit(const unit_type* t, int side, bool use_traits) :
|
||||
unit::unit(const unit_type* t, int side, bool use_traits, bool dummy_unit) :
|
||||
type_(t), state_(STATE_NORMAL),
|
||||
hitpoints_(t->hitpoints()),
|
||||
maxHitpoints_(t->hitpoints()),
|
||||
|
@ -71,8 +71,8 @@ unit::unit(const unit_type* t, int side, bool use_traits) :
|
|||
backupAttacks_(t->attacks()),
|
||||
guardian_(false), upkeep_(UPKEEP_FULL_PRICE)
|
||||
{
|
||||
|
||||
validate_side(side_);
|
||||
//dummy units used by the 'move_unit_fake' command don't need to have a side.
|
||||
if(dummy_unit == false) validate_side(side_);
|
||||
|
||||
if(use_traits) {
|
||||
//units that don't have traits generated are just generic
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
friend struct unit_movement_resetter;
|
||||
|
||||
unit(game_data& data, const config& cfg);
|
||||
unit(const unit_type* t, int side, bool use_traits=false);
|
||||
unit(const unit_type* t, int side, bool use_traits=false, bool dummy_unit=false);
|
||||
|
||||
//a constructor used when advancing a unit
|
||||
unit(const unit_type* t, const unit& u);
|
||||
|
|
Loading…
Add table
Reference in a new issue