Skip to content

Commit

Permalink
Show exact values in health overlay tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouaz committed Jan 30, 2024
1 parent cf17d95 commit 1d65b58
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/translation/english.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,17 +797,17 @@ static translation_string all_strings[] = {
{TR_ADVISOR_SICKNESS_LEVEL_HIGH, "Infectious diseases spread in areas of the city having a poor level of hygiene. If the situation is not remedied soon, some buildings may be quarantined. Greater access to healthcare would effectively prevent epidemics from breaking out."},
{TR_ADVISOR_SICKNESS_LEVEL_PLAGUE, "The plague has come to some unhealthy areas in the city! Buildings have been quarantined or burned to prevent the further spread of disease. Doctors and surgeons have been requisitioned to decontaminate the afflicted places."},
{TR_TOOLTIP_OVERLAY_HEALTH_NONE, "No citizen lives here yet"},
{TR_TOOLTIP_OVERLAY_HEALTH_0, "Health in this house is appalling (0-9)"},
{TR_TOOLTIP_OVERLAY_HEALTH_1, "Health in this house is terrible (10-19)"},
{TR_TOOLTIP_OVERLAY_HEALTH_2, "Health in this house is bad (20-29)"},
{TR_TOOLTIP_OVERLAY_HEALTH_3, "Health in this house is poor (30-39)"},
{TR_TOOLTIP_OVERLAY_HEALTH_4, "Health in this house is below average (40-49)"},
{TR_TOOLTIP_OVERLAY_HEALTH_5, "Health in this house is average (50-59)"},
{TR_TOOLTIP_OVERLAY_HEALTH_6, "Health in this house is good (60-69)"},
{TR_TOOLTIP_OVERLAY_HEALTH_7, "Health in this house is very good (70-79)"},
{TR_TOOLTIP_OVERLAY_HEALTH_8, "Health in this house is excellent (80-89)"},
{TR_TOOLTIP_OVERLAY_HEALTH_9, "Health in this house is almost perfect (90-99)"},
{TR_TOOLTIP_OVERLAY_HEALTH_10, "Health in this house is perfect (100)"},
{TR_TOOLTIP_OVERLAY_HEALTH_0, " : Health in this house is appalling"},
{TR_TOOLTIP_OVERLAY_HEALTH_1, " : Health in this house is terrible"},
{TR_TOOLTIP_OVERLAY_HEALTH_2, " : Health in this house is bad"},
{TR_TOOLTIP_OVERLAY_HEALTH_3, " : Health in this house is poor"},
{TR_TOOLTIP_OVERLAY_HEALTH_4, " : Health in this house is below average"},
{TR_TOOLTIP_OVERLAY_HEALTH_5, " : Health in this house is average"},
{TR_TOOLTIP_OVERLAY_HEALTH_6, " : Health in this house is good"},
{TR_TOOLTIP_OVERLAY_HEALTH_7, " : Health in this house is very good"},
{TR_TOOLTIP_OVERLAY_HEALTH_8, " : Health in this house is excellent"},
{TR_TOOLTIP_OVERLAY_HEALTH_9, " : Health in this house is almost perfect"},
{TR_TOOLTIP_OVERLAY_HEALTH_10, " : Health in this house is perfect"},
{TR_TOOLTIP_OVERLAY_SICKNESS_NONE, "No disease"},
{TR_TOOLTIP_OVERLAY_SICKNESS_LOW, "Very few diseases"},
{TR_TOOLTIP_OVERLAY_SICKNESS_MEDIUM, "A few infectious diseases"},
Expand Down
35 changes: 34 additions & 1 deletion src/widget/city_overlay_health.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,67 @@ static int get_tooltip_health(tooltip_context *c, const building *b)
if (b->house_population < 1 && house_health < 1) {
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_NONE;
} else if (b->house_population >= 1 && house_health < 10) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_0;
return 1;
} else if (house_health < 20) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_1;
return 1;
} else if (house_health < 30) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_2;
return 1;
} else {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_3;
return 1;
}
} else if (house_health < 60) {
if (house_health < 50) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_4;
return 1;
} else {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_5;
return 1;
}
} else if (house_health < 80) {
if (house_health < 70) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_6;
return 1;
} else {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_7;
return 1;
}
} else if (house_health < 100) {
if (house_health < 90) {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_8;
return 1;
} else {
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_9;
return 1;
}
} else {
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_10;
c->has_numeric_prefix = 1;
c->numeric_prefix = house_health;
c->translation_key = TR_TOOLTIP_OVERLAY_HEALTH_10;
return 1;
}
}
return 0;
Expand Down

0 comments on commit 1d65b58

Please sign in to comment.