File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed
Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 11# Population
22All things related to the population are handled during the town's tick call.
33The following subsections explain the identified functions.
4+
5+ The game uses the following enum to represent the 4 population types:
6+ ``` c
7+ enum population_type : __int32
8+ {
9+ pt_rich = 0x0,
10+ pt_wealthy = 0x1,
11+ pt_poor = 0x2,
12+ pt_beggar = 0x3,
13+ };
14+ ```
Original file line number Diff line number Diff line change @@ -42,13 +42,6 @@ def __init__(
4242 dwellings_capacity_poor ,
4343 ]
4444
45- def get_divisor (self , level ):
46- if level == 0 :
47- return 213 if self .has_mint else 320
48- elif level == 1 :
49- return 160
50- raise Exception ()
51-
5245 def update_population_levels (self ):
5346 self .update_population_level (0 )
5447 self .update_population_level (1 )
@@ -63,7 +56,7 @@ def update_population_level(self, level: int):
6356 LOGGER .debug (f"{ level } target: { target } stock: { self .citizens [level ]} " )
6457 if target < self .citizens [level ]:
6558 # Current stock exceeds target
66- demoted = 2 * self .citizens [level ] / target + 1
59+ demoted = 2 * self .citizens [level ] // target + 1
6760 if demoted > self .citizens [level ]:
6861 demoted = self .citizens [level ] - 1
6962 self .citizens [2 ] += demoted
@@ -79,6 +72,13 @@ def update_population_level(self, level: int):
7972 self .citizens [2 ] -= promoted
8073 self .citizens [level ] += promoted
8174
75+ def get_divisor (self , level ):
76+ if level == 0 :
77+ return 213 if self .has_mint else 320
78+ elif level == 1 :
79+ return 160
80+ raise Exception ()
81+
8282
8383def plot_example1 ():
8484 plt .clf ()
You can’t perform that action at this time.
0 commit comments