Misc improvements

This commit is contained in:
Gustas
2025-03-28 14:10:40 +02:00
committed by Paul Chote
parent b5b44c048d
commit cccd40ca13
4 changed files with 5 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Widgets
public bool HandleMouseInput(MouseInput mi) public bool HandleMouseInput(MouseInput mi)
{ {
// Exclusively uses left and right mouse buttons, but nothing else // Exclusively uses left and right mouse buttons, but nothing else.
if (mi.Button != MouseButton.Left && mi.Button != MouseButton.Right) if (mi.Button != MouseButton.Left && mi.Button != MouseButton.Right)
return false; return false;
@@ -155,7 +155,7 @@ namespace OpenRA.Mods.Common.Widgets
{ {
this.editorLayer = editorLayer; this.editorLayer = editorLayer;
// Take an immutable copy of the reference // Take an immutable copy of the reference.
this.actor = actor.Clone(); this.actor = actor.Clone();
} }

View File

@@ -123,6 +123,7 @@ namespace OpenRA.Mods.Common.Widgets
public void Execute() public void Execute()
{ {
paintTiles.TrimExcess();
} }
public void Do() public void Do()

View File

@@ -130,6 +130,7 @@ namespace OpenRA.Mods.Common.Widgets
public void Execute() public void Execute()
{ {
cellResources.TrimExcess();
} }
public void Do() public void Do()

View File

@@ -11,7 +11,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Terrain; using OpenRA.Mods.Common.Terrain;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
@@ -49,7 +48,7 @@ namespace OpenRA.Mods.Common.Widgets
terrainRenderer = world.WorldActor.Trait<ITiledTerrainRenderer>(); terrainRenderer = world.WorldActor.Trait<ITiledTerrainRenderer>();
Template = id; Template = id;
TerrainTemplate = terrainInfo.Templates.First(t => t.Value.Id == id).Value; TerrainTemplate = terrainInfo.Templates[Template];
cell = wr.Viewport.ViewToWorld(wr.Viewport.WorldToViewPx(Viewport.LastMousePos)); cell = wr.Viewport.ViewToWorld(wr.Viewport.WorldToViewPx(Viewport.LastMousePos));
UpdatePreview(); UpdatePreview();
} }