Add INotifyOwnerChanged interface

This commit is contained in:
Paul Chote
2013-02-25 21:37:52 +13:00
parent 82426e0e45
commit dddec1ec61
2 changed files with 6 additions and 0 deletions

View File

@@ -254,10 +254,15 @@ namespace OpenRA
{
World.AddFrameEndTask(w =>
{
var oldOwner = Owner;
// momentarily remove from world so the ownership queries don't get confused
w.Remove(this);
Owner = newOwner;
w.Add(this);
foreach (var t in this.TraitsImplementing<INotifyOwnerChanged>())
t.OnOwnerChanged(this, oldOwner, newOwner);
});
}
}