Description:
Tweak calculations.
Prevent a negative number of visitors and separate visitors from donors.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -103,26 +103,33 | |||
|
103 | 103 | } |
|
104 | 104 | } |
|
105 | 105 | |
|
106 | ||
|
106 | 107 | #region calculate_entry |
|
107 | 108 | |
|
108 | 109 | |
|
110 | int new_visitor_count = 0; | |
|
109 | 111 | foreach (ref readonly var entity in ReadEntities<EntryPolicyComponent>()) |
|
110 | 112 | { |
|
111 | 113 | var entry_policy_component = GetComponent<EntryPolicyComponent>(entity); |
|
112 | 114 | |
|
113 | 115 | if (entry_policy_component.PrimaryEntryPolicy == EntryPolicy.EntryFee) |
|
114 | 116 | { |
|
115 | new_entry_fees = (decimal)(this.simulation.visitor_count * entry_policy_component.PrimaryEntryFee); | |
|
117 | // | |
|
118 | new_visitor_count = max(0, (int)((this.simulation.map.tree_count / 11) * ((10.00M -entry_policy_component.PrimaryEntryFee) / 10.00M))); | |
|
119 | new_entry_fees = (decimal)(new_visitor_count * entry_policy_component.PrimaryEntryFee); | |
|
116 | 120 | } |
|
117 | 121 | else if (entry_policy_component.PrimaryEntryPolicy == EntryPolicy.Free) |
|
118 | 122 | { |
|
123 | new_visitor_count = (this.simulation.map.tree_count / 11); | |
|
119 | 124 | new_entry_fees = 0M; |
|
120 | 125 | } |
|
121 | 126 | else { |
|
122 |
new_ |
|
|
127 | new_visitor_count = (this.simulation.map.tree_count / 11); | |
|
128 | var donor_count = max(0, (int)(new_visitor_count * ((10.00M -entry_policy_component.PrimaryEntryFee) / 10.00M))); | |
|
129 | new_entry_fees = (decimal)(donor_count * entry_policy_component.PrimaryEntryFee); | |
|
123 | 130 | Logging.Spy(new {visitor_count = this.simulation.visitor_count, new_entry_fees = new_entry_fees}); |
|
124 | 131 | } |
|
125 | ||
|
132 | this.simulation.visitor_count = new_visitor_count; | |
|
126 | 133 | // new_entry_fees = |
|
127 | 134 | } |
|
128 | 135 |
You need to be logged in to leave comments.
Login now