From cb1deacbb2a66ccdab969cc7138cd4a85274a885 Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 11 Oct 2010 19:56:28 +1300 Subject: [PATCH] pass world into CheckSync. don't pass world into Widget.DrawInner --- OpenRA.Game/Graphics/Viewport.cs | 2 +- OpenRA.Game/Graphics/WorldRenderer.cs | 2 +- OpenRA.Game/Network/OrderManager.cs | 14 ++++----- OpenRA.Game/Network/SyncReport.cs | 10 +++---- OpenRA.Game/ShroudRenderer.cs | 10 +++---- OpenRA.Game/Widgets/BackgroundWidget.cs | 2 +- OpenRA.Game/Widgets/ButtonWidget.cs | 2 +- OpenRA.Game/Widgets/ChatDisplayWidget.cs | 2 +- OpenRA.Game/Widgets/ChatEntryWidget.cs | 2 +- OpenRA.Game/Widgets/CheckboxWidget.cs | 2 +- OpenRA.Game/Widgets/ColorBlockWidget.cs | 2 +- OpenRA.Game/Widgets/ImageWidget.cs | 2 +- OpenRA.Game/Widgets/LabelWidget.cs | 2 +- OpenRA.Game/Widgets/ListBoxWidget.cs | 6 ++-- OpenRA.Game/Widgets/MapPreviewWidget.cs | 2 +- OpenRA.Game/Widgets/PerfGraphWidget.cs | 2 +- OpenRA.Game/Widgets/ScrollingTextWidget.cs | 2 +- OpenRA.Game/Widgets/ShpImageWidget.cs | 2 +- OpenRA.Game/Widgets/SliderWidget.cs | 2 +- OpenRA.Game/Widgets/TextFieldWidget.cs | 2 +- OpenRA.Game/Widgets/TimerWidget.cs | 30 +++++++++---------- .../Widgets/ViewportScrollControllerWidget.cs | 2 +- OpenRA.Game/Widgets/VqaPlayerWidget.cs | 14 ++++----- OpenRA.Game/Widgets/Widget.cs | 14 ++++----- .../WorldInteractionControllerWidget.cs | 2 +- OpenRA.Game/Widgets/WorldTooltipWidget.cs | 3 +- OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs | 10 +++---- OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs | 3 +- OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs | 2 +- OpenRA.Mods.RA/Widgets/PowerBinWidget.cs | 3 +- OpenRA.Mods.RA/Widgets/RadarBinWidget.cs | 2 +- .../Widgets/SpecialPowerBinWidget.cs | 5 ++-- 32 files changed, 83 insertions(+), 79 deletions(-) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 48aa7efee2..bedf3b0ed5 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -100,7 +100,7 @@ namespace OpenRA.Graphics renderer.BeginFrame(scrollPosition); wr.Draw(); - Widget.DoDraw(world); + Widget.DoDraw(); var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default"; var c = new Cursor(cursorName); diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index c610060ba2..eaaab05951 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -105,7 +105,7 @@ namespace OpenRA.Graphics world.OrderGenerator.RenderAfterWorld(this, world); if (world.LocalPlayer != null) - world.LocalPlayer.Shroud.Draw(); + world.LocalPlayer.Shroud.Draw( this ); Game.Renderer.DisableScissor(); } diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index 59ab89dcfd..f40f2958b1 100755 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -80,7 +80,7 @@ namespace OpenRA.Network if( packet.Length == 5 && packet[ 4 ] == 0xBF ) frameData.ClientQuit( clientId, frame ); else if( packet.Length >= 5 && packet[ 4 ] == 0x65 ) - CheckSync( packet ); + CheckSync( world, packet ); else if( frame == 0 ) immediatePackets.Add( Pair.New( clientId, packet ) ); else @@ -94,7 +94,7 @@ namespace OpenRA.Network Dictionary syncForFrame = new Dictionary(); - void CheckSync(byte[] packet) + void CheckSync(World world, byte[] packet) { var frame = BitConverter.ToInt32(packet, 0); byte[] existingSync; @@ -116,7 +116,7 @@ namespace OpenRA.Network if (i < SyncHeaderSize) OutOfSync(frame, "Tick"); else - OutOfSync(frame, (i - SyncHeaderSize) / 4); + OutOfSync(world, frame, (i - SyncHeaderSize) / 4); } } } @@ -125,9 +125,9 @@ namespace OpenRA.Network syncForFrame.Add(frame, packet); } - void OutOfSync(int frame, int index) + void OutOfSync( World world, int frame, int index) { - var order = frameData.OrdersForFrame( Game.world, frame ).ElementAt(index); + var order = frameData.OrdersForFrame( world, frame ).ElementAt(index); throw new InvalidOperationException("Out of sync in frame {0}.\n {1}".F(frame, order.Order.ToString())); } @@ -166,9 +166,9 @@ namespace OpenRA.Network var ss = sync.SerializeSync( FrameNumber ); Connection.Send( ss ); - syncReport.UpdateSyncReport(); + syncReport.UpdateSyncReport( world ); - CheckSync( ss ); + CheckSync( world, ss ); ++FrameNumber; } diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index f0a8ee5205..d211014f7b 100755 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -19,21 +19,21 @@ namespace OpenRA.Network syncReports[i] = new SyncReport.Report(); } - internal void UpdateSyncReport() + internal void UpdateSyncReport( World world ) { if (!Game.Settings.Debug.RecordSyncReports) return; - GenerateSyncReport(syncReports[curIndex]); + GenerateSyncReport(world, syncReports[curIndex]); curIndex = ++curIndex % numSyncReports; } - void GenerateSyncReport(Report report) + void GenerateSyncReport(World world, Report report) { report.Frame = Game.orderManager.FrameNumber; - report.SyncedRandom = Game.world.SharedRandom.Last; + report.SyncedRandom = world.SharedRandom.Last; report.Traits.Clear(); - foreach (var a in Game.world.Queries.WithTraitMultiple()) + foreach (var a in world.Queries.WithTraitMultiple()) { var sync = Sync.CalculateSyncHash(a.Trait); if (sync != 0) diff --git a/OpenRA.Game/ShroudRenderer.cs b/OpenRA.Game/ShroudRenderer.cs index 02d6455c61..500040c38e 100644 --- a/OpenRA.Game/ShroudRenderer.cs +++ b/OpenRA.Game/ShroudRenderer.cs @@ -127,7 +127,7 @@ namespace OpenRA return shadowBits[SpecialShroudTiles[u ^ uSides][v]]; } - internal void Draw() + internal void Draw( WorldRenderer wr ) { if (disabled) return; @@ -150,13 +150,13 @@ namespace OpenRA var minx = clipRect.Left; var maxx = clipRect.Right; - DrawShroud( minx, miny, maxx, maxy, fogSprites, "fog" ); - DrawShroud( minx, miny, maxx, maxy, sprites, "shroud" ); + DrawShroud( wr, minx, miny, maxx, maxy, fogSprites, "fog" ); + DrawShroud( wr, minx, miny, maxx, maxy, sprites, "shroud" ); } - void DrawShroud( int minx, int miny, int maxx, int maxy, Sprite[,] s, string pal ) + void DrawShroud( WorldRenderer wr, int minx, int miny, int maxx, int maxy, Sprite[,] s, string pal ) { - var shroudPalette = Game.world.WorldRenderer.GetPaletteIndex(pal); + var shroudPalette = wr.GetPaletteIndex(pal); for (var j = miny; j < maxy; j++) { diff --git a/OpenRA.Game/Widgets/BackgroundWidget.cs b/OpenRA.Game/Widgets/BackgroundWidget.cs index 42002f3859..a6ae987af1 100644 --- a/OpenRA.Game/Widgets/BackgroundWidget.cs +++ b/OpenRA.Game/Widgets/BackgroundWidget.cs @@ -14,7 +14,7 @@ namespace OpenRA.Widgets { public readonly string Background = "dialog"; - public override void DrawInner(World world) + public override void DrawInner() { WidgetUtils.DrawPanel(Background, RenderBounds); } diff --git a/OpenRA.Game/Widgets/ButtonWidget.cs b/OpenRA.Game/Widgets/ButtonWidget.cs index 629d3d2fe4..cd6af74306 100644 --- a/OpenRA.Game/Widgets/ButtonWidget.cs +++ b/OpenRA.Game/Widgets/ButtonWidget.cs @@ -62,7 +62,7 @@ namespace OpenRA.Widgets return Depressed; } - public override void DrawInner(World world) + public override void DrawInner() { var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); diff --git a/OpenRA.Game/Widgets/ChatDisplayWidget.cs b/OpenRA.Game/Widgets/ChatDisplayWidget.cs index 56d0d930e0..9d43b6a6bb 100644 --- a/OpenRA.Game/Widgets/ChatDisplayWidget.cs +++ b/OpenRA.Game/Widgets/ChatDisplayWidget.cs @@ -32,7 +32,7 @@ namespace OpenRA.Widgets : base(widget) { } public override Rectangle EventBounds { get { return Rectangle.Empty; } } - public override void DrawInner(World world) + public override void DrawInner() { var pos = RenderOrigin; var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height); diff --git a/OpenRA.Game/Widgets/ChatEntryWidget.cs b/OpenRA.Game/Widgets/ChatEntryWidget.cs index d5e141afb2..2f0aa90443 100644 --- a/OpenRA.Game/Widgets/ChatEntryWidget.cs +++ b/OpenRA.Game/Widgets/ChatEntryWidget.cs @@ -24,7 +24,7 @@ namespace OpenRA.Widgets bool composing = false; bool teamChat = false; - public override void DrawInner(World world) + public override void DrawInner() { if (composing) { diff --git a/OpenRA.Game/Widgets/CheckboxWidget.cs b/OpenRA.Game/Widgets/CheckboxWidget.cs index 76179f3391..0497135595 100644 --- a/OpenRA.Game/Widgets/CheckboxWidget.cs +++ b/OpenRA.Game/Widgets/CheckboxWidget.cs @@ -21,7 +21,7 @@ namespace OpenRA.Widgets public bool Bold = false; public Func Checked = () => false; - public override void DrawInner(World world) + public override void DrawInner() { var font = Bold ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; var pos = RenderOrigin; diff --git a/OpenRA.Game/Widgets/ColorBlockWidget.cs b/OpenRA.Game/Widgets/ColorBlockWidget.cs index c3b343084f..ad06e585c3 100644 --- a/OpenRA.Game/Widgets/ColorBlockWidget.cs +++ b/OpenRA.Game/Widgets/ColorBlockWidget.cs @@ -34,7 +34,7 @@ namespace OpenRA.Widgets return new ColorBlockWidget(this); } - public override void DrawInner(World world) + public override void DrawInner() { WidgetUtils.FillRectWithColor(RenderBounds, GetColor()); } diff --git a/OpenRA.Game/Widgets/ImageWidget.cs b/OpenRA.Game/Widgets/ImageWidget.cs index a33d171bab..c39c298b47 100644 --- a/OpenRA.Game/Widgets/ImageWidget.cs +++ b/OpenRA.Game/Widgets/ImageWidget.cs @@ -38,7 +38,7 @@ namespace OpenRA.Widgets public override Widget Clone() { return new ImageWidget(this); } - public override void DrawInner(World world) + public override void DrawInner() { var name = GetImageName(); var collection = GetImageCollection(); diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 5d87120dec..57e2613af5 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -43,7 +43,7 @@ namespace OpenRA.Widgets GetBackground = other.GetBackground; } - public override void DrawInner(World world) + public override void DrawInner() { var bg = GetBackground(); diff --git a/OpenRA.Game/Widgets/ListBoxWidget.cs b/OpenRA.Game/Widgets/ListBoxWidget.cs index 0a6c6bee18..f790646e1b 100644 --- a/OpenRA.Game/Widgets/ListBoxWidget.cs +++ b/OpenRA.Game/Widgets/ListBoxWidget.cs @@ -44,8 +44,8 @@ namespace OpenRA.Widgets DownPressed = other.DownPressed; } - public override void DrawInner(World world) {} - public override void Draw(World world) + public override void DrawInner() {} + public override void Draw() { if (!IsVisible()) return; @@ -74,7 +74,7 @@ namespace OpenRA.Widgets Game.Renderer.EnableScissor(backgroundRect.X, backgroundRect.Y + HeaderHeight, backgroundRect.Width, backgroundRect.Height - HeaderHeight); foreach (var child in Children) - child.Draw(world); + child.Draw(); Game.Renderer.DisableScissor(); } diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index 34623995c4..e7b76acf0b 100644 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -71,7 +71,7 @@ namespace OpenRA.Widgets static Sprite UnownedSpawn = null; static Sprite OwnedSpawn = null; - public override void DrawInner( World world ) + public override void DrawInner() { if (UnownedSpawn == null) UnownedSpawn = ChromeProvider.GetImage("spawnpoints", "unowned"); diff --git a/OpenRA.Game/Widgets/PerfGraphWidget.cs b/OpenRA.Game/Widgets/PerfGraphWidget.cs index 747eac7d1a..9e018cc8d5 100644 --- a/OpenRA.Game/Widgets/PerfGraphWidget.cs +++ b/OpenRA.Game/Widgets/PerfGraphWidget.cs @@ -18,7 +18,7 @@ namespace OpenRA.Widgets { public PerfGraphWidget() : base() { } - public override void DrawInner(World world) + public override void DrawInner() { var rect = RenderBounds; float2 origin = Game.viewport.Location + new float2(rect.Right, rect.Bottom); diff --git a/OpenRA.Game/Widgets/ScrollingTextWidget.cs b/OpenRA.Game/Widgets/ScrollingTextWidget.cs index 780882247a..3b490e9d3e 100755 --- a/OpenRA.Game/Widgets/ScrollingTextWidget.cs +++ b/OpenRA.Game/Widgets/ScrollingTextWidget.cs @@ -93,7 +93,7 @@ namespace OpenRA.Widgets Text = Text.Replace("\r", ""); } - public override void DrawInner(World world) + public override void DrawInner() { var bg = GetBackground(); diff --git a/OpenRA.Game/Widgets/ShpImageWidget.cs b/OpenRA.Game/Widgets/ShpImageWidget.cs index 06fb9afeb9..ab838be719 100644 --- a/OpenRA.Game/Widgets/ShpImageWidget.cs +++ b/OpenRA.Game/Widgets/ShpImageWidget.cs @@ -48,7 +48,7 @@ namespace OpenRA.Widgets Sprite sprite = null; string cachedImage = null; int cachedFrame= -1; - public override void DrawInner(World world) + public override void DrawInner() { var image = GetImage(); var frame = GetFrame(); diff --git a/OpenRA.Game/Widgets/SliderWidget.cs b/OpenRA.Game/Widgets/SliderWidget.cs index d25242c43b..d0a8309e16 100755 --- a/OpenRA.Game/Widgets/SliderWidget.cs +++ b/OpenRA.Game/Widgets/SliderWidget.cs @@ -165,7 +165,7 @@ namespace OpenRA.Widgets } } - public override void DrawInner(World world) + public override void DrawInner() { if (!IsVisible()) return; diff --git a/OpenRA.Game/Widgets/TextFieldWidget.cs b/OpenRA.Game/Widgets/TextFieldWidget.cs index 273b44880b..525f982d5a 100644 --- a/OpenRA.Game/Widgets/TextFieldWidget.cs +++ b/OpenRA.Game/Widgets/TextFieldWidget.cs @@ -107,7 +107,7 @@ namespace OpenRA.Widgets base.Tick(world); } - public override void DrawInner(World world) + public override void DrawInner() { int margin = 5; var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; diff --git a/OpenRA.Game/Widgets/TimerWidget.cs b/OpenRA.Game/Widgets/TimerWidget.cs index fb75af9029..d973b83b0c 100644 --- a/OpenRA.Game/Widgets/TimerWidget.cs +++ b/OpenRA.Game/Widgets/TimerWidget.cs @@ -1,11 +1,11 @@ -#region Copyright & License Information -/* - * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see LICENSE. - */ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ #endregion using System.Drawing; @@ -20,13 +20,13 @@ namespace OpenRA.Widgets public TimerWidget () { IsVisible = () => Game.Settings.Game.MatchTimer; - } - - public override void DrawInner(World world) - { - var s = WorldUtils.FormatTime(Game.LocalTick); - var size = Game.Renderer.TitleFont.Measure(s); - Game.Renderer.TitleFont.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White); + } + + public override void DrawInner() + { + var s = WorldUtils.FormatTime(Game.LocalTick); + var size = Game.Renderer.TitleFont.Measure(s); + Game.Renderer.TitleFont.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White); } } } diff --git a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs index 539fb0a466..b563eefd2f 100755 --- a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs +++ b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs @@ -32,7 +32,7 @@ namespace OpenRA.Widgets public ViewportScrollControllerWidget() : base() { } protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {} - public override void DrawInner( World world ) {} + public override void DrawInner() {} public override bool HandleInputInner(MouseInput mi) { diff --git a/OpenRA.Game/Widgets/VqaPlayerWidget.cs b/OpenRA.Game/Widgets/VqaPlayerWidget.cs index 7fa7e367f2..29c7a5c66d 100644 --- a/OpenRA.Game/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Game/Widgets/VqaPlayerWidget.cs @@ -6,11 +6,11 @@ * as published by the Free Software Foundation. For more information, * see LICENSE. */ -#endregion - -using System; -using System.Drawing; -using OpenRA.FileFormats; +#endregion + +using System; +using System.Drawing; +using OpenRA.FileFormats; using OpenRA.Graphics; using OpenRA.Support; @@ -69,8 +69,8 @@ namespace OpenRA.Widgets overlaySprite.sheet.Texture.SetData(overlay); } - public override void DrawInner(World world) - { + public override void DrawInner() + { if (video == null) return; diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 3e0d9921cf..7a2f28cc85 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -269,15 +269,15 @@ namespace OpenRA.Widgets return false; } - public abstract void DrawInner( World world ); + public abstract void DrawInner(); - public virtual void Draw(World world) + public virtual void Draw() { if (IsVisible()) { - DrawInner( world ); + DrawInner(); foreach (var child in Children) - child.Draw(world); + child.Draw(); } } @@ -344,9 +344,9 @@ namespace OpenRA.Widgets ++Viewport.TicksSinceLastMove; } - public static void DoDraw(World world) + public static void DoDraw() { - RootWidget.Draw(world); + RootWidget.Draw(); } } @@ -355,7 +355,7 @@ namespace OpenRA.Widgets public ContainerWidget(Widget other) : base(other) { } - public override void DrawInner( World world ) { } + public override void DrawInner() { } public override string GetCursor(int2 pos) { return null; } public override Widget Clone() { return new ContainerWidget(this); } diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 2772c70120..5f83d3f78c 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -26,7 +26,7 @@ namespace OpenRA.Widgets this.world = world; } - public override void DrawInner( World world ) + public override void DrawInner() { var selbox = SelectionBox; if (selbox == null) return; diff --git a/OpenRA.Game/Widgets/WorldTooltipWidget.cs b/OpenRA.Game/Widgets/WorldTooltipWidget.cs index a76585f4d8..b4b8da3126 100644 --- a/OpenRA.Game/Widgets/WorldTooltipWidget.cs +++ b/OpenRA.Game/Widgets/WorldTooltipWidget.cs @@ -20,8 +20,9 @@ namespace OpenRA.Widgets { public int TooltipDelay = 10; public WorldTooltipWidget() : base() { } - public override void DrawInner(World world) + public override void DrawInner() { + var world = Game.world; if (Viewport.TicksSinceLastMove < TooltipDelay || world == null || world.LocalPlayer == null) return; diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index fef751d25e..477630c0ea 100755 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -47,11 +47,11 @@ namespace OpenRA.Mods.RA.Widgets public readonly string BuildPaletteClose = "bleep13.aud"; public readonly string TabClick = "ramenu1.aud"; - readonly World world; - [ObjectCreator.UseCtor] - public BuildPaletteWidget( [ObjectCreator.Param] World world ) + readonly World world; + [ObjectCreator.UseCtor] + public BuildPaletteWidget( [ObjectCreator.Param] World world ) { - this.world = world; + this.world = world; } public override void Initialize() @@ -176,7 +176,7 @@ namespace OpenRA.Mods.RA.Widgets int paletteHeight = 0; int numActualRows = 0; - public override void DrawInner(World world) + public override void DrawInner() { if (!IsVisible()) return; // todo: fix diff --git a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs index 45f5168145..44fa50a757 100755 --- a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs @@ -21,8 +21,9 @@ namespace OpenRA.Mods.RA.Widgets public MoneyBinWidget() : base() { } - public override void DrawInner(World world) + public override void DrawInner() { + var world = Game.world; if( world.LocalPlayer == null ) return; var playerResources = world.LocalPlayer.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs index 1d8200704f..0374c08ca2 100755 --- a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs +++ b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Widgets GetLongDesc = () => LongDesc; } - public override void DrawInner (World world) + public override void DrawInner() { var image = ChromeProvider.GetImage(Image + "-button", GetImage()); var rect = new Rectangle(RenderBounds.X, RenderBounds.Y, (int)image.size.X, (int)image.size.Y); diff --git a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs index ee73761ac6..ea0e7a7a48 100755 --- a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs @@ -25,8 +25,9 @@ namespace OpenRA.Mods.RA.Widgets float? lastPowerDrainedPos; string powerCollection; - public override void DrawInner(World world) + public override void DrawInner() { + var world = Game.world; if( world.LocalPlayer == null ) return; powerCollection = "power-" + world.LocalPlayer.Country.Race; diff --git a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs index 452c40db3b..d8ef3c57de 100755 --- a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.RA.Widgets get { return new Rectangle((int)mapRect.X, (int)mapRect.Y, (int)mapRect.Width, (int)mapRect.Height);} } - public override void DrawInner(World world) + public override void DrawInner() { if( world.LocalPlayer == null ) return; diff --git a/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs index 22532b13db..45eca959af 100755 --- a/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SpecialPowerBinWidget.cs @@ -63,8 +63,9 @@ namespace OpenRA.Mods.RA.Widgets return false; } - public override void DrawInner(World world) - { + public override void DrawInner() + { + var world = Game.world; buttons.Clear(); if( world.LocalPlayer == null ) return;