use unsynced rng for unit traits
this has 2 reasons: 1) In the 'unit::unit(const unit_type& u_type ..' ctor the facting is usually overwritten after the unit is constructed (at least the normal unit recruit code does that) so calling the synced rng there has no other effect than blocking undoing (in case that the unit has no traits, otherwise undoing would already be imposible because of trait generation) 2) in the 'unit::unit(const config& cfg ...' ctor it might make sense to use the synced rng, but since iirc the facing attribute is already unsynced since it changed by the drawing code (which might be skipped if animations are disabled) we also use the unsyced rng here to not block undoing (in that rare case).
This commit is contained in:
parent
4e79aedb8d
commit
3763f5a759
1 changed files with 2 additions and 2 deletions
|
@ -437,7 +437,7 @@ unit::unit(const config& cfg, bool use_traits, const vconfig* vcfg)
|
|||
|
||||
random_traits_ = cfg["random_traits"].to_bool(true);
|
||||
facing_ = map_location::parse_direction(cfg["facing"]);
|
||||
if(facing_ == map_location::NDIRECTIONS) facing_ = static_cast<map_location::DIRECTION>(randomness::generator->get_random_int(0, map_location::NDIRECTIONS-1));
|
||||
if(facing_ == map_location::NDIRECTIONS) facing_ = static_cast<map_location::DIRECTION>(randomness::rng::default_instance().get_random_int(0, map_location::NDIRECTIONS-1));
|
||||
|
||||
if(const config& mods = cfg.child("modifications")) {
|
||||
modifications_ = mods;
|
||||
|
@ -668,7 +668,7 @@ unit::unit(const unit_type& u_type, int side, bool real_unit, unit_race::GENDER
|
|||
, overlays_()
|
||||
, role_()
|
||||
, attacks_()
|
||||
, facing_(static_cast<map_location::DIRECTION>(randomness::generator->get_random_int(0, map_location::NDIRECTIONS-1)))
|
||||
, facing_(static_cast<map_location::DIRECTION>(randomness::rng::default_instance().get_random_int(0, map_location::NDIRECTIONS-1)))
|
||||
, trait_names_()
|
||||
, trait_descriptions_()
|
||||
, unit_value_()
|
||||
|
|
Loading…
Add table
Reference in a new issue