Skip to content

Commit 5941d5b

Browse files
committed
Refresh light posts including buildings' INI data when map INI is changed outside of the editor
1 parent d29cb4a commit 5941d5b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/TSMapEditor/Models/Map.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ private void CreateGraphicalNodesFromBaseNodes()
330330
private void ReloadSections()
331331
{
332332
MapLoader.ReadBasicSection(this, LoadedINI);
333+
334+
// Refresh light posts in case they got their INI config changed - saves the user
335+
// from having to reload the map to refresh lighting changes
336+
Rules.BuildingTypes.ForEach(bt => initializer.ReadObjectTypePropertiesFromINI(bt, LoadedINI));
337+
Structures.ForEach(s => s.LightTiles(Tiles));
338+
333339
Lighting.ReadFromIniFile(LoadedINI);
334340
}
335341

src/TSMapEditor/Models/Structure.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ public override byte Facing
159159

160160
public void LightTiles(MapTile[][] tiles)
161161
{
162+
ClearLitTiles();
163+
162164
Dictionary<MapTile, double> litTiles = new();
163165
int foundationWidth = ObjectType.ArtConfig.Foundation.Width;
164166
int foundationHeight = ObjectType.ArtConfig.Foundation.Height;

0 commit comments

Comments
 (0)