1 #include "figures.h"
2 
3 #include "city/data_private.h"
4 
city_figures_reset(void)5 void city_figures_reset(void)
6 {
7     city_data.figure.enemies = 0;
8     city_data.figure.rioters = 0;
9     city_data.figure.looters = 0;
10     city_data.figure.robbers = 0;
11     city_data.figure.protesters = 0;
12     city_data.figure.attacking_natives = 0;
13     city_data.figure.animals = 0;
14     city_data.figure.imperial_soldiers = 0;
15     city_data.figure.soldiers = 0;
16     if (city_data.figure.security_breach_duration > 0) {
17         city_data.figure.security_breach_duration--;
18     }
19 }
20 
city_figures_add_animal(void)21 void city_figures_add_animal(void)
22 {
23     city_data.figure.animals++;
24 }
25 
city_figures_add_attacking_native(void)26 void city_figures_add_attacking_native(void)
27 {
28     city_data.figure.security_breach_duration = 10;
29     city_data.figure.attacking_natives++;
30 }
31 
city_figures_add_enemy(void)32 void city_figures_add_enemy(void)
33 {
34     city_data.figure.enemies++;
35 }
36 
city_figures_add_imperial_soldier(void)37 void city_figures_add_imperial_soldier(void)
38 {
39     city_data.figure.imperial_soldiers++;
40 }
41 
city_figures_add_rioter(int is_attacking)42 void city_figures_add_rioter(int is_attacking)
43 {
44     city_data.figure.rioters++;
45     if (is_attacking) {
46         city_data.figure.security_breach_duration = 10;
47     }
48 }
49 
city_figures_add_looter(int is_attacking)50 void city_figures_add_looter(int is_attacking)
51 {
52     city_data.figure.looters++;
53     if (is_attacking) {
54         city_data.figure.security_breach_duration = 10;
55     }
56 }
57 
city_figures_add_robber(int is_attacking)58 void city_figures_add_robber(int is_attacking)
59 {
60     city_data.figure.robbers++;
61     if (is_attacking) {
62         city_data.figure.security_breach_duration = 10;
63     }
64 }
65 
city_figures_add_protester(void)66 void city_figures_add_protester(void)
67 {
68     city_data.figure.protesters++;
69 }
70 
city_figures_add_soldier(void)71 void city_figures_add_soldier(void)
72 {
73     city_data.figure.soldiers++;
74 }
75 
city_figures_set_gladiator_revolt(void)76 void city_figures_set_gladiator_revolt(void)
77 {
78     city_data.figure.attacking_natives = 10;
79 }
80 
city_figures_animals(void)81 int city_figures_animals(void)
82 {
83     return city_data.figure.animals;
84 }
85 
city_figures_attacking_natives(void)86 int city_figures_attacking_natives(void)
87 {
88     return city_data.figure.attacking_natives;
89 }
90 
city_figures_imperial_soldiers(void)91 int city_figures_imperial_soldiers(void)
92 {
93     return city_data.figure.imperial_soldiers;
94 }
95 
city_figures_enemies(void)96 int city_figures_enemies(void)
97 {
98     return city_data.figure.enemies;
99 }
100 
city_figures_rioters(void)101 int city_figures_rioters(void)
102 {
103     return city_data.figure.rioters;
104 }
105 
city_figures_looters(void)106 int city_figures_looters(void)
107 {
108     return city_data.figure.looters;
109 }
110 
city_figures_robbers(void)111 int city_figures_robbers(void)
112 {
113     return city_data.figure.robbers;
114 }
115 
city_figures_protesters(void)116 int city_figures_protesters(void)
117 {
118     return city_data.figure.protesters;
119 }
120 
city_figures_criminals(void)121 int city_figures_criminals(void)
122 {
123     return city_figures_rioters() + city_figures_looters() + city_figures_robbers();
124 }
125 
city_figures_soldiers(void)126 int city_figures_soldiers(void)
127 {
128     return city_data.figure.soldiers;
129 }
130 
city_figures_total_invading_enemies(void)131 int city_figures_total_invading_enemies(void)
132 {
133     return city_data.figure.imperial_soldiers + city_data.figure.enemies;
134 }
135 
city_figures_has_security_breach(void)136 int city_figures_has_security_breach(void)
137 {
138     return city_data.figure.security_breach_duration > 0;
139 }
140