/// <summary> /// Moves forward every actions currently in progress on the instance. /// This method need to be called at the end of each turn. /// If two opposed actions ends on the same turn, latest added is applied. /// </summary> internal void UpdateActionsProgress() { var removableActions = new List <InProgressMapSquareImprovementPivot>(); foreach (var action in _currentActions) { if (!action.HasSettlers) { removableActions.Add(action); } else { action.ForwardProgression(); } if (action.IsDone) { removableActions.Add(action); if (action.Action == MapSquareImprovementPivot.BuildFortress) { Fortress = true; } if (action.Action == MapSquareImprovementPivot.Clear) { ChangeBiome(Biome.UnderlyingBiome(BiomePivot.Biomes)); Mine = false; Irrigate = false; } if (action.Action == MapSquareImprovementPivot.ClearPollution) { Pollution = false; } if (action.Action == MapSquareImprovementPivot.DestroyImprovement) { if (Fortress) { Fortress = false; } else { // It looks like both are destroyed, but it's not possible to have both anyway. Mine = false; Irrigate = false; } } if (action.Action == MapSquareImprovementPivot.DestroyRoad) { if (RailRoad) { RailRoad = false; } else { Road = false; } } if (action.Action == MapSquareImprovementPivot.Irrigate) { Mine = false; Irrigate = true; } if (action.Action == MapSquareImprovementPivot.Mine) { Mine = true; Irrigate = false; } if (action.Action == MapSquareImprovementPivot.Plant) { Biome = BiomePivot.Forest; Mine = false; Irrigate = false; } if (action.Action == MapSquareImprovementPivot.RailRoad) { RailRoad = true; } if (action.Action == MapSquareImprovementPivot.Road) { Road = true; } SquareChangeEvent?.Invoke(this, new SquareChangedEventArgs(this)); } } foreach (var action in removableActions.Distinct()) { _currentActions.Remove(action); action.RemoveSettlers(); } }
/// <summary> /// Applies default actions of the instance when a <see cref="CitizenPivot"/> is built on it. /// </summary> internal void ApplyCityActions() { Road = true; RailRoad = false; // Game bug ! SquareChangeEvent?.Invoke(this, new SquareChangedEventArgs(this)); }