public static void add(ushort buildingID, Level level) { lock (lockBuilding) { buildings.Add(buildingID, level); } Buildings.ForceLevelBuilding(buildingID, level); }
public static void update(ushort buildingID, Level level) { lock (lockBuilding) { buildings[buildingID] = level; } Buildings.ForceLevelBuilding(buildingID, level); }
private Level controlLevelUp(Level targetLevel, Level currentLevel, ushort buildingID) { Level lockLevel = this.determineLockLevel(buildingID); if (lockLevel != Level.None) { #if DEBUG Logger.Info("OnCalculateResidentialLevelUp: building: " + buildingID + "\n lock level is: " + lockLevel + "\n current level is: " + currentLevel + "\n target level is: " + targetLevel); #endif if (lockLevel > targetLevel && Settings.preventLowLandValue && (Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)buildingID].m_problems & (Notification.Problem.LandValueLow | Notification.Problem.TooFewServices)) != (Notification.Problem) 0) { Buildings.LateClearProblemForBuilding(buildingID); } if (currentLevel > lockLevel) { #if DEBUG Logger.Info("Building level too high: " + buildingID); #endif if (Settings.allowDowngrade) { Buildings.ForceLevelBuilding(buildingID, lockLevel); } else { this.bulldozeBuilding(buildingID); } //TODO: b.m_flags = Building.Flags.Downgrading; ? } if (targetLevel > lockLevel && targetLevel > currentLevel) { #if DEBUG Logger.Info("Prevent building from leveling up: " + buildingID); #endif return(lockLevel); } } return(targetLevel); }