Skip to content

Commit

Permalink
Improve performance by reducing the building activity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dymanoid committed Jun 1, 2019
1 parent 7930d78 commit 4ccacf3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/RealTime/CustomAI/RealTimeBuildingAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ private void UpdateLightState(ushort step, bool updateBuilding)

for (ushort i = first; i <= last; ++i)
{
if (!buildingManager.BuildingHasFlags(i, Building.Flags.Created))
{
continue;
}

buildingManager.GetBuildingService(i, out ItemClass.Service service, out ItemClass.SubService subService);
bool lightsOn = !ShouldSwitchBuildingLightsOff(i, service, subService);
if (lightsOn == lightStates[i])
Expand Down

0 comments on commit 4ccacf3

Please sign in to comment.