Added BuildableItemsChanged event to tech tree.
This lets the Sidebar only repopulate its item list when the items that can be built changes.
This commit is contained in:
@@ -93,8 +93,16 @@ namespace OpenRa.TechTree
|
||||
|
||||
void CheckAll()
|
||||
{
|
||||
bool changed = false;
|
||||
foreach (Item unit in objects.Values)
|
||||
{
|
||||
bool old = unit.CanBuild;
|
||||
unit.CheckPrerequisites(built, currentRace);
|
||||
if (old != unit.CanBuild)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) BuildableItemsChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Item> BuildableItems
|
||||
@@ -106,5 +114,7 @@ namespace OpenRa.TechTree
|
||||
yield return b;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler BuildableItemsChanged = (sender, e) => { };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user