1 #include "city_overlay_health.h"
2
3 #include "game/state.h"
4
show_building_barber(const building * b)5 static int show_building_barber(const building *b)
6 {
7 return b->type == BUILDING_BARBER;
8 }
9
show_building_bathhouse(const building * b)10 static int show_building_bathhouse(const building *b)
11 {
12 return b->type == BUILDING_BATHHOUSE;
13 }
14
show_building_clinic(const building * b)15 static int show_building_clinic(const building *b)
16 {
17 return b->type == BUILDING_DOCTOR;
18 }
19
show_building_hospital(const building * b)20 static int show_building_hospital(const building *b)
21 {
22 return b->type == BUILDING_HOSPITAL;
23 }
24
show_figure_barber(const figure * f)25 static int show_figure_barber(const figure *f)
26 {
27 return f->type == FIGURE_BARBER;
28 }
29
show_figure_bathhouse(const figure * f)30 static int show_figure_bathhouse(const figure *f)
31 {
32 return f->type == FIGURE_BATHHOUSE_WORKER;
33 }
34
show_figure_clinic(const figure * f)35 static int show_figure_clinic(const figure *f)
36 {
37 return f->type == FIGURE_DOCTOR;
38 }
39
show_figure_hospital(const figure * f)40 static int show_figure_hospital(const figure *f)
41 {
42 return f->type == FIGURE_SURGEON;
43 }
44
get_column_height_barber(const building * b)45 static int get_column_height_barber(const building *b)
46 {
47 return b->house_size && b->data.house.barber ? b->data.house.barber / 10 : NO_COLUMN;
48 }
49
get_column_height_bathhouse(const building * b)50 static int get_column_height_bathhouse(const building *b)
51 {
52 return b->house_size && b->data.house.bathhouse ? b->data.house.bathhouse / 10 : NO_COLUMN;
53 }
54
get_column_height_clinic(const building * b)55 static int get_column_height_clinic(const building *b)
56 {
57 return b->house_size && b->data.house.clinic ? b->data.house.clinic / 10 : NO_COLUMN;
58 }
59
get_column_height_hospital(const building * b)60 static int get_column_height_hospital(const building *b)
61 {
62 return b->house_size && b->data.house.hospital ? b->data.house.hospital / 10 : NO_COLUMN;
63 }
64
get_tooltip_barber(tooltip_context * c,const building * b)65 static int get_tooltip_barber(tooltip_context *c, const building *b)
66 {
67 if (b->data.house.barber <= 0) {
68 return 31;
69 } else if (b->data.house.barber >= 80) {
70 return 32;
71 } else if (b->data.house.barber < 20) {
72 return 33;
73 } else {
74 return 34;
75 }
76 }
77
get_tooltip_bathhouse(tooltip_context * c,const building * b)78 static int get_tooltip_bathhouse(tooltip_context *c, const building *b)
79 {
80 if (b->data.house.bathhouse <= 0) {
81 return 8;
82 } else if (b->data.house.bathhouse >= 80) {
83 return 9;
84 } else if (b->data.house.bathhouse >= 20) {
85 return 10;
86 } else {
87 return 11;
88 }
89 }
90
get_tooltip_clinic(tooltip_context * c,const building * b)91 static int get_tooltip_clinic(tooltip_context *c, const building *b)
92 {
93 if (b->data.house.clinic <= 0) {
94 return 35;
95 } else if (b->data.house.clinic >= 80) {
96 return 36;
97 } else if (b->data.house.clinic >= 20) {
98 return 37;
99 } else {
100 return 38;
101 }
102 }
103
get_tooltip_hospital(tooltip_context * c,const building * b)104 static int get_tooltip_hospital(tooltip_context *c, const building *b)
105 {
106 if (b->data.house.hospital <= 0) {
107 return 39;
108 } else if (b->data.house.hospital >= 80) {
109 return 40;
110 } else if (b->data.house.hospital >= 20) {
111 return 41;
112 } else {
113 return 42;
114 }
115 }
116
city_overlay_for_barber(void)117 const city_overlay *city_overlay_for_barber(void)
118 {
119 static city_overlay overlay = {
120 OVERLAY_BARBER,
121 COLUMN_COLOR_GREEN_TO_RED,
122 show_building_barber,
123 show_figure_barber,
124 get_column_height_barber,
125 0,
126 get_tooltip_barber,
127 0,
128 0
129 };
130 return &overlay;
131 }
132
city_overlay_for_bathhouse(void)133 const city_overlay *city_overlay_for_bathhouse(void)
134 {
135 static city_overlay overlay = {
136 OVERLAY_BATHHOUSE,
137 COLUMN_COLOR_GREEN_TO_RED,
138 show_building_bathhouse,
139 show_figure_bathhouse,
140 get_column_height_bathhouse,
141 0,
142 get_tooltip_bathhouse,
143 0,
144 0
145 };
146 return &overlay;
147 }
148
city_overlay_for_clinic(void)149 const city_overlay *city_overlay_for_clinic(void)
150 {
151 static city_overlay overlay = {
152 OVERLAY_CLINIC,
153 COLUMN_COLOR_GREEN_TO_RED,
154 show_building_clinic,
155 show_figure_clinic,
156 get_column_height_clinic,
157 0,
158 get_tooltip_clinic,
159 0,
160 0
161 };
162 return &overlay;
163 }
164
city_overlay_for_hospital(void)165 const city_overlay *city_overlay_for_hospital(void)
166 {
167 static city_overlay overlay = {
168 OVERLAY_HOSPITAL,
169 COLUMN_COLOR_GREEN_TO_RED,
170 show_building_hospital,
171 show_figure_hospital,
172 get_column_height_hospital,
173 0,
174 get_tooltip_hospital,
175 0,
176 0
177 };
178 return &overlay;
179 }
180