Add layer2->layer1 check (isSupported), add logic for isActive

isActive: indicates if the tile is animated (eg: bonfire has fire or is extinguished)
isSupported: layer2 tile checks beneath it (layer1) to see if there's something to hold it up on that layer (sanity check)

Dunno how to handle the isActive set-on-save. I saw there was an isActive flag in my plaza, assumedly left there from a radio or something. NHSE does not change flag state at this time.
This commit is contained in:
Kurt
2020-05-03 16:29:28 -07:00
parent 8edf0a6ec4
commit 4a49caf6da
5 changed files with 85 additions and 23 deletions

View File

@@ -176,12 +176,13 @@ private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
{
var l = Map.CurrentLayer;
var oldTile = l.GetTile(View.X + HoverX, View.Y + HoverY);
var tile = GetTile(l, e, out _, out _);
var tile = GetTile(l, e, out var x, out var y);
if (tile == oldTile)
return;
var str = GameInfo.Strings;
var name = str.GetItemName(tile);
TT_Hover.SetToolTip(PB_Acre, name);
SetCoordinateText(x, y);
}
private void ViewTile(FieldItem tile)
@@ -251,8 +252,17 @@ private void DeleteTile(TerrainTile tile)
private void B_Save_Click(object sender, EventArgs e)
{
var all = ArrayUtil.ConcatAll(Map.Items.Layer1.Tiles, Map.Items.Layer2.Tiles);
SAV.SetFieldItems(all);
var unsupported = Map.Items.GetUnsupportedTiles();
if (unsupported.Count != 0)
{
var err = MessageStrings.MsgFieldItemUnsupportedLayer2Tile;
var ask = MessageStrings.MsgAskContinue;
var prompt = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, err, ask);
if (prompt != DialogResult.Yes)
return;
}
Map.Items.Save();
SAV.SetTerrainTiles(Map.Terrain.Tiles);
SAV.Buildings = Map.Buildings;
SAV.PlazaX = Map.PlazaX;
@@ -468,10 +478,12 @@ private void PB_Map_MouseMove(object sender, MouseEventArgs e)
else
{
View.GetCursorCoordinates(e.X, e.Y, out var x, out var y);
L_Coordinates.Text = $"({x:000},{y:000}) = (0x{x:X2},0x{y:X2})";
SetCoordinateText(x, y);
}
}
private void SetCoordinateText(int x, int y) => L_Coordinates.Text = $"({x:000},{y:000}) = (0x{x:X2},0x{y:X2})";
private void NUD_Layer_ValueChanged(object sender, EventArgs e)
{
Map.MapLayer = (int) NUD_Layer.Value - 1;