diff --git a/src/core/hotkey_config.c b/src/core/hotkey_config.c index 538ad2cb22..41fdb1494b 100644 --- a/src/core/hotkey_config.c +++ b/src/core/hotkey_config.c @@ -99,9 +99,6 @@ static const char *ini_keys[] = { "undo", "mothball_toggle", "storage_order", - "show_overlay_efficiency", - "show_overlay_food_stocks", - "show_overlay_logistics", "show_overlay_entertainment", "show_overlay_education", "show_overlay_school", @@ -113,13 +110,17 @@ static const char *ini_keys[] = { "show_overlay_clinic", "show_overlay_hospital", "show_overlay_sickness", + "show_overlay_logistics", + "show_overlay_food_stocks", + "show_overlay_efficiency", + "show_overlay_mothball", "show_overlay_tax_income", + "show_overlay_levy", + "show_overlay_employment", + "show_overlay_religion", "show_overlay_desirability", "show_overlay_sentiment", - "show_overlay_mothball", - "show_overlay_religion", "show_overlay_roads", - "show_overlay_levy", "rotate_map_north", "build_wheat_farm", "show_empire_map", diff --git a/src/core/hotkey_config.h b/src/core/hotkey_config.h index 943d037875..9b95333f0b 100644 --- a/src/core/hotkey_config.h +++ b/src/core/hotkey_config.h @@ -85,9 +85,6 @@ typedef enum { HOTKEY_UNDO, HOTKEY_MOTHBALL_TOGGLE, HOTKEY_STORAGE_ORDER, - HOTKEY_SHOW_OVERLAY_EFFICIENCY, - HOTKEY_SHOW_OVERLAY_FOOD_STOCKS, - HOTKEY_SHOW_OVERLAY_LOGISTICS, HOTKEY_SHOW_OVERLAY_ENTERTAINMENT, HOTKEY_SHOW_OVERLAY_EDUCATION, HOTKEY_SHOW_OVERLAY_SCHOOL, @@ -99,13 +96,17 @@ typedef enum { HOTKEY_SHOW_OVERLAY_CLINIC, HOTKEY_SHOW_OVERLAY_HOSPITAL, HOTKEY_SHOW_OVERLAY_SICKNESS, + HOTKEY_SHOW_OVERLAY_LOGISTICS, + HOTKEY_SHOW_OVERLAY_FOOD_STOCKS, + HOTKEY_SHOW_OVERLAY_EFFICIENCY, + HOTKEY_SHOW_OVERLAY_MOTHBALL, HOTKEY_SHOW_OVERLAY_TAX_INCOME, + HOTKEY_SHOW_OVERLAY_LEVY, + HOTKEY_SHOW_OVERLAY_EMPLOYMENT, + HOTKEY_SHOW_OVERLAY_RELIGION, HOTKEY_SHOW_OVERLAY_DESIRABILITY, HOTKEY_SHOW_OVERLAY_SENTIMENT, - HOTKEY_SHOW_OVERLAY_MOTHBALL, - HOTKEY_SHOW_OVERLAY_RELIGION, HOTKEY_SHOW_OVERLAY_ROADS, - HOTKEY_SHOW_OVERLAY_LEVY, HOTKEY_ROTATE_MAP_NORTH, HOTKEY_BUILD_WHEAT_FARM, HOTKEY_SHOW_EMPIRE_MAP, diff --git a/src/game/state.h b/src/game/state.h index 25bd2749f3..5201568672 100644 --- a/src/game/state.h +++ b/src/game/state.h @@ -39,6 +39,7 @@ enum { OVERLAY_EFFICIENCY = 39, OVERLAY_STORAGES = 40, OVERLAY_HEALTH = 41, + OVERLAY_EMPLOYMENT = 42, }; void game_state_init(void); diff --git a/src/input/hotkey.c b/src/input/hotkey.c index deb7ce5d8d..e893c1e6e8 100644 --- a/src/input/hotkey.c +++ b/src/input/hotkey.c @@ -327,18 +327,6 @@ static void set_definition_for_action(hotkey_action action, hotkey_definition *d case HOTKEY_PASTE_BUILDING_SETTINGS: def->action = &data.hotkey_state.paste_building_settings; break; - case HOTKEY_SHOW_OVERLAY_EFFICIENCY: - def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_EFFICIENCY; - break; - case HOTKEY_SHOW_OVERLAY_FOOD_STOCKS: - def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_FOOD_STOCKS; - break; - case HOTKEY_SHOW_OVERLAY_LOGISTICS: - def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_LOGISTICS; - break; case HOTKEY_SHOW_OVERLAY_ENTERTAINMENT: def->action = &data.hotkey_state.show_overlay; def->value = OVERLAY_ENTERTAINMENT; @@ -383,33 +371,49 @@ static void set_definition_for_action(hotkey_action action, hotkey_definition *d def->action = &data.hotkey_state.show_overlay; def->value = OVERLAY_SICKNESS; break; - case HOTKEY_SHOW_OVERLAY_TAX_INCOME: + case HOTKEY_SHOW_OVERLAY_LOGISTICS: def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_TAX_INCOME; + def->value = OVERLAY_LOGISTICS; break; - case HOTKEY_SHOW_OVERLAY_DESIRABILITY: + case HOTKEY_SHOW_OVERLAY_FOOD_STOCKS: def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_DESIRABILITY; + def->value = OVERLAY_FOOD_STOCKS; break; - case HOTKEY_SHOW_OVERLAY_SENTIMENT: + case HOTKEY_SHOW_OVERLAY_EFFICIENCY: def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_SENTIMENT; + def->value = OVERLAY_EFFICIENCY; break; case HOTKEY_SHOW_OVERLAY_MOTHBALL: def->action = &data.hotkey_state.show_overlay; def->value = OVERLAY_MOTHBALL; break; + case HOTKEY_SHOW_OVERLAY_TAX_INCOME: + def->action = &data.hotkey_state.show_overlay; + def->value = OVERLAY_TAX_INCOME; + break; + case HOTKEY_SHOW_OVERLAY_LEVY: + def->action = &data.hotkey_state.show_overlay; + def->value = OVERLAY_LEVY; + break; + case HOTKEY_SHOW_OVERLAY_EMPLOYMENT: + def->action = &data.hotkey_state.show_overlay; + def->value = OVERLAY_EMPLOYMENT; + break; case HOTKEY_SHOW_OVERLAY_RELIGION: def->action = &data.hotkey_state.show_overlay; def->value = OVERLAY_RELIGION; break; - case HOTKEY_SHOW_OVERLAY_ROADS: + case HOTKEY_SHOW_OVERLAY_DESIRABILITY: def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_ROADS; + def->value = OVERLAY_DESIRABILITY; break; - case HOTKEY_SHOW_OVERLAY_LEVY: + case HOTKEY_SHOW_OVERLAY_SENTIMENT: def->action = &data.hotkey_state.show_overlay; - def->value = OVERLAY_LEVY; + def->value = OVERLAY_SENTIMENT; + break; + case HOTKEY_SHOW_OVERLAY_ROADS: + def->action = &data.hotkey_state.show_overlay; + def->value = OVERLAY_ROADS; break; case HOTKEY_ROTATE_MAP_NORTH: def->action = &data.hotkey_state.rotate_map_north; diff --git a/src/translation/english.c b/src/translation/english.c index f7603a76bf..5e95bef8ba 100644 --- a/src/translation/english.c +++ b/src/translation/english.c @@ -469,7 +469,12 @@ static translation_string all_strings[] = { {TR_BUTTON_BACK_TO_MAIN_MENU, "Exit to main menu" }, {TR_LABEL_PAUSE_MENU, "Pause" }, {TR_OVERLAY_LEVY, "Levies" }, - {TR_TOOLTIP_OVERLAY_LEVY, " denarii paid monthly in levies." }, + {TR_TOOLTIP_OVERLAY_LEVY, " denarii paid monthly in levies" }, + {TR_OVERLAY_EMPLOYMENT, "Employment" }, + {TR_TOOLTIP_OVERLAY_EMPLOYMENT_FULL, "This building is fully staffed" }, + {TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_1, " employee needed in this building" }, + {TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_2, " employees needed in this building" }, + {TR_TOOLTIP_OVERLAY_EMPLOYMENT_MOTHBALL, " employees needed in this building (mothballed)" }, {TR_MAP_EDITOR_OPTIONS, "Scenario settings" }, {TR_BUILDING_TAVERN, "Tavern" }, {TR_BUILDING_GRAND_GARDEN, "Grand garden" }, @@ -851,6 +856,7 @@ static translation_string all_strings[] = { {TR_HOTKEY_SHOW_OVERLAY_RELIGION, "Religion overlay" }, {TR_HOTKEY_SHOW_OVERLAY_ROADS, "Roads overlay" }, {TR_HOTKEY_SHOW_OVERLAY_LEVY, "Levies overlay" }, + {TR_HOTKEY_SHOW_OVERLAY_EMPLOYMENT, "Employment overlay" }, {TR_HOTKEY_ROTATE_MAP_NORTH, "Rotate map to North" }, {TR_HOTKEY_BUILD_WHEAT_FARM, "Wheat farm" }, {TR_HOTKEY_SHOW_MESSAGES, "Show messages"}, diff --git a/src/translation/translation.h b/src/translation/translation.h index b8c2549b95..510cea757d 100644 --- a/src/translation/translation.h +++ b/src/translation/translation.h @@ -463,6 +463,11 @@ typedef enum { TR_LABEL_PAUSE_MENU, TR_OVERLAY_LEVY, TR_TOOLTIP_OVERLAY_LEVY, + TR_OVERLAY_EMPLOYMENT, + TR_TOOLTIP_OVERLAY_EMPLOYMENT_FULL, + TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_1, + TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_2, + TR_TOOLTIP_OVERLAY_EMPLOYMENT_MOTHBALL, TR_MAP_EDITOR_OPTIONS, TR_BUILDING_TAVERN, TR_BUILDING_GRAND_GARDEN, @@ -846,6 +851,7 @@ typedef enum { TR_HOTKEY_SHOW_OVERLAY_RELIGION, TR_HOTKEY_SHOW_OVERLAY_ROADS, TR_HOTKEY_SHOW_OVERLAY_LEVY, + TR_HOTKEY_SHOW_OVERLAY_EMPLOYMENT, TR_HOTKEY_ROTATE_MAP_NORTH, TR_HOTKEY_BUILD_WHEAT_FARM, TR_HOTKEY_SHOW_MESSAGES, diff --git a/src/widget/city_overlay_other.c b/src/widget/city_overlay_other.c index ff71b90828..3d93457a44 100644 --- a/src/widget/city_overlay_other.c +++ b/src/widget/city_overlay_other.c @@ -1,6 +1,7 @@ #include "city_overlay_other.h" #include "building/animation.h" +#include "building/building.h" #include "building/industry.h" #include "building/model.h" #include "building/monument.h" @@ -160,6 +161,11 @@ static int show_figure_logistics(const figure *f) return f->type == FIGURE_WAREHOUSEMAN || f->type == FIGURE_DEPOT_CART_PUSHER; } +static int show_figure_employment(const figure *f) +{ + return f->type == FIGURE_LABOR_SEEKER; +} + static int show_figure_none(const figure *f) { return 0; @@ -220,6 +226,18 @@ static int get_column_height_tax_income(const building *b) return NO_COLUMN; } +static int get_column_height_employment(const building *b) +{ + int full_staff = building_get_laborers(b->type); + int pct_staff = calc_percentage(b->num_workers, full_staff); + + int height = 100 - pct_staff; + if (height == 0) { + return NO_COLUMN; + } + return full_staff ? height / 10 : NO_COLUMN; +} + static int get_column_height_none(const building *b) { return NO_COLUMN; @@ -342,6 +360,34 @@ static int get_tooltip_tax_income(tooltip_context *c, const building *b) } } +static int get_tooltip_employment(tooltip_context *c, const building *b) +{ + int full = building_get_laborers(b->type); + int missing = full - b->num_workers; + + if (full >= 1) { + if (missing == 0) { + c->translation_key = TR_TOOLTIP_OVERLAY_EMPLOYMENT_FULL; + } else if (missing <= 1) { + c->has_numeric_prefix = 1; + c->numeric_prefix = missing; + c->translation_key = TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_1; + return 1; + } else if (missing >= 2 && b->state == BUILDING_STATE_MOTHBALLED) { + c->has_numeric_prefix = 1; + c->numeric_prefix = missing; + c->translation_key = TR_TOOLTIP_OVERLAY_EMPLOYMENT_MOTHBALL; + return 1; + } else { + c->has_numeric_prefix = 1; + c->numeric_prefix = missing; + c->translation_key = TR_TOOLTIP_OVERLAY_EMPLOYMENT_MISSING_2; + return 1; + } + } + return 0; +} + static int get_tooltip_water(tooltip_context *c, int grid_offset) { if (map_terrain_is(grid_offset, TERRAIN_RESERVOIR_RANGE)) { @@ -476,6 +522,22 @@ const city_overlay *city_overlay_for_tax_income(void) return &overlay; } +const city_overlay *city_overlay_for_employment(void) +{ + static city_overlay overlay = { + OVERLAY_EMPLOYMENT, + COLUMN_COLOR_RED_TO_GREEN, + show_building_none, + show_figure_employment, + get_column_height_employment, + 0, + get_tooltip_employment, + 0, + 0 + }; + return &overlay; +} + static int has_deleted_building(int grid_offset) { building *b = building_get(map_building_at(grid_offset)); diff --git a/src/widget/city_overlay_other.h b/src/widget/city_overlay_other.h index 943bb161f8..a1dd24a8b3 100644 --- a/src/widget/city_overlay_other.h +++ b/src/widget/city_overlay_other.h @@ -21,6 +21,8 @@ const city_overlay *city_overlay_for_roads(void); const city_overlay *city_overlay_for_levy(void); +const city_overlay *city_overlay_for_employment(void); + const city_overlay *city_overlay_for_mothball(void); const city_overlay *city_overlay_for_logistics(void); diff --git a/src/widget/city_with_overlay.c b/src/widget/city_with_overlay.c index 00da36335d..6ccdd39441 100644 --- a/src/widget/city_with_overlay.c +++ b/src/widget/city_with_overlay.c @@ -121,6 +121,8 @@ static const city_overlay *get_city_overlay(void) return city_overlay_for_roads(); case OVERLAY_LEVY: return city_overlay_for_levy(); + case OVERLAY_EMPLOYMENT: + return city_overlay_for_employment(); case OVERLAY_MOTHBALL: return city_overlay_for_mothball(); case OVERLAY_ENEMY: @@ -707,8 +709,7 @@ int city_with_overlay_get_tooltip_text(tooltip_context *c, int grid_offset) overlay_type != OVERLAY_DAMAGE && overlay_type != OVERLAY_NATIVE && overlay_type != OVERLAY_DESIRABILITY && overlay_type != OVERLAY_PROBLEMS && overlay_type != OVERLAY_MOTHBALL && overlay_type != OVERLAY_ENEMY && overlay_type != OVERLAY_LOGISTICS && overlay_type != OVERLAY_SICKNESS && overlay_type != OVERLAY_EFFICIENCY && - overlay_type != OVERLAY_HEALTH - ; + overlay_type != OVERLAY_HEALTH && overlay_type != OVERLAY_EMPLOYMENT; building *b = building_get(building_id); if (overlay_requires_house && !b->house_size) { return 0; diff --git a/src/window/hotkey_config.c b/src/window/hotkey_config.c index 014672e649..a4b0e1316b 100644 --- a/src/window/hotkey_config.c +++ b/src/window/hotkey_config.c @@ -121,9 +121,8 @@ static hotkey_widget hotkey_widgets[] = { {HOTKEY_SHOW_OVERLAY_FIRE, TR_HOTKEY_SHOW_OVERLAY_FIRE}, {HOTKEY_SHOW_OVERLAY_DAMAGE, TR_HOTKEY_SHOW_OVERLAY_DAMAGE}, {HOTKEY_SHOW_OVERLAY_CRIME, TR_HOTKEY_SHOW_OVERLAY_CRIME}, + {HOTKEY_SHOW_OVERLAY_RISKS_NATIVE, TR_HOTKEY_SHOW_OVERLAY_RISKS_NATIVE}, {HOTKEY_SHOW_OVERLAY_PROBLEMS, TR_HOTKEY_SHOW_OVERLAY_PROBLEMS}, - {HOTKEY_SHOW_OVERLAY_FOOD_STOCKS, TR_HOTKEY_SHOW_OVERLAY_FOOD_STOCKS}, - {HOTKEY_SHOW_OVERLAY_LOGISTICS, TR_HOTKEY_SHOW_OVERLAY_LOGISTICS}, {HOTKEY_SHOW_OVERLAY_ENTERTAINMENT, TR_HOTKEY_SHOW_OVERLAY_ENTERTAINMENT}, {HOTKEY_SHOW_OVERLAY_EDUCATION, TR_HOTKEY_SHOW_OVERLAY_EDUCATION}, {HOTKEY_SHOW_OVERLAY_SCHOOL, TR_HOTKEY_SHOW_OVERLAY_SCHOOL}, @@ -135,14 +134,16 @@ static hotkey_widget hotkey_widgets[] = { {HOTKEY_SHOW_OVERLAY_CLINIC, TR_HOTKEY_SHOW_OVERLAY_CLINIC}, {HOTKEY_SHOW_OVERLAY_HOSPITAL, TR_HOTKEY_SHOW_OVERLAY_HOSPITAL}, {HOTKEY_SHOW_OVERLAY_SICKNESS, TR_HOTKEY_SHOW_OVERLAY_SICKNESS}, + {HOTKEY_SHOW_OVERLAY_LOGISTICS, TR_HOTKEY_SHOW_OVERLAY_LOGISTICS}, + {HOTKEY_SHOW_OVERLAY_FOOD_STOCKS, TR_HOTKEY_SHOW_OVERLAY_FOOD_STOCKS}, + {HOTKEY_SHOW_OVERLAY_MOTHBALL, TR_HOTKEY_SHOW_OVERLAY_MOTHBALL}, {HOTKEY_SHOW_OVERLAY_TAX_INCOME, TR_HOTKEY_SHOW_OVERLAY_TAX_INCOME}, + {HOTKEY_SHOW_OVERLAY_LEVY, TR_HOTKEY_SHOW_OVERLAY_LEVY}, + {HOTKEY_SHOW_OVERLAY_EMPLOYMENT, TR_HOTKEY_SHOW_OVERLAY_EMPLOYMENT}, + {HOTKEY_SHOW_OVERLAY_RELIGION, TR_HOTKEY_SHOW_OVERLAY_RELIGION}, {HOTKEY_SHOW_OVERLAY_DESIRABILITY, TR_HOTKEY_SHOW_OVERLAY_DESIRABILITY}, {HOTKEY_SHOW_OVERLAY_SENTIMENT, TR_HOTKEY_SHOW_OVERLAY_SENTIMENT}, - {HOTKEY_SHOW_OVERLAY_MOTHBALL, TR_HOTKEY_SHOW_OVERLAY_MOTHBALL}, - {HOTKEY_SHOW_OVERLAY_RELIGION, TR_HOTKEY_SHOW_OVERLAY_RELIGION}, {HOTKEY_SHOW_OVERLAY_ROADS, TR_HOTKEY_SHOW_OVERLAY_ROADS}, - {HOTKEY_SHOW_OVERLAY_LEVY, TR_HOTKEY_SHOW_OVERLAY_LEVY}, - {HOTKEY_SHOW_OVERLAY_RISKS_NATIVE, TR_HOTKEY_SHOW_OVERLAY_RISKS_NATIVE}, {HOTKEY_HEADER, TR_HOTKEY_HEADER_BOOKMARKS}, {HOTKEY_GO_TO_BOOKMARK_1, TR_HOTKEY_GO_TO_BOOKMARK_1}, {HOTKEY_GO_TO_BOOKMARK_2, TR_HOTKEY_GO_TO_BOOKMARK_2}, diff --git a/src/window/overlay_menu.c b/src/window/overlay_menu.c index 27ff78bdd9..0b1edadf0e 100644 --- a/src/window/overlay_menu.c +++ b/src/window/overlay_menu.c @@ -52,9 +52,9 @@ static generic_button submenu_buttons[] = { {0, 216, 160, 24, button_submenu_item, button_none, 9, 0}, }; -static const int MENU_ID_TO_OVERLAY[OVERLAY_BUTTONS] = { OVERLAY_NONE, OVERLAY_WATER, 1, 3, 5, 6, 7, OVERLAY_RELIGION, OVERLAY_ROADS, OVERLAY_DESIRABILITY, OVERLAY_SENTIMENT }; +static const int MENU_ID_TO_OVERLAY[OVERLAY_BUTTONS] = { OVERLAY_NONE, OVERLAY_WATER, 1, 3, 5, 6, 7, OVERLAY_RELIGION, OVERLAY_DESIRABILITY, OVERLAY_SENTIMENT, OVERLAY_ROADS }; static const int MENU_ID_TO_SUBMENU_ID[OVERLAY_BUTTONS] = { 0, 0, 1, 2, 3, 4, 5, 0, 0 }; -static const int ADDITIONAL_OVERLAY_TR[] = { TR_OVERLAY_ROADS, TR_OVERLAY_LEVY, TR_OVERLAY_TAVERN, TR_OVERLAY_ARENA_COL, TR_OVERLAY_SENTIMENT, TR_OVERLAY_MOTHBALL, TR_OVERLAY_ENEMY, TR_OVERLAY_LOGISTICS, TR_OVERLAY_SICKNESS, TR_OVERLAY_EFFICIENCY, TR_OVERLAY_STORAGES, TR_OVERLAY_HEALTH }; +static const int ADDITIONAL_OVERLAY_TR[] = { TR_OVERLAY_ROADS, TR_OVERLAY_LEVY, TR_OVERLAY_TAVERN, TR_OVERLAY_ARENA_COL, TR_OVERLAY_SENTIMENT, TR_OVERLAY_MOTHBALL, TR_OVERLAY_ENEMY, TR_OVERLAY_LOGISTICS, TR_OVERLAY_SICKNESS, TR_OVERLAY_EFFICIENCY, TR_OVERLAY_STORAGES, TR_OVERLAY_HEALTH, TR_OVERLAY_EMPLOYMENT }; static const int SUBMENU_ID_TO_OVERLAY[6][OVERLAY_BUTTONS] = { {0}, @@ -62,7 +62,7 @@ static const int SUBMENU_ID_TO_OVERLAY[6][OVERLAY_BUTTONS] = { {OVERLAY_ENTERTAINMENT, OVERLAY_TAVERN, OVERLAY_THEATER, OVERLAY_AMPHITHEATER, OVERLAY_ARENA, OVERLAY_COLOSSEUM, OVERLAY_HIPPODROME, 0}, {OVERLAY_EDUCATION, OVERLAY_SCHOOL, OVERLAY_LIBRARY, OVERLAY_ACADEMY, 0}, {OVERLAY_HEALTH, OVERLAY_BARBER, OVERLAY_BATHHOUSE, OVERLAY_CLINIC, OVERLAY_HOSPITAL, OVERLAY_SICKNESS, 0}, - {OVERLAY_TAX_INCOME, OVERLAY_LEVY, OVERLAY_EFFICIENCY, OVERLAY_FOOD_STOCKS, OVERLAY_MOTHBALL, OVERLAY_LOGISTICS, 0}, + {OVERLAY_LOGISTICS, OVERLAY_FOOD_STOCKS, OVERLAY_EFFICIENCY, OVERLAY_MOTHBALL, OVERLAY_TAX_INCOME, OVERLAY_LEVY, OVERLAY_EMPLOYMENT, 0}, }; static struct {