don't pass world to Widget.Tick, either

This commit is contained in:
Bob
2010-10-11 20:21:15 +13:00
parent e0afc08e5f
commit 0873741983
9 changed files with 16 additions and 17 deletions

View File

@@ -112,7 +112,7 @@ namespace OpenRA
using (new PerfSample("tick_time"))
{
lastTime += Settings.Game.Timestep;
Widget.DoTick(world);
Widget.DoTick();
if( world.GameHasStarted && world.LocalPlayer != null )
++Viewport.TicksSinceLastMove;
Sound.Tick();

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Widgets
recentLines = new List<ChatLine>();
}
public override void Tick (World world)
public override void Tick()
{
if (RemoveTime == 0) return;
if (--ticksUntilRemove > 0) return;

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Widgets
return EventBounds;
}
public override void Tick (World world)
public override void Tick ()
{
if (UpPressed && ListOffset <= 0) ListOffset += ScrollVelocity;
if (DownPressed) ListOffset -= ScrollVelocity;

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Widgets
GetBackground = other.GetBackground;
}
public override void Tick(World world)
public override void Tick()
{
if (Text != "")
{

View File

@@ -97,14 +97,14 @@ namespace OpenRA.Widgets
int blinkCycle = 10;
bool showCursor = true;
public override void Tick(World world)
public override void Tick()
{
if (--blinkCycle <= 0)
{
blinkCycle = 20;
showCursor ^= true;
}
base.Tick(world);
base.Tick();
}
public override void DrawInner()

View File

@@ -122,7 +122,7 @@ namespace OpenRA.Widgets
return false;
}
public override void Tick(World world)
public override void Tick()
{
Edge = ScrollDirection.None;
if (Game.Settings.Game.ViewportEdgeScroll && Game.HasInputFocus)

View File

@@ -281,11 +281,11 @@ namespace OpenRA.Widgets
}
}
public virtual void Tick(World world)
public virtual void Tick()
{
if (IsVisible())
foreach (var child in Children)
child.Tick(world);
child.Tick();
}
public void AddChild(Widget child)
@@ -335,9 +335,9 @@ namespace OpenRA.Widgets
return window;
}
public static void DoTick(World world)
public static void DoTick()
{
RootWidget.Tick(world);
RootWidget.Tick();
}
public static void DoDraw()

View File

@@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Widgets
get { return new Rectangle((int)(paletteOrigin.X) - 24, (int)(paletteOrigin.Y), 215, 48 * numActualRows); }
}
public override void Tick(World world)
public override void Tick()
{
VisibleQueues.Clear();
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Widgets
TickPaletteAnimation(world);
base.Tick(world);
base.Tick();
}
void TickPaletteAnimation(World world)

View File

@@ -121,7 +121,7 @@ namespace OpenRA.Mods.RA.Widgets
public override void DrawInner()
{
if( world.LocalPlayer == null ) return;
if( world == null || world.LocalPlayer == null ) return;
radarCollection = "radar-" + world.LocalPlayer.Country.Race;
@@ -155,13 +155,12 @@ namespace OpenRA.Mods.RA.Widgets
Game.Renderer.DisableScissor();
}
}
}
int updateTicks = 0;
public override void Tick(World w)
public override void Tick()
{
var w = Game.world;
if( world != w )
SetWorld( w );