Description:
Clean up indentation.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -12,48 +12,42 | |||
|
12 | 12 | [Reads(typeof(TrespassingPolicyComponent))] |
|
13 | 13 | [Writes(typeof(TrespassingPolicyComponent), |
|
14 | 14 | typeof(BudgetLineComponent))] |
|
15 | public class PolicyEngine : Engine | |
|
15 | public class PolicyEngine : Engine | |
|
16 | 16 | { |
|
17 | ||
|
18 | 17 | public PolicyEngine() |
|
19 | 18 | { |
|
20 | 19 | } |
|
21 | 20 | |
|
22 | ||
|
23 | 21 | public override void Update(double dt) |
|
24 | 22 | { |
|
25 | 23 | foreach (ref readonly var message |
|
26 |
|
|
|
24 | in ReadMessages<SetTrespassingPolicyMessage>()) | |
|
27 | 25 | { |
|
28 | 26 | foreach (ref readonly var entity |
|
29 |
|
|
|
27 | in ReadEntities<TrespassingPolicyComponent>()) | |
|
30 | 28 | { |
|
31 | 29 | |
|
32 | 30 | SetComponent<TrespassingPolicyComponent>(entity, |
|
33 | 31 | new TrespassingPolicyComponent |
|
34 | { | |
|
35 | tresspassingPolicy | |
|
36 | = message.newEnforcementLevel | |
|
37 | }); | |
|
32 | { | |
|
33 | tresspassingPolicy | |
|
34 | = message.newEnforcementLevel | |
|
35 | }); | |
|
38 | 36 | |
|
39 | 37 | var newCost = message.newEnforcementLevel switch { |
|
40 | 38 | EnforcementLevel.Unspecified => 0, |
|
41 | EnforcementLevel.NoEnforcement => 0, | |
|
42 | EnforcementLevel.EnforcedWithWarnings => 100, | |
|
43 | EnforcementLevel.EnforcedWithFines => 100, | |
|
44 | _ => 0 //C# enums can take on non-declared vaues. Sigh. | |
|
45 | }; | |
|
39 | EnforcementLevel.NoEnforcement => 0, | |
|
40 | EnforcementLevel.EnforcedWithWarnings => 100, | |
|
41 | EnforcementLevel.EnforcedWithFines => 100, | |
|
42 | _ => 0 //C# enums can take on non-declared vaues. Sigh. | |
|
43 | }; | |
|
46 | 44 | |
|
47 | SetComponent<BudgetLineComponent>(entity, | |
|
48 |
|
|
|
49 | { | |
|
50 |
|
|
|
51 | amount = newCost | |
|
52 | }); | |
|
45 | SetComponent<BudgetLineComponent>(entity, | |
|
46 | new BudgetLineComponent | |
|
47 | {category = "Enforcement", | |
|
48 | amount = newCost}); | |
|
53 | 49 | } |
|
54 | 50 | } |
|
55 | ||
|
56 | 51 | } |
|
57 | ||
|
58 | 52 | } |
|
59 | 53 | } |
@@ -75,10 +75,6 | |||
|
75 | 75 | decimal new_contract_amount = 0M; |
|
76 | 76 | decimal new_enforcement_amount = 0M; |
|
77 | 77 | decimal new_misc_amount = 0M; |
|
78 | // decimal new_upkeep_amount = 0M; | |
|
79 | ||
|
80 | // this.simulation.PreserveCells.Clear(); | |
|
81 | ||
|
82 | 78 | |
|
83 | 79 | foreach (ref readonly var entity in ReadEntities<BudgetLineComponent>()) |
|
84 | 80 | { |
@@ -102,14 +98,11 | |||
|
102 | 98 | new_misc_amount += budgetComponent.amount; |
|
103 | 99 | break; |
|
104 | 100 | } |
|
105 | ||
|
106 | 101 | } |
|
107 | 102 | |
|
108 | 103 | |
|
109 | ||
|
110 | 104 | if (this.ticksToSend > 0) |
|
111 | 105 | { |
|
112 | ||
|
113 | 106 | Logging.Trace(String.Format("{0} ticks to send in update", this.ticksToSend)); |
|
114 | 107 | } |
|
115 | 108 | if (this.ticksToSend > 1) |
@@ -120,21 +113,18 | |||
|
120 | 113 | { |
|
121 | 114 | |
|
122 | 115 | #region calculate_preserve_cells |
|
123 | // var preserve_cells = new HashSet<isometricparkfna.CellMap.Cell>(); | |
|
124 | 116 | var preserve_cell_coordinates = new List<(int, int)>(); |
|
125 | // var count = 0; | |
|
126 | 117 | |
|
127 | 118 | Stopwatch iterPreserves = new Stopwatch(); |
|
128 | 119 | iterPreserves.Start(); |
|
129 | 120 | |
|
130 |
|
|
|
131 |
|
|
|
121 | foreach (ref readonly var entity in ReadEntities<PreserveComponent>()) { | |
|
122 | ref readonly var areaComponent = ref GetComponent<AreaComponent>(entity); | |
|
132 | 123 | |
|
133 |
|
|
|
134 |
|
|
|
135 | preserve_cell_coordinates.Add(((int)square.X, (int)square.Y)); | |
|
136 | } | |
|
137 | } | |
|
124 | foreach (var square in areaComponent.squares) { | |
|
125 | preserve_cell_coordinates.Add(((int)square.X, (int)square.Y)); | |
|
126 | } | |
|
127 | } | |
|
138 | 128 | iterPreserves.Stop(); |
|
139 | 129 | Logging.Info(String.Format("Preserve entities: {0:F3}", iterPreserves.Elapsed.TotalMilliseconds.ToString())); |
|
140 | 130 | |
@@ -167,15 +157,13 | |||
|
167 | 157 | } |
|
168 | 158 | //*/ |
|
169 | 159 | iterCells.Stop(); |
|
170 |
|
|
|
160 | Logging.Info(String.Format("Cell loop: {0:F3}", iterCells.Elapsed.TotalMilliseconds.ToString())); | |
|
171 | 161 | |
|
172 | #endregion | |
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 | { //max_squares = 100, | |
|
177 | name = string.Format("#logging_company.capitalizeAll# {0}", this.simulation.DateTime.ToShortDateString()) | |
|
178 | }); | |
|
162 | #endregion | |
|
163 | SendMessage<TickMessage>(new TickMessage { SimulationDateTime = simulation.DateTime }); | |
|
164 | //For now: | |
|
165 | SendMessage<SpawnContractMessage>(new SpawnContractMessage {name = string.Format("#logging_company.capitalizeAll# {0}", | |
|
166 | this.simulation.DateTime.ToShortDateString()) }); | |
|
179 | 167 | |
|
180 | 168 | #region events |
|
181 | 169 | if (simulation.latestBudget.DateTime != default) |
@@ -187,12 +175,12 | |||
|
187 | 175 | SendMessage<SpawnDialogMessage>(new SpawnDialogMessage {Path = "EndLowFunds"}); |
|
188 | 176 | } |
|
189 | 177 | else if (simulation.latestBudget.money < 10_000M |
|
190 |
|
|
|
178 | && simulation.previousBudget.money >= 10_000M) | |
|
191 | 179 | { |
|
192 | 180 | SendMessage<SpawnDialogMessage>(new SpawnDialogMessage {Path = "VeryLowFunds"}); |
|
193 | 181 | } |
|
194 | 182 | else if (simulation.latestBudget.money < 25_000M |
|
195 |
|
|
|
183 | && simulation.previousBudget.money >= 25_000M) | |
|
196 | 184 | { |
|
197 | 185 | SendMessage<SpawnDialogMessage>(new SpawnDialogMessage {Path = "LowFunds"}); |
|
198 | 186 | } |
@@ -180,7 +180,6 | |||
|
180 | 180 | |
|
181 | 181 | public CellMap map; |
|
182 | 182 | |
|
183 | // public HashSet<Cell> PreserveCells; | |
|
184 | 183 | public int[,] PreserveCounts; |
|
185 | 184 | |
|
186 | 185 | public int ticksPerAdvance; |
@@ -266,7 +265,6 | |||
|
266 | 265 | |
|
267 | 266 | this.BridgeEngine = new SimulationBridgeEngine(this); |
|
268 | 267 | |
|
269 | // this.PreserveCells = new HashSet<Cell>(); | |
|
270 | 268 | this.PreserveCounts = new int[this.map.MapWidth, this.map.MapHeight]; |
|
271 | 269 | } |
|
272 | 270 | |
@@ -443,7 +441,6 | |||
|
443 | 441 | //through t=120, so that's what we want to track in lastAdvance. |
|
444 | 442 | this.lastAdvance += advancesToSimulate * millisecondsPerAdvance; |
|
445 | 443 | } |
|
446 | ||
|
447 | 444 | } |
|
448 | 445 | } |
|
449 | 446 | } |
You need to be logged in to leave comments.
Login now