Fix unit_placed event when [unit] recalls a units.

[unit] tries to recalls a unit when there is a unit with a matching id in the sides recall list. In this case the code would previously remove the unit from the recall list after firing the unit_placed event, (so the during the unit_placed event the unit was on the recall list and on the map at the same time breaking some wml codes, in particular #7769)
This commit is contained in:
gfgtdf 2023-07-05 13:13:05 +02:00 committed by GitHub
parent b86b6efd0e
commit b50cf83f7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,9 +203,9 @@ void unit_creator::add_unit(const config &cfg, const vconfig* vcfg)
if ( loc.valid() ) {
board_->units().replace(loc, recall_list_element);
LOG_NG << "inserting unit from recall list for side " << recall_list_element->side()<< " with id="<< id;
post_create(loc,*(board_->units().find(loc)),animate,fire_event);
//if id is not empty, delete units with this ID from recall list
team_.recall_list().erase_if_matches_id( id);
post_create(loc,*(board_->units().find(loc)),animate,fire_event);
}
else if ( add_to_recall_ ) {
LOG_NG << "wanted to insert unit on recall list, but recall list for side " << (cfg)["side"] << "already contains id=" <<id;