more chrome perf

This commit is contained in:
Chris Forbes
2010-02-01 19:22:12 +13:00
parent 57d9055aeb
commit 9efede94af
2 changed files with 16 additions and 9 deletions

View File

@@ -147,10 +147,22 @@ namespace OpenRa
colorBlock = SheetBuilder.Add(new Size(65 - 8, 22 - 8), 0x54);
}
public void Tick()
List<string> visibleTabs = new List<string>();
public void Tick(World world)
{
TickPaletteAnimation();
TickRadarAnimation();
if (currentTab == null || !Rules.TechTree.BuildableItems(world.LocalPlayer, currentTab).Any())
ChooseAvailableTab(world);
visibleTabs.Clear();
foreach (var q in tabImageNames)
if (!Rules.TechTree.BuildableItems(world.LocalPlayer, q.Key).Any())
CheckDeadTab(world, q.Key);
else
visibleTabs.Add(q.Key);
}
public void Draw( World world )
@@ -539,19 +551,14 @@ namespace OpenRa
var x = paletteOrigin.X - tabWidth;
var y = paletteOrigin.Y + 9;
if (currentTab == null || !Rules.TechTree.BuildableItems(world.LocalPlayer, currentTab).Any())
ChooseAvailableTab( world );
var queue = world.LocalPlayer.PlayerActor.traits.Get<Traits.ProductionQueue>();
foreach (var q in tabImageNames)
{
var groupName = q.Key;
if (!Rules.TechTree.BuildableItems(world.LocalPlayer, groupName).Any())
{
CheckDeadTab( world, groupName );
if (!visibleTabs.Contains(groupName))
continue;
}
string[] tabKeys = { "normal", "ready", "selected" };
var producing = queue.CurrentItem(groupName);
var index = q.Key == currentTab ? 2 : (producing != null && producing.Done) ? 1 : 0;

View File

@@ -136,7 +136,7 @@ namespace OpenRa
using (new PerfSample("tick_time"))
{
lastTime += Settings.Timestep;
chrome.Tick();
chrome.Tick( world );
orderManager.TickImmediate( world );