Skip to content

Commit

Permalink
Move modInfo.selectableKilled check after other eventclient calls, an…
Browse files Browse the repository at this point in the history
…d include remove from groups into that.
  • Loading branch information
saurtron committed Dec 22, 2024
1 parent a2552c8 commit 22861b7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rts/Sim/Units/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,19 +480,18 @@ void CUnit::ForcedKillUnit(CUnit* attacker, bool selfDestruct, bool reclaimed, i
// release attached units
ReleaseTransportees(attacker, selfDestruct, reclaimed);

// pre-destruction event; unit may be kept around for its death sequence
eventHandler.UnitDestroyed(this, attacker, weaponDefID);
eoh->UnitDestroyed(*this, attacker, weaponDefID);

// release from selection
if (!modInfo.selectableKilled) {
noSelect = true;
if (isSelected)
selectedUnitsHandler.RemoveUnit(this);
}

// pre-destruction event; unit may be kept around for its death sequence
eventHandler.UnitDestroyed(this, attacker, weaponDefID);
eoh->UnitDestroyed(*this, attacker, weaponDefID);

// Will be called in the destructor again, but this can not hurt
SetGroup(nullptr);
SetGroup(nullptr);
}

if (unitDef->windGenerator > 0.0f)
envResHandler.DelGenerator(this);
Expand Down

0 comments on commit 22861b7

Please sign in to comment.