# HG changeset patch # User Alys Brooks # Date 2022-07-28 03:50:56 # Node ID 0cfd5b8d29fcfb588c6d14d686da92fb8ac6311d # Parent 616efddd694a17816c279c986d5abeb6f8be0e00 Clean up indentation. diff --git a/isometric-park-fna/Engines/PolicyEngine.cs b/isometric-park-fna/Engines/PolicyEngine.cs --- a/isometric-park-fna/Engines/PolicyEngine.cs +++ b/isometric-park-fna/Engines/PolicyEngine.cs @@ -12,48 +12,42 @@ [Reads(typeof(TrespassingPolicyComponent))] [Writes(typeof(TrespassingPolicyComponent), typeof(BudgetLineComponent))] - public class PolicyEngine : Engine + public class PolicyEngine : Engine { - public PolicyEngine() { } - public override void Update(double dt) { foreach (ref readonly var message - in ReadMessages()) + in ReadMessages()) { foreach (ref readonly var entity - in ReadEntities()) + in ReadEntities()) { SetComponent(entity, new TrespassingPolicyComponent - { - tresspassingPolicy - = message.newEnforcementLevel - }); + { + tresspassingPolicy + = message.newEnforcementLevel + }); var newCost = message.newEnforcementLevel switch { EnforcementLevel.Unspecified => 0, - EnforcementLevel.NoEnforcement => 0, - EnforcementLevel.EnforcedWithWarnings => 100, - EnforcementLevel.EnforcedWithFines => 100, - _ => 0 //C# enums can take on non-declared vaues. Sigh. - }; + EnforcementLevel.NoEnforcement => 0, + EnforcementLevel.EnforcedWithWarnings => 100, + EnforcementLevel.EnforcedWithFines => 100, + _ => 0 //C# enums can take on non-declared vaues. Sigh. + }; - SetComponent(entity, - new BudgetLineComponent - { - category = "Enforcement", - amount = newCost - }); + SetComponent(entity, + new BudgetLineComponent + {category = "Enforcement", + amount = newCost}); } } - } - } } diff --git a/isometric-park-fna/Engines/SimulationBridgeEngine.cs b/isometric-park-fna/Engines/SimulationBridgeEngine.cs --- a/isometric-park-fna/Engines/SimulationBridgeEngine.cs +++ b/isometric-park-fna/Engines/SimulationBridgeEngine.cs @@ -75,10 +75,6 @@ decimal new_contract_amount = 0M; decimal new_enforcement_amount = 0M; decimal new_misc_amount = 0M; - // decimal new_upkeep_amount = 0M; - - // this.simulation.PreserveCells.Clear(); - foreach (ref readonly var entity in ReadEntities()) { @@ -102,14 +98,11 @@ new_misc_amount += budgetComponent.amount; break; } - } - if (this.ticksToSend > 0) { - Logging.Trace(String.Format("{0} ticks to send in update", this.ticksToSend)); } if (this.ticksToSend > 1) @@ -120,21 +113,18 @@ { #region calculate_preserve_cells - // var preserve_cells = new HashSet(); var preserve_cell_coordinates = new List<(int, int)>(); - // var count = 0; Stopwatch iterPreserves = new Stopwatch(); iterPreserves.Start(); - foreach (ref readonly var entity in ReadEntities()) { - ref readonly var areaComponent = ref GetComponent(entity); + foreach (ref readonly var entity in ReadEntities()) { + ref readonly var areaComponent = ref GetComponent(entity); - foreach (var square in areaComponent.squares) { - // preserve_cells.Add(this.simulation.map.cells[(int)square.X][(int)square.Y]); - preserve_cell_coordinates.Add(((int)square.X, (int)square.Y)); - } - } + foreach (var square in areaComponent.squares) { + preserve_cell_coordinates.Add(((int)square.X, (int)square.Y)); + } + } iterPreserves.Stop(); Logging.Info(String.Format("Preserve entities: {0:F3}", iterPreserves.Elapsed.TotalMilliseconds.ToString())); @@ -167,15 +157,13 @@ } //*/ iterCells.Stop(); - Logging.Info(String.Format("Cell loop: {0:F3}", iterCells.Elapsed.TotalMilliseconds.ToString())); + Logging.Info(String.Format("Cell loop: {0:F3}", iterCells.Elapsed.TotalMilliseconds.ToString())); -#endregion - SendMessage(new TickMessage { SimulationDateTime = simulation.DateTime }); - //For now: - SendMessage(new SpawnContractMessage - { //max_squares = 100, - name = string.Format("#logging_company.capitalizeAll# {0}", this.simulation.DateTime.ToShortDateString()) - }); + #endregion + SendMessage(new TickMessage { SimulationDateTime = simulation.DateTime }); + //For now: + SendMessage(new SpawnContractMessage {name = string.Format("#logging_company.capitalizeAll# {0}", + this.simulation.DateTime.ToShortDateString()) }); #region events if (simulation.latestBudget.DateTime != default) @@ -187,12 +175,12 @@ SendMessage(new SpawnDialogMessage {Path = "EndLowFunds"}); } else if (simulation.latestBudget.money < 10_000M - && simulation.previousBudget.money >= 10_000M) + && simulation.previousBudget.money >= 10_000M) { SendMessage(new SpawnDialogMessage {Path = "VeryLowFunds"}); } else if (simulation.latestBudget.money < 25_000M - && simulation.previousBudget.money >= 25_000M) + && simulation.previousBudget.money >= 25_000M) { SendMessage(new SpawnDialogMessage {Path = "LowFunds"}); } diff --git a/isometric-park-fna/Simulation.cs b/isometric-park-fna/Simulation.cs --- a/isometric-park-fna/Simulation.cs +++ b/isometric-park-fna/Simulation.cs @@ -180,7 +180,6 @@ public CellMap map; - // public HashSet PreserveCells; public int[,] PreserveCounts; public int ticksPerAdvance; @@ -266,7 +265,6 @@ this.BridgeEngine = new SimulationBridgeEngine(this); - // this.PreserveCells = new HashSet(); this.PreserveCounts = new int[this.map.MapWidth, this.map.MapHeight]; } @@ -443,7 +441,6 @@ //through t=120, so that's what we want to track in lastAdvance. this.lastAdvance += advancesToSimulate * millisecondsPerAdvance; } - } } }