Skip to content

Commit

Permalink
Add plaza coordinates to building editor
Browse files Browse the repository at this point in the history
How exactly to plot the coordinates???
  • Loading branch information
kwsch committed Apr 5, 2020
1 parent b603e56 commit fc3276c
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 31 deletions.
12 changes: 12 additions & 0 deletions NHSE.Core/Save/Files/MainSave.cs
Expand Up @@ -64,5 +64,17 @@ public void SetAcreBytes(byte[] data)

public TerrainTile[] GetTerrain() => TerrainTile.GetArray(Data.Slice(Offsets.Terrain, TerrainManager.TileCount * TerrainTile.SIZE));
public void SetTerrain(IReadOnlyList<TerrainTile> array) => TerrainTile.SetArray(array).CopyTo(Data, Offsets.Terrain);

public uint PlazaX
{
get => BitConverter.ToUInt32(Data, Offsets.Acres + AcreSizeAll + 4);
set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.Acres + AcreSizeAll + 4);
}

public uint PlazaY
{
get => BitConverter.ToUInt32(Data, Offsets.Acres + AcreSizeAll + 8);
set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.Acres + AcreSizeAll + 8);
}
}
}
120 changes: 89 additions & 31 deletions NHSE.WinForms/Subforms/BuildingEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions NHSE.WinForms/Subforms/BuildingEditor.cs
Expand Up @@ -9,13 +9,15 @@ namespace NHSE.WinForms
public partial class BuildingEditor : Form
{
private readonly IReadOnlyList<Building> Buildings;
private readonly MainSave SAV;
private readonly TerrainManager Terrain;
private static readonly IReadOnlyDictionary<string, string[]> HelpDictionary = StructureUtil.GetStructureHelpList();

public BuildingEditor(IReadOnlyList<Building> buildings, MainSave sav)
{
InitializeComponent();
Buildings = buildings;
SAV = sav;
DialogResult = DialogResult.Cancel;

foreach (var obj in buildings)
Expand All @@ -27,12 +29,18 @@ public BuildingEditor(IReadOnlyList<Building> buildings, MainSave sav)
foreach (var entry in HelpDictionary)
CB_StructureType.Items.Add(entry.Key);
CB_StructureType.SelectedIndex = 0;

NUD_PlazaX.Value = sav.PlazaX;
NUD_PlazaY.Value = sav.PlazaY;
}

private void B_Cancel_Click(object sender, EventArgs e) => Close();

private void B_Save_Click(object sender, EventArgs e)
{
SAV.PlazaX = (uint)NUD_PlazaX.Value;
SAV.PlazaY = (uint)NUD_PlazaY.Value;

DialogResult = DialogResult.OK;
Close();
}
Expand Down

0 comments on commit fc3276c

Please sign in to comment.