Skip to content

Commit

Permalink
Fix #197: deleting of constructing building decreased construction limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dymanoid committed Feb 10, 2019
1 parent 39483d8 commit db0cf73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/RealTime/CustomAI/RealTimeBuildingAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public bool CanBuildOrUpgrade(ItemClass.Service buildingZone, ushort buildingId
}

HashSet<ushort> buildings = buildingsInConstruction[index];
buildings.RemoveWhere(IsBuildingCompleted);
buildings.RemoveWhere(IsBuildingCompletedOrMissing);

int allowedCount = GetAllowedConstructingUpradingCount(buildingManager.GeBuildingsCount());
bool result = buildings.Count < allowedCount;
Expand Down Expand Up @@ -417,9 +417,9 @@ private static int GetAllowedConstructingUpradingCount(int currentBuildingCount)
return MaximumBuildingsInConstruction;
}

private bool IsBuildingCompleted(ushort buildingId)
private bool IsBuildingCompletedOrMissing(ushort buildingId)
{
return buildingManager.BuildingHasFlags(buildingId, Building.Flags.Completed);
return buildingManager.BuildingHasFlags(buildingId, Building.Flags.Completed | Building.Flags.Deleted, includeZero: true);
}

private void UpdateLightState()
Expand Down

0 comments on commit db0cf73

Please sign in to comment.