diff --git a/CnCTDRAMapEditor/App.config b/CnCTDRAMapEditor/App.config
index 3b3f16f..b6d7fb9 100644
--- a/CnCTDRAMapEditor/App.config
+++ b/CnCTDRAMapEditor/App.config
@@ -49,21 +49,6 @@
1
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
True
diff --git a/CnCTDRAMapEditor/Dialogs/TriggersDialog.cs b/CnCTDRAMapEditor/Dialogs/TriggersDialog.cs
index 25219c6..38e29fd 100644
--- a/CnCTDRAMapEditor/Dialogs/TriggersDialog.cs
+++ b/CnCTDRAMapEditor/Dialogs/TriggersDialog.cs
@@ -609,19 +609,19 @@ namespace MobiusEditor.Dialogs
event2ComboBox.SelectedIndex = 0;
}
this.triggersTableLayoutPanel.SuspendLayout();
- RemoveFromLayout(this.event2Label, this.event2ComboBox, this.event2Flp);
- RemoveFromLayout(this.action1Label, this.action1ComboBox, this.action1Flp);
+ RemoveFromLayout(this.triggersTableLayoutPanel, this.event2Label, this.event2ComboBox, this.event2Flp);
+ RemoveFromLayout(this.triggersTableLayoutPanel, this.action1Label, this.action1ComboBox, this.action1Flp);
if (eventType != TriggerMultiStyleType.Linked)
{
// Normal order: E1, [E2 → A1], A2
- AddToLayout(this.event2Label, this.event2ComboBox, this.event2Flp, 4);
- AddToLayout(this.action1Label, this.action1ComboBox, this.action1Flp, 5);
+ AddToLayout(this.triggersTableLayoutPanel, this.event2Label, this.event2ComboBox, this.event2Flp, 4);
+ AddToLayout(this.triggersTableLayoutPanel, this.action1Label, this.action1ComboBox, this.action1Flp, 5);
}
else
{
// Flipped order: E1 → [A1, E2] → A2
- AddToLayout(this.action1Label, this.action1ComboBox, this.action1Flp, 4);
- AddToLayout(this.event2Label, this.event2ComboBox, this.event2Flp, 5);
+ AddToLayout(this.triggersTableLayoutPanel, this.action1Label, this.action1ComboBox, this.action1Flp, 4);
+ AddToLayout(this.triggersTableLayoutPanel, this.event2Label, this.event2ComboBox, this.event2Flp, 5);
}
event2Label.Visible = event2ComboBox.Visible = event2Flp.Visible = hasEvent2;
this.triggersTableLayoutPanel.ResumeLayout(false);
@@ -665,19 +665,19 @@ namespace MobiusEditor.Dialogs
UpdateTriggerActionControls(SelectedTrigger?.Action2, action2Nud, action2ValueComboBox, null);
}
- private void RemoveFromLayout(Label lblname, ComboBox cmbselect, FlowLayoutPanel flpargs)
+ private void RemoveFromLayout(TableLayoutPanel panel, Label lblname, ComboBox cmbselect, FlowLayoutPanel flpargs)
{
- this.triggersTableLayoutPanel.Controls.Remove(lblname);
- this.triggersTableLayoutPanel.Controls.Remove(cmbselect);
- this.triggersTableLayoutPanel.Controls.Remove(flpargs);
+ panel.Controls.Remove(lblname);
+ panel.Controls.Remove(cmbselect);
+ panel.Controls.Remove(flpargs);
}
- private void AddToLayout(Label lblname, ComboBox cmbselect, FlowLayoutPanel flpargs, int row)
+ private void AddToLayout(TableLayoutPanel panel, Label lblname, ComboBox cmbselect, FlowLayoutPanel flpargs, int row)
{
- this.triggersTableLayoutPanel.Controls.Add(lblname, 0, row);
- this.triggersTableLayoutPanel.Controls.Add(cmbselect, 1, row);
- this.triggersTableLayoutPanel.Controls.Add(flpargs, 2, row);
- this.triggersTableLayoutPanel.SetColumnSpan(flpargs, 2);
+ panel.Controls.Add(lblname, 0, row);
+ panel.Controls.Add(cmbselect, 1, row);
+ panel.Controls.Add(flpargs, 2, row);
+ panel.SetColumnSpan(flpargs, 2);
}
private void UpdateTriggerEventControls(TriggerEvent triggerEvent, NumericUpDown eventNud, ComboBox eventValueComboBox, TriggerEvent triggerEventData)
diff --git a/CnCTDRAMapEditor/Interface/IBrowsableType.cs b/CnCTDRAMapEditor/Interface/IBrowsableType.cs
index ede2681..ebdf335 100644
--- a/CnCTDRAMapEditor/Interface/IBrowsableType.cs
+++ b/CnCTDRAMapEditor/Interface/IBrowsableType.cs
@@ -20,6 +20,8 @@ namespace MobiusEditor.Interface
{
public interface IBrowsableType
{
+ /// Initialise the unit's name based on the currently loaded strings file.
+ void InitDisplayName();
string DisplayName { get; }
Bitmap Thumbnail { get; }
void Reset();
diff --git a/CnCTDRAMapEditor/MainForm.Designer.cs b/CnCTDRAMapEditor/MainForm.Designer.cs
index 2a465b4..c51487b 100644
--- a/CnCTDRAMapEditor/MainForm.Designer.cs
+++ b/CnCTDRAMapEditor/MainForm.Designer.cs
@@ -687,8 +687,8 @@ namespace MobiusEditor
//
this.viewExtraIndicatorsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.viewExtraIndicatorsMapSymmetryMenuItem,
- this.viewExtraIndicatorsMapPassabilityMenuItem,
this.viewExtraIndicatorsMapGridMenuItem,
+ this.viewExtraIndicatorsMapPassabilityMenuItem,
this.viewExtraIndicatorsWaypointRevealRadiusMenuItem,
this.viewExtraIndicatorsEffectAreaRadiusMenuItem});
this.viewExtraIndicatorsToolStripMenuItem.Name = "viewExtraIndicatorsToolStripMenuItem";
@@ -704,24 +704,24 @@ namespace MobiusEditor
this.viewExtraIndicatorsMapSymmetryMenuItem.Text = "Map &symmetry";
this.viewExtraIndicatorsMapSymmetryMenuItem.CheckedChanged += new System.EventHandler(this.ViewMenuItem_CheckedChanged);
//
- // viewExtraIndicatorsMapPassabilityMenuItem
- //
- this.viewExtraIndicatorsMapPassabilityMenuItem.CheckOnClick = true;
- this.viewExtraIndicatorsMapPassabilityMenuItem.Name = "viewExtraIndicatorsMapPassabilityMenuItem";
- this.viewExtraIndicatorsMapPassabilityMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2;
- this.viewExtraIndicatorsMapPassabilityMenuItem.Size = new System.Drawing.Size(224, 22);
- this.viewExtraIndicatorsMapPassabilityMenuItem.Text = "Map passability";
- this.viewExtraIndicatorsMapPassabilityMenuItem.CheckedChanged += new System.EventHandler(this.ViewMenuItem_CheckedChanged);
- //
// viewExtraIndicatorsMapGridMenuItem
//
this.viewExtraIndicatorsMapGridMenuItem.CheckOnClick = true;
this.viewExtraIndicatorsMapGridMenuItem.Name = "viewExtraIndicatorsMapGridMenuItem";
- this.viewExtraIndicatorsMapGridMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3;
+ this.viewExtraIndicatorsMapGridMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2;
this.viewExtraIndicatorsMapGridMenuItem.Size = new System.Drawing.Size(224, 22);
this.viewExtraIndicatorsMapGridMenuItem.Text = "Map &grid";
this.viewExtraIndicatorsMapGridMenuItem.CheckedChanged += new System.EventHandler(this.ViewMenuItem_CheckedChanged);
//
+ // viewExtraIndicatorsMapPassabilityMenuItem
+ //
+ this.viewExtraIndicatorsMapPassabilityMenuItem.CheckOnClick = true;
+ this.viewExtraIndicatorsMapPassabilityMenuItem.Name = "viewExtraIndicatorsMapPassabilityMenuItem";
+ this.viewExtraIndicatorsMapPassabilityMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3;
+ this.viewExtraIndicatorsMapPassabilityMenuItem.Size = new System.Drawing.Size(224, 22);
+ this.viewExtraIndicatorsMapPassabilityMenuItem.Text = "Map passability";
+ this.viewExtraIndicatorsMapPassabilityMenuItem.CheckedChanged += new System.EventHandler(this.ViewMenuItem_CheckedChanged);
+ //
// viewExtraIndicatorsWaypointRevealRadiusMenuItem
//
this.viewExtraIndicatorsWaypointRevealRadiusMenuItem.CheckOnClick = true;
diff --git a/CnCTDRAMapEditor/MainForm.cs b/CnCTDRAMapEditor/MainForm.cs
index 04e4eaf..39b63be 100644
--- a/CnCTDRAMapEditor/MainForm.cs
+++ b/CnCTDRAMapEditor/MainForm.cs
@@ -134,13 +134,6 @@ namespace MobiusEditor
this.toolsOptionsOutlineAllCratesMenuItem.Checked = Globals.OutlineAllCrates;
this.toolsOptionsCratesOnTopMenuItem.Checked = Globals.CratesOnTop;
- // Loaded directly from settings file setting and applied to checkboxes.
- this.viewExtraIndicatorsMapSymmetryMenuItem.Checked = Properties.Settings.Default.DefaultExtraSymmetry;
- this.viewExtraIndicatorsMapGridMenuItem.Checked = Properties.Settings.Default.DefaultExtraMapGrid;
- this.viewExtraIndicatorsEffectAreaRadiusMenuItem.Checked = Properties.Settings.Default.DefaultExtraEffectRadiuses;
- this.viewExtraIndicatorsWaypointRevealRadiusMenuItem.Checked = Properties.Settings.Default.DefaultExtraWaypointReveal;
- this.viewExtraIndicatorsMapPassabilityMenuItem.Checked = Properties.Settings.Default.DefaultExtraPassability;
-
// Obey the settings.
this.mapPanel.SmoothScale = Globals.MapSmoothScale;
this.mapPanel.BackColor = Globals.MapBackColor;
diff --git a/CnCTDRAMapEditor/Model/BuildingType.cs b/CnCTDRAMapEditor/Model/BuildingType.cs
index a8462dc..2fd640a 100644
--- a/CnCTDRAMapEditor/Model/BuildingType.cs
+++ b/CnCTDRAMapEditor/Model/BuildingType.cs
@@ -243,11 +243,16 @@ namespace MobiusEditor.Model
return (this.Name ?? String.Empty).ToUpperInvariant();
}
- public void Init(GameType gameType, HouseType house, DirectionType direction)
+ public void InitDisplayName()
{
this.DisplayName = !String.IsNullOrEmpty(this.nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[this.nameId])
? Globals.TheGameTextManager[this.nameId] + " (" + this.Name.ToUpperInvariant() + ")"
: this.Name.ToUpperInvariant();
+ }
+
+ public void Init(GameType gameType, HouseType house, DirectionType direction)
+ {
+ this.InitDisplayName();
Bitmap oldImage = this.Thumbnail;
Building mockBuilding = new Building()
{
diff --git a/CnCTDRAMapEditor/Model/InfantryType.cs b/CnCTDRAMapEditor/Model/InfantryType.cs
index 6858011..3beaffd 100644
--- a/CnCTDRAMapEditor/Model/InfantryType.cs
+++ b/CnCTDRAMapEditor/Model/InfantryType.cs
@@ -27,10 +27,10 @@ namespace MobiusEditor.Model
public string DisplayName { get; private set; }
public string OwnerHouse { get; private set; }
public UnitTypeFlag Flag { get; private set; }
- public bool IsArmed => (Flag & UnitTypeFlag.IsArmed) == UnitTypeFlag.IsArmed;
+ public bool IsArmed => (this.Flag & UnitTypeFlag.IsArmed) == UnitTypeFlag.IsArmed;
public bool IsAircraft => false;
public bool IsFixedWing => false;
- public bool IsExpansionUnit => (Flag & UnitTypeFlag.IsExpansionUnit) == UnitTypeFlag.IsExpansionUnit;
+ public bool IsExpansionUnit => (this.Flag & UnitTypeFlag.IsExpansionUnit) == UnitTypeFlag.IsExpansionUnit;
public bool IsHarvester => false;
public bool CanRemap => (this.Flag & UnitTypeFlag.NoRemap) != UnitTypeFlag.NoRemap;
public string ClassicGraphicsSource { get; private set; }
@@ -67,11 +67,11 @@ namespace MobiusEditor.Model
}
else if (obj is sbyte)
{
- return ID == (sbyte)obj;
+ return this.ID == (sbyte)obj;
}
else if (obj is string)
{
- return string.Equals(Name, obj as string, StringComparison.OrdinalIgnoreCase);
+ return string.Equals(this.Name, obj as string, StringComparison.OrdinalIgnoreCase);
}
return base.Equals(obj);
@@ -79,20 +79,26 @@ namespace MobiusEditor.Model
public override int GetHashCode()
{
- return ID.GetHashCode();
+ return this.ID.GetHashCode();
}
public override string ToString()
{
- return Name;
+ return this.Name;
+ }
+
+
+ public void InitDisplayName()
+ {
+ this.DisplayName = !String.IsNullOrEmpty(this.nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[this.nameId])
+ ? Globals.TheGameTextManager[this.nameId] + " (" + this.Name.ToUpperInvariant() + ")"
+ : this.Name.ToUpperInvariant();
}
public void Init(HouseType house, DirectionType direction)
{
- this.DisplayName = !String.IsNullOrEmpty(nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[nameId])
- ? Globals.TheGameTextManager[nameId] + " (" + Name.ToUpperInvariant() + ")"
- : Name.ToUpperInvariant();
- Bitmap oldImage = Thumbnail;
+ this.InitDisplayName();
+ Bitmap oldImage = this.Thumbnail;
Tile tile;
// Initialisation for the special RA civilian remapping logic.
if (this.ClassicGraphicsSource != null && Globals.TheTilesetManager is TilesetManagerClassic tsmc)
@@ -113,7 +119,7 @@ namespace MobiusEditor.Model
MapRenderer.SetRenderSettings(g, Globals.PreviewSmoothScale);
MapRenderer.RenderInfantry(Point.Empty, Globals.PreviewTileSize, mockInfantry, InfantryStoppingType.Center).Item2(g);
}
- Thumbnail = infantryThumbnail;
+ this.Thumbnail = infantryThumbnail;
if (oldImage != null)
{
try { oldImage.Dispose(); }
diff --git a/CnCTDRAMapEditor/Model/Map.cs b/CnCTDRAMapEditor/Model/Map.cs
index f9d9adf..e88f5aa 100644
--- a/CnCTDRAMapEditor/Model/Map.cs
+++ b/CnCTDRAMapEditor/Model/Map.cs
@@ -553,16 +553,12 @@ namespace MobiusEditor.Model
DirectionType unitDir = this.UnitDirectionTypes.Where(d => d.Facing == FacingType.SouthWest).First();
foreach (UnitType unitType in this.AllUnitTypes)
{
- unitType.Init(gameType, this.HouseTypesIncludingNone.Where(h => h.Equals(unitType.OwnerHouse)).FirstOrDefault(), unitDir, true);
+ unitType.Init(gameType, this.HouseTypesIncludingNone.Where(h => h.Equals(unitType.OwnerHouse)).FirstOrDefault(), unitDir);
}
- if (Globals.DisableAirUnits)
+ // Probably already done for most, but required for initialising air unit names for teamtypes if DisableAirUnits is true.
+ foreach (ITechnoType techno in this.AllTeamTechnoTypes)
{
- // Necessary for initialising the full name to show in teamtypes.
- // If DisableAirUnits is false, this is done along with the other units.
- foreach (UnitType airUnit in this.AllTeamTechnoTypes.OfType().Where(u => u.IsAircraft))
- {
- airUnit.Init(gameType, this.HouseTypesIncludingNone.Where(h => h.Equals(airUnit.OwnerHouse)).FirstOrDefault(), unitDir, false);
- }
+ techno.InitDisplayName();
}
DirectionType bldDir = this.UnitDirectionTypes.Where(d => d.Facing == FacingType.North).First();
foreach (BuildingType buildingType in this.BuildingTypes.Where(itm => !Globals.FilterTheaterObjects || itm.Theaters == null || itm.Theaters.Contains(this.Theater)))
diff --git a/CnCTDRAMapEditor/Model/OverlayType.cs b/CnCTDRAMapEditor/Model/OverlayType.cs
index 32a05ab..122cf81 100644
--- a/CnCTDRAMapEditor/Model/OverlayType.cs
+++ b/CnCTDRAMapEditor/Model/OverlayType.cs
@@ -149,15 +149,19 @@ namespace MobiusEditor.Model
return this.Name;
}
- public void Init(GameType gameType)
+ public void InitDisplayName()
{
// Shows graphics source and not real internal name to mask different internal name for ROAD #2.
bool idEmpty = String.IsNullOrEmpty(this.nameId);
- String fetched = idEmpty? String.Empty : Globals.TheGameTextManager[this.nameId];
+ String fetched = idEmpty ? String.Empty : Globals.TheGameTextManager[this.nameId];
this.DisplayName = !idEmpty && !String.IsNullOrEmpty(fetched)
? fetched + " (" + this.GraphicsSource.ToUpperInvariant() + ")"
: idEmpty ? this.GraphicsSource.ToUpperInvariant() : this.nameId;
+ }
+ public void Init(GameType gameType)
+ {
+ InitDisplayName();
var oldImage = this.Thumbnail;
var tileSize = Globals.PreviewTileSize;
Bitmap th = new Bitmap(tileSize.Width, tileSize.Height);
diff --git a/CnCTDRAMapEditor/Model/SmudgeType.cs b/CnCTDRAMapEditor/Model/SmudgeType.cs
index 3f71c29..4c5d2b3 100644
--- a/CnCTDRAMapEditor/Model/SmudgeType.cs
+++ b/CnCTDRAMapEditor/Model/SmudgeType.cs
@@ -45,8 +45,8 @@ namespace MobiusEditor.Model
public Size Size { get; set; }
public int Icons { get; set; }
public SmudgeTypeFlag Flag { get; private set; }
- public bool IsAutoBib => (Flag & (SmudgeTypeFlag.Bib1 | SmudgeTypeFlag.Bib2 | SmudgeTypeFlag.Bib3)) != SmudgeTypeFlag.None;
- public bool IsMultiCell => Icons == 1 && (Size.Width > 0 || Size.Height > 0);
+ public bool IsAutoBib => (this.Flag & (SmudgeTypeFlag.Bib1 | SmudgeTypeFlag.Bib2 | SmudgeTypeFlag.Bib3)) != SmudgeTypeFlag.None;
+ public bool IsMultiCell => this.Icons == 1 && (this.Size.Width > 0 || this.Size.Height > 0);
public Bitmap Thumbnail { get; set; }
private string nameId;
@@ -110,48 +110,53 @@ namespace MobiusEditor.Model
{
if (obj is SmudgeType sm)
{
- return ReferenceEquals(this, sm) || (ID == sm.ID && Name == sm.Name && Flag == sm.Flag && Size == sm.Size && Icons == sm.Icons);
+ return ReferenceEquals(this, sm) || (this.ID == sm.ID && this.Name == sm.Name && this.Flag == sm.Flag && this.Size == sm.Size && this.Icons == sm.Icons);
}
else if (obj is sbyte)
{
- return ID == (sbyte)obj;
+ return this.ID == (sbyte)obj;
}
else if (obj is string)
{
- return string.Equals(Name, obj as string, StringComparison.OrdinalIgnoreCase);
+ return string.Equals(this.Name, obj as string, StringComparison.OrdinalIgnoreCase);
}
return base.Equals(obj);
}
public override int GetHashCode()
{
- return ID.GetHashCode();
+ return this.ID.GetHashCode();
}
public override string ToString()
{
- return Name;
+ return this.Name;
+ }
+
+ public void InitDisplayName()
+ {
+ this.DisplayName = !String.IsNullOrEmpty(this.nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[this.nameId])
+ ? Globals.TheGameTextManager[this.nameId] + " (" + this.Name.ToUpperInvariant() + ")"
+ : this.Name.ToUpperInvariant();
}
public void Init()
{
- this.DisplayName = !String.IsNullOrEmpty(nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[nameId])
- ? Globals.TheGameTextManager[nameId] + " (" + Name.ToUpperInvariant() + ")"
- : Name.ToUpperInvariant();
- var oldImage = Thumbnail;
+ InitDisplayName();
+ var oldImage = this.Thumbnail;
var tileSize = Globals.PreviewTileSize;
- Bitmap th = new Bitmap(tileSize.Width * Size.Width, tileSize.Height * Size.Height);
+ Bitmap th = new Bitmap(tileSize.Width * this.Size.Width, tileSize.Height * this.Size.Height);
th.SetResolution(96, 96);
bool found = false;
using (Graphics g = Graphics.FromImage(th))
{
MapRenderer.SetRenderSettings(g, Globals.PreviewSmoothScale);
int icon = 0;
- for (int y = 0; y < Size.Height; y++)
+ for (int y = 0; y < this.Size.Height; y++)
{
- for (int x = 0; x < Size.Width; x++)
+ for (int x = 0; x < this.Size.Width; x++)
{
- if (Globals.TheTilesetManager.GetTileData(Name, icon++, out Tile tile))
+ if (Globals.TheTilesetManager.GetTileData(this.Name, icon++, out Tile tile))
{
found = true;
Rectangle overlayBounds = MapRenderer.RenderBounds(tile.Image.Size, new Size(1, 1), Globals.PreviewTileScale);
@@ -164,12 +169,12 @@ namespace MobiusEditor.Model
}
if (found)
{
- Thumbnail = th;
+ this.Thumbnail = th;
}
else
{
th.Dispose();
- Thumbnail = null;
+ this.Thumbnail = null;
}
if (oldImage != null)
{
diff --git a/CnCTDRAMapEditor/Model/TemplateType.cs b/CnCTDRAMapEditor/Model/TemplateType.cs
index 172f620..4de7d40 100644
--- a/CnCTDRAMapEditor/Model/TemplateType.cs
+++ b/CnCTDRAMapEditor/Model/TemplateType.cs
@@ -329,6 +329,11 @@ namespace MobiusEditor.Model
return Name;
}
+ public void InitDisplayName()
+ {
+ // Do nothing. Templates have no real UI names.
+ }
+
public void Init(TheaterType theater)
{
Init(theater, false);
diff --git a/CnCTDRAMapEditor/Model/TerrainType.cs b/CnCTDRAMapEditor/Model/TerrainType.cs
index 4f0184e..d8797de 100644
--- a/CnCTDRAMapEditor/Model/TerrainType.cs
+++ b/CnCTDRAMapEditor/Model/TerrainType.cs
@@ -25,10 +25,10 @@ namespace MobiusEditor.Model
public sbyte ID { get; private set; }
public string Name { get; private set; }
public string DisplayName { get; private set; }
- public Rectangle OverlapBounds => new Rectangle(Point.Empty, Size);
+ public Rectangle OverlapBounds => new Rectangle(Point.Empty, this.Size);
public bool[,] OpaqueMask { get; private set; }
public bool[,] OccupyMask { get; private set; }
- public Size Size => new Size(OccupyMask.GetLength(1), OccupyMask.GetLength(0));
+ public Size Size => new Size(this.OccupyMask.GetLength(1), this.OccupyMask.GetLength(0));
public TheaterType[] Theaters { get; private set; }
public int DisplayIcon { get; private set; }
public LandType PlacementLand { get; private set; }
@@ -155,11 +155,11 @@ namespace MobiusEditor.Model
}
else if (obj is sbyte)
{
- return ID == (sbyte)obj;
+ return this.ID == (sbyte)obj;
}
else if (obj is string)
{
- return string.Equals(Name, obj as string, StringComparison.OrdinalIgnoreCase);
+ return string.Equals(this.Name, obj as string, StringComparison.OrdinalIgnoreCase);
}
return base.Equals(obj);
@@ -167,34 +167,38 @@ namespace MobiusEditor.Model
public override int GetHashCode()
{
- return ID.GetHashCode();
+ return this.ID.GetHashCode();
}
public override string ToString()
{
- return (Name ?? String.Empty).ToUpperInvariant();
+ return (this.Name ?? String.Empty).ToUpperInvariant();
+ }
+
+ public void InitDisplayName()
+ {
+ this.DisplayName = !String.IsNullOrEmpty(this.nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[this.nameId])
+ ? Globals.TheGameTextManager[this.nameId] + " (" + this.Name.ToUpperInvariant() + ")"
+ : this.Name.ToUpperInvariant();
}
public void Init()
{
- this.DisplayName = !String.IsNullOrEmpty(nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[nameId])
- ? Globals.TheGameTextManager[nameId] + " (" + Name.ToUpperInvariant() + ")"
- : Name.ToUpperInvariant();
- var oldImage = Thumbnail;
- string tileName = GraphicsSource;
+ Bitmap oldImage = this.Thumbnail;
+ string tileName = this.GraphicsSource;
Tile tile;
// If the graphics source doesn't yield a result, fall back on actual name.
// This fixes the graphics source override for the ore mine not working in classic mode.
bool success = true;
- if (!Globals.TheTilesetManager.GetTileData(tileName, DisplayIcon, out tile))
+ if (!Globals.TheTilesetManager.GetTileData(tileName, this.DisplayIcon, out tile))
{
- success = Globals.TheTilesetManager.GetTileData(this.Name, DisplayIcon, out tile, true, false);
+ success = Globals.TheTilesetManager.GetTileData(this.Name, this.DisplayIcon, out tile, true, false);
}
if (tile != null && tile.Image != null)
{
- var tileSize = Globals.PreviewTileSize;
- var renderSize = new Size(tileSize.Width * Size.Width, tileSize.Height * Size.Height);
- Rectangle overlayBounds = MapRenderer.RenderBounds(tile.Image.Size, Size, Globals.PreviewTileScale);
+ Size tileSize = Globals.PreviewTileSize;
+ Size renderSize = new Size(tileSize.Width * this.Size.Width, tileSize.Height * this.Size.Height);
+ Rectangle overlayBounds = MapRenderer.RenderBounds(tile.Image.Size, this.Size, Globals.PreviewTileScale);
Bitmap th = new Bitmap(renderSize.Width, renderSize.Height);
th.SetResolution(96, 96);
using (Graphics g = Graphics.FromImage(th))
@@ -202,24 +206,24 @@ namespace MobiusEditor.Model
MapRenderer.SetRenderSettings(g, Globals.PreviewSmoothScale);
g.DrawImage(tile.Image, overlayBounds);
}
- Thumbnail = th;
+ this.Thumbnail = th;
if (success)
{
- OpaqueMask = GeneralUtils.FindOpaqueCells(th, Size, 10, 25, 0x80);
+ this.OpaqueMask = GeneralUtils.FindOpaqueCells(th, this.Size, 10, 25, 0x80);
}
}
else
{
- Thumbnail = null;
+ this.Thumbnail = null;
}
if (!success)
{
- OpaqueMask = new bool[Size.Height, Size.Width];
- for (int y = 0; y < Size.Height; ++y)
+ this.OpaqueMask = new bool[this.Size.Height, this.Size.Width];
+ for (int y = 0; y < this.Size.Height; ++y)
{
- for (int x = 0; x < Size.Width; ++x)
+ for (int x = 0; x < this.Size.Width; ++x)
{
- OpaqueMask[y, x] = true;
+ this.OpaqueMask[y, x] = true;
}
}
}
diff --git a/CnCTDRAMapEditor/Model/UnitType.cs b/CnCTDRAMapEditor/Model/UnitType.cs
index 39375e2..918a4c5 100644
--- a/CnCTDRAMapEditor/Model/UnitType.cs
+++ b/CnCTDRAMapEditor/Model/UnitType.cs
@@ -141,16 +141,16 @@ namespace MobiusEditor.Model
return this.Name;
}
- public void Init(GameType gameType, HouseType house, DirectionType direction, bool fullInit)
+ public void InitDisplayName()
{
- // Required for classic mode: reset name.
this.DisplayName = !String.IsNullOrEmpty(this.nameId) && !String.IsNullOrEmpty(Globals.TheGameTextManager[this.nameId])
? Globals.TheGameTextManager[this.nameId] + " (" + this.Name.ToUpperInvariant() + ")"
: this.Name.ToUpperInvariant();
- if (!fullInit)
- {
- return;
- }
+ }
+
+ public void Init(GameType gameType, HouseType house, DirectionType direction)
+ {
+ InitDisplayName();
Bitmap oldImage = this.Thumbnail;
Unit mockUnit = new Unit()
{
diff --git a/CnCTDRAMapEditor/Program.cs b/CnCTDRAMapEditor/Program.cs
index 972b74c..16f024d 100644
--- a/CnCTDRAMapEditor/Program.cs
+++ b/CnCTDRAMapEditor/Program.cs
@@ -390,11 +390,11 @@ namespace MobiusEditor
gtm["TEXT_STRUCTURE_TITLE_OIL_PUMP"] = "Oil Pump";
gtm["TEXT_STRUCTURE_TITLE_OIL_TANKER"] = "Oil Tanker";
String fake = " (" + gtm["TEXT_UI_FAKE"] + ")";
- if (!gtm["TEXT_STRUCTURE_RA_WEAF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_WEAF"] = gtm["TEXT_STRUCTURE_RA_WEAF"] + fake;
- if (!gtm["TEXT_STRUCTURE_RA_FACF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_FACF"] = gtm["TEXT_STRUCTURE_RA_FACF"] + fake;
- if (!gtm["TEXT_STRUCTURE_RA_SYRF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_SYRF"] = gtm["TEXT_STRUCTURE_RA_SYRF"] + fake;
- if (!gtm["TEXT_STRUCTURE_RA_SPEF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_SPEF"] = gtm["TEXT_STRUCTURE_RA_SPEF"] + fake;
- if (!gtm["TEXT_STRUCTURE_RA_DOMF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_DOMF"] = gtm["TEXT_STRUCTURE_RA_DOMF"] + fake;
+ if (!gtm["TEXT_STRUCTURE_RA_WEAF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_WEAF"] += fake;
+ if (!gtm["TEXT_STRUCTURE_RA_FACF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_FACF"] += fake;
+ if (!gtm["TEXT_STRUCTURE_RA_SYRF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_SYRF"] += fake;
+ if (!gtm["TEXT_STRUCTURE_RA_SPEF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_SPEF"] += fake;
+ if (!gtm["TEXT_STRUCTURE_RA_DOMF"].EndsWith(fake)) gtm["TEXT_STRUCTURE_RA_DOMF"] += fake;
// Overlay
gtm["TEXT_OVERLAY_CONCRETE_PAVEMENT"] = "Concrete";
gtm["TEXT_OVERLAY_CONCRETE_ROAD"] = "Concrete Road";
diff --git a/CnCTDRAMapEditor/Properties/Settings.Designer.cs b/CnCTDRAMapEditor/Properties/Settings.Designer.cs
index 13e39e0..5323d0d 100644
--- a/CnCTDRAMapEditor/Properties/Settings.Designer.cs
+++ b/CnCTDRAMapEditor/Properties/Settings.Designer.cs
@@ -131,51 +131,6 @@ namespace MobiusEditor.Properties {
}
}
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool DefaultExtraSymmetry {
- get {
- return ((bool)(this["DefaultExtraSymmetry"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool DefaultExtraMapGrid {
- get {
- return ((bool)(this["DefaultExtraMapGrid"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool DefaultExtraEffectRadiuses {
- get {
- return ((bool)(this["DefaultExtraEffectRadiuses"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool DefaultExtraWaypointReveal {
- get {
- return ((bool)(this["DefaultExtraWaypointReveal"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool DefaultExtraPassability {
- get {
- return ((bool)(this["DefaultExtraPassability"]));
- }
- }
-
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
diff --git a/CnCTDRAMapEditor/Properties/Settings.settings b/CnCTDRAMapEditor/Properties/Settings.settings
index 33d589b..608149a 100644
--- a/CnCTDRAMapEditor/Properties/Settings.settings
+++ b/CnCTDRAMapEditor/Properties/Settings.settings
@@ -38,21 +38,6 @@
1
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
True