diff --git a/media/baseset/openttd.grf b/media/baseset/openttd.grf index 137e845300..620cc8ab98 100644 Binary files a/media/baseset/openttd.grf and b/media/baseset/openttd.grf differ diff --git a/media/baseset/openttd.grf.hash b/media/baseset/openttd.grf.hash index 90176c9546..5b07da7ff6 100644 --- a/media/baseset/openttd.grf.hash +++ b/media/baseset/openttd.grf.hash @@ -1 +1 @@ -a4a727b03a7cd07ee0499231f7f233f4 +eb8390a0569e66ec417c64ad254f9d05 diff --git a/media/baseset/openttd/chars.nfo b/media/baseset/openttd/chars.nfo index 6d514c8228..43544a841b 100644 --- a/media/baseset/openttd/chars.nfo +++ b/media/baseset/openttd/chars.nfo @@ -844,3 +844,9 @@ // U+E29D: Small left arrow -1 * 6 12 01 01 01 9D E2 -1 sprites/chars.png 8bpp 10 430 5 5 0 1 normal + +// U+E29B: Town +// U+E29C: City + -1 * 6 12 01 00 02 9B E2 + -1 sprites/chars.png 8bpp 20 430 10 10 0 0 normal + -1 sprites/chars.png 8bpp 40 430 10 10 0 0 normal diff --git a/media/baseset/openttd/chars.png b/media/baseset/openttd/chars.png index 18933228b3..426e7a8348 100644 Binary files a/media/baseset/openttd/chars.png and b/media/baseset/openttd/chars.png differ diff --git a/src/lang/english.txt b/src/lang/english.txt index 02370fd286..f0291e1a5e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5875,6 +5875,8 @@ STR_SAVEGAME_NAME_SPECTATOR :Spectator, {1:S # Viewport strings STR_VIEWPORT_TOWN_POP :{TOWN} ({COMMA}) +STR_VIEWPORT_TOWN_CITY :{TOWN} {CITY_ICON} +STR_VIEWPORT_TOWN_CITY_POP :{TOWN} ({COMMA}) {CITY_ICON} STR_VIEWPORT_STATION :{STATION} {STATION_FEATURES} # Simple strings to get specific types of data diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index b0bf3b58b6..6ac6909d62 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -437,6 +437,8 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all break; } + case 0x9B: builder.PutUtf8(SCC_TOWN); break; + case 0x9C: builder.PutUtf8(SCC_CITY); break; case 0x9E: builder.PutUtf8(0x20AC); break; // Euro case 0x9F: builder.PutUtf8(0x0178); break; // Y with diaeresis case 0xA0: builder.PutUtf8(SCC_UP_ARROW); break; diff --git a/src/table/control_codes.h b/src/table/control_codes.h index fded339a25..b215eab2c6 100644 --- a/src/table/control_codes.h +++ b/src/table/control_codes.h @@ -171,6 +171,8 @@ enum StringControlCode : uint16_t { * These are mapped to the original glyphs */ SCC_LESS_THAN = SCC_SPRITE_START + 0x3C, SCC_GREATER_THAN = SCC_SPRITE_START + 0x3E, + SCC_TOWN = SCC_SPRITE_START + 0x9B, + SCC_CITY = SCC_SPRITE_START + 0x9C, SCC_LEFT_ARROW = SCC_SPRITE_START + 0x9D, SCC_UP_ARROW = SCC_SPRITE_START + 0xA0, SCC_DOWN_ARROW = SCC_SPRITE_START + 0xAA, diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index 6373b85159..1732343e51 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -146,6 +146,8 @@ static const CmdStruct _cmd_structs[] = { {"RIGHT_ARROW", EmitSingleChar, SCC_RIGHT_ARROW, 0, std::nullopt, {CmdFlag::DontCount}}, {"SMALL_LEFT_ARROW", EmitSingleChar, SCC_LESS_THAN, 0, std::nullopt, {CmdFlag::DontCount}}, {"SMALL_RIGHT_ARROW", EmitSingleChar, SCC_GREATER_THAN, 0, std::nullopt, {CmdFlag::DontCount}}, + {"TOWN_ICON", EmitSingleChar, SCC_TOWN, 0, std::nullopt, {CmdFlag::DontCount}}, + {"CITY_ICON", EmitSingleChar, SCC_CITY, 0, std::nullopt, {CmdFlag::DontCount}}, /* The following are directional formatting codes used to get the RTL strings right: * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */ diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index e754bc2fbf..9f4f1a7125 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -398,10 +398,17 @@ void Town::UpdateVirtCoord() if (this->cache.sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeTown(this->index)); - std::string town_string = GetString(STR_TOWN_NAME, this->index); + std::string town_string; + if (this->larger_town) { + town_string = GetString(_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_CITY_POP : STR_VIEWPORT_TOWN_CITY, this->index, this->cache.population); + } else { + town_string = GetString(_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME, this->index, this->cache.population); + } + this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_BASE, - _settings_client.gui.population_in_label ? GetString(STR_VIEWPORT_TOWN_POP, this->index, this->cache.population) : town_string, - town_string); + town_string, + GetString(STR_TOWN_NAME, this->index, this->cache.population) +); _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeTown(this->index)); diff --git a/src/viewport.cpp b/src/viewport.cpp index b03468f179..bed619d1c3 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1359,12 +1359,21 @@ static void ViewportAddTownStrings(DrawPixelInfo *dpi, const std::vectorcache.sign, flags, INVALID_COLOUR); if (str == nullptr) continue; - *str = GetString(stringid, t->index, t->cache.population); + if (t->larger_town) { + *str = GetString(stringid_town_city, t->index, t->cache.population); + } else { + *str = GetString(stringid_town, t->index, t->cache.population); + } } }