Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui2/unit_create: Address issue with variation+gender previews
Instead of generating the unit preview from the gender variation attached to the unit type variation, we need to generate it from the unit type variation attached to the gender variation. I know this sounds really crazy, but it matches the behaviour in unit::advance_to(): // Adjust the new type for gender and variation. const unit_type& new_type = u_type.get_gender_unit_type(gender_).get_variation(variation_); This behaviour is also relied upon by at least one pre-existing add-on (After the Storm Episode 3, Demon Shapeshifter unit type). Without this patch, the preview display doesn't reflect gender variations at all when a non-default variation is selected. As a side-note, the fix also makes the logic in unit_create::update_displayed_type() simpler since we don't need to verify if the variation exists at all -- if it doesn't we just get the parent unit type back.
- Loading branch information