Skip to content

Commit d0741df

Browse files
committed
overlay: renamed NO_COLUMN -> COLUMN_TYPE_NONE
1 parent 2736f78 commit d0741df

30 files changed

+80
-33
lines changed

src/overlays/city_overlay_apothecary.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ xstring city_overlay_apothecary::get_tooltip_for_building(tooltip_context* c, co
2828
int city_overlay_apothecary::get_column_height(const building *b) const {
2929
return b->house_size && b->subtype.house_level > 0
3030
? b->data.house.apothecary / 10
31-
: NO_COLUMN;
31+
: COLUMN_TYPE_NONE;
3232
}

src/overlays/city_overlay_bandstand.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ int city_overlay_bandstand::get_column_height(const building *b) const {
3838
return musician_value / 10;
3939
}
4040

41-
return NO_COLUMN;
41+
return COLUMN_TYPE_NONE;
4242
}

src/overlays/city_overlay_bazaar_access.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ city_overlay* city_overlay_for_bazaar_access() {
2121

2222
int city_overlay_bazaar_access::get_column_height(const building *b) const {
2323
if (b->house_population <= 0) {
24-
return NO_COLUMN;
24+
return COLUMN_TYPE_NONE;
2525
}
2626

2727
return std::clamp<int>(b->data.house.bazaar_access / 10, 0, 8);

src/overlays/city_overlay_courthouse.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int city_overlay_courthouse::get_column_height(const building *b) const {
2020
return 0;
2121
}
2222

23-
return NO_COLUMN;
23+
return COLUMN_TYPE_NONE;
2424
}
2525

2626
xstring city_overlay_courthouse::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_criminal.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ int city_overlay_crime::get_column_height(const building* b) const {
1919
int crime = b->house_criminal_active;
2020
return crime / 10;
2121
}
22-
return NO_COLUMN;
22+
return COLUMN_TYPE_NONE;
2323
}
2424

2525
xstring city_overlay_crime::get_tooltip_for_building(tooltip_context* c, const building* b) const {

src/overlays/city_overlay_damage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ city_overlay* city_overlay_for_damage() {
1616
int city_overlay_damage::get_column_height(const building *b) const {
1717
auto model = model_get_building(b->type);
1818
if (b->prev_part_building_id || !model->damage_risk)
19-
return NO_COLUMN;
19+
return COLUMN_TYPE_NONE;
2020
return b->damage_risk / 100;
2121
}
2222

src/overlays/city_overlay_dentist.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ city_overlay* city_overlay_for_dentist() {
1212
}
1313

1414
int city_overlay_dentist::get_column_height(const building *b) const {
15-
return b->house_size && b->data.house.dentist ? b->data.house.dentist / 10 : NO_COLUMN;
15+
return b->house_size && b->data.house.dentist ? b->data.house.dentist / 10 : COLUMN_TYPE_NONE;
1616
}
1717

1818
xstring city_overlay_dentist::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_desirability.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ inline bool city_overlay_desirability::show_figure(const figure *f) const {
8686
}
8787

8888
int city_overlay_desirability::get_column_height(const building *b) const {
89-
return NO_COLUMN;
89+
return COLUMN_TYPE_NONE;
9090
}
9191

9292
inline void city_overlay_desirability::draw_custom_top(vec2i pixel, tile2i point, painter &ctx) const {

src/overlays/city_overlay_education.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ city_overlay* city_overlay_for_academy() {
2424
}
2525

2626
int city_overlay_education::get_column_height(const building *b) const {
27-
return b->house_size && b->data.house.education ? b->data.house.education * 3 - 1 : NO_COLUMN;
27+
return b->house_size && b->data.house.education ? b->data.house.education * 3 - 1 : COLUMN_TYPE_NONE;
2828
}
2929

3030
xstring city_overlay_education::get_tooltip_for_building(tooltip_context *c, const building *b) const {
@@ -54,11 +54,11 @@ xstring city_overlay_academy::get_tooltip_for_building(tooltip_context *c, const
5454
}
5555

5656
int city_overlay_academy::get_column_height(const building *b) const {
57-
return b->house_size && b->data.house.academy ? b->data.house.academy / 10 : NO_COLUMN;
57+
return b->house_size && b->data.house.academy ? b->data.house.academy / 10 : COLUMN_TYPE_NONE;
5858
}
5959

6060
int city_overlay_libraries::get_column_height(const building *b) const {
61-
return b->house_size && b->data.house.library ? b->data.house.library / 10 : NO_COLUMN;
61+
return b->house_size && b->data.house.library ? b->data.house.library / 10 : COLUMN_TYPE_NONE;
6262
}
6363

6464
xstring city_overlay_libraries::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_entertainment.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ city_overlay* city_overlay_for_entertainment() {
1010
}
1111

1212
int city_overlay_entertainment::get_column_height(const building *b) const {
13-
return b->house_size ? b->data.house.entertainment / 10 : NO_COLUMN;
13+
return b->house_size ? b->data.house.entertainment / 10 : COLUMN_TYPE_NONE;
1414
}
1515

1616
xstring city_overlay_entertainment::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_fertility.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ xstring city_overlay_fertility::get_tooltip_for_building(tooltip_context *c, con
8787
}
8888

8989
int city_overlay_fertility::get_column_height(const building *b) const {
90-
return NO_COLUMN;
90+
return COLUMN_TYPE_NONE;
9191
}
9292

9393
inline bool city_overlay_fertility::show_building(const building *b) const {

src/overlays/city_overlay_fire.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ int city_overlay_fire::get_column_height(const building *b) const {
1616
auto model = model_get_building(b->type);
1717

1818
if (b->prev_part_building_id || b->fire_proof)
19-
return NO_COLUMN;
19+
return COLUMN_TYPE_NONE;
2020

2121
if (b->type == BUILDING_HOUSE_VACANT_LOT || b->type == BUILDING_GARDENS
2222
|| b->type == BUILDING_BANDSTAND || b->type == BUILDING_BOOTH) {
23-
return NO_COLUMN;
23+
return COLUMN_TYPE_NONE;
2424
}
2525

2626
return b->fire_risk / 100;

src/overlays/city_overlay_fwd.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
enum e_column_type {
4+
COLUMN_TYPE_NONE = -1,
45
COLUMN_TYPE_RISK,
56
COLUMN_TYPE_POSITIVE,
67
COLUMN_TYPE_WATER_ACCESS,
@@ -9,6 +10,7 @@ enum e_column_type {
910
};
1011

1112
enum e_column_color {
13+
COLUMN_COLOR_NONE = -1,
1214
COLUMN_COLOR_PLAIN = 0,
1315
COLUMN_COLOR_YELLOW = 3,
1416
COLUMN_COLOR_ORANGE = 6,

src/overlays/city_overlay_health.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ city_overlay* city_overlay_for_health() {
1111
}
1212

1313
int city_overlay_health::get_column_height(const building *b) const {
14-
if (!b->house_size || !b->house_population) {
15-
return NO_COLUMN;
14+
if (!b->house_size || b->house_population <= 0) {
15+
return COLUMN_TYPE_NONE;
1616
}
1717

1818
if (b->disease_days > 0) {
@@ -22,6 +22,16 @@ int city_overlay_health::get_column_height(const building *b) const {
2222
return (100 - b->common_health) / 10;
2323
}
2424

25+
e_column_color city_overlay_health::get_column_color(const building *b) const {
26+
if (!b->house_size || b->house_population <= 0) {
27+
return COLUMN_COLOR_NONE;
28+
}
29+
30+
if (b->disease_days > 0) {
31+
return COLUMN_COLOR_RED;
32+
}
33+
}
34+
2535
xstring city_overlay_health::get_tooltip_for_building(tooltip_context *c, const building *b) const {
2636
if (b->disease_days > 0) {
2737
return ui::str(66, 131);

src/overlays/city_overlay_health.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
struct city_overlay_health : public city_overlay_t<OVERLAY_HEALTH> {
66
virtual int get_column_height(const building *b) const override;
7+
virtual e_column_color get_column_color(const building *b) const override;
78
virtual xstring get_tooltip_for_building(tooltip_context *c, const building *b) const override;
89
};
910

src/overlays/city_overlay_juggler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int city_overlay_booth::get_column_height(const building *b) const {
1818
}
1919
}
2020

21-
return NO_COLUMN;
21+
return COLUMN_TYPE_NONE;
2222
}
2323

2424
xstring city_overlay_booth::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_labor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ bool city_overlay_labor::show_figure(const figure *f) const {
2323

2424
int city_overlay_labor::get_column_height(const building *b) const {
2525
if (b->state == BUILDING_STATE_VALID) {
26-
return NO_COLUMN;
26+
return COLUMN_TYPE_NONE;
2727
}
2828

2929
int need_workers = model_get_building(b->type)->laborers;
3030
if (!need_workers) {
31-
return NO_COLUMN;
31+
return COLUMN_TYPE_NONE;
3232
}
3333

3434
int percentage = ((building*)b)->worker_percentage();

src/overlays/city_overlay_mortuary.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ city_overlay* city_overlay_for_mortuary() {
1212
}
1313

1414
int city_overlay_mortuary::get_column_height(const building *b) const {
15-
return b->house_size && b->data.house.mortuary ? b->data.house.mortuary / 10 : NO_COLUMN;
15+
return b->house_size && b->data.house.mortuary ? b->data.house.mortuary / 10 : COLUMN_TYPE_NONE;
1616
}
1717

1818
xstring city_overlay_mortuary::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_other.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int city_overlay_food_stocks::get_column_height(const building *b) const {
4343
if (pct_stocks <= 200)
4444
return 1;
4545
}
46-
return NO_COLUMN;
46+
return COLUMN_TYPE_NONE;
4747
}
4848

4949
xstring city_overlay_food_stocks::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_pavilion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bool city_overlay_pavilion::show_figure(const figure *f) const {
2929
int city_overlay_pavilion::get_column_height(const building *b) const {
3030
return (b->house_size)
3131
? b->data.house.pavillion_dancer / 10
32-
: NO_COLUMN;
32+
: COLUMN_TYPE_NONE;
3333
}
3434

3535
xstring city_overlay_pavilion::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_physician.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int city_overlay_physician::get_column_height(const building *b) const {
1616
? b->data.house.physician
1717
? b->data.house.physician / 10
1818
: 0
19-
: NO_COLUMN;
19+
: COLUMN_TYPE_NONE;
2020
}
2121

2222
xstring city_overlay_physician::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_religion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ city_overlay* city_overlay_for_religion_bast() {
5050
int city_overlay_religion::get_column_height(const building *b) const {
5151
return b->house_size && b->data.house.num_gods
5252
? b->data.house.num_gods * 17 / 10
53-
: NO_COLUMN;
53+
: COLUMN_TYPE_NONE;
5454
}
5555

5656
xstring city_overlay_religion::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_religion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct city_overlay_religion_god : public city_overlay_t<TYPE> {
1919

2020
virtual int get_column_height(const building *b) const override {
2121
if (!b->house_size) {
22-
return NO_COLUMN;
22+
return COLUMN_TYPE_NONE;
2323
}
2424

2525
int value = 0;

src/overlays/city_overlay_risks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool city_overlay_problems::show_figure(const figure *f) const {
6060
}
6161

6262
int city_overlay_problems::get_column_height(const building *b) const {
63-
return NO_COLUMN;
63+
return COLUMN_TYPE_NONE;
6464
}
6565

6666
bool city_overlay_problems::show_building(const building *b) const {
@@ -113,7 +113,7 @@ bool city_overlay_native::draw_custom_footprint(vec2i pixel, tile2i tile, painte
113113
}
114114

115115
int city_overlay_native::get_column_height(const building *b) const {
116-
return NO_COLUMN;
116+
return COLUMN_TYPE_NONE;
117117
}
118118

119119
bool city_overlay_native::show_building(const building *b) const {

src/overlays/city_overlay_routing.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ inline bool city_overlay_routing::show_figure(const figure *f) const {
3131
}
3232

3333
int city_overlay_routing::get_column_height(const building *b) const {
34-
return NO_COLUMN;
34+
return COLUMN_TYPE_NONE;
3535
}
3636

3737
inline void city_overlay_routing::draw_custom_top(vec2i pixel, map_point point, painter &ctx) const {

src/overlays/city_overlay_school.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ city_overlay* city_overlay_for_scribal_school() {
1414

1515
int city_overlay_schools::get_column_height(const building *b) const {
1616
if (b->house_size == 0) {
17-
return NO_COLUMN;
17+
return COLUMN_TYPE_NONE;
1818
}
1919

2020
return b->data.house.school / 10;

src/overlays/city_overlay_senet_house.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ city_overlay *city_overlay_for_senet_house() {
1010
}
1111

1212
int city_overlay_senet_house::get_column_height(const building *b) const {
13-
return b->house_size ? b->data.house.senet_player / 10 : NO_COLUMN;
13+
return b->house_size ? b->data.house.senet_player / 10 : COLUMN_TYPE_NONE;
1414
}
1515

1616
xstring city_overlay_senet_house::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_tax_income.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int city_overlay_tax_income::get_column_height(const building *b) const {
2222
}
2323
}
2424

25-
return NO_COLUMN;
25+
return COLUMN_TYPE_NONE;
2626
}
2727

2828
xstring city_overlay_tax_income::get_tooltip_for_building(tooltip_context *c, const building *b) const {

src/overlays/city_overlay_water.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ xstring city_overlay_water::get_tooltip_for_grid_offset(tooltip_context* c, int
100100
}
101101

102102
int city_overlay_water::get_column_height(const building *b) const {
103-
return b->house_size ? b->data.house.water_supply * 17 / 10 : NO_COLUMN;
103+
return b->house_size ? b->data.house.water_supply * 17 / 10 : COLUMN_TYPE_NONE;
104104
}

0 commit comments

Comments
 (0)