diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-05-17 23:31:49 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-05-21 20:02:34 +0200 |
commit | 808c8198d5ab61c457d0351ff7971b75ee17c10a (patch) | |
tree | 70459dfbd4c69dd9e82282eed2c6fe68383774f3 /src | |
parent | 43cd892e0c2c012355d7eb6d47cfa4ad4b7e68eb (diff) | |
download | openttd-808c8198d5ab61c457d0351ff7971b75ee17c10a.tar.xz |
Codechange: Consistently use WChar when passing characters around, and also define it as char32_t.
Diffstat (limited to 'src')
-rw-r--r-- | src/fontcache.cpp | 4 | ||||
-rw-r--r-- | src/gfx_func.h | 4 | ||||
-rw-r--r-- | src/string_type.h | 2 | ||||
-rw-r--r-- | src/textbuf_type.h | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 6cdac1fab..051c4ee1d 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -105,13 +105,13 @@ SpriteFontCache::~SpriteFontCache() this->ClearGlyphToSpriteMap(); } -SpriteID SpriteFontCache::GetUnicodeGlyph(GlyphID key) +SpriteID SpriteFontCache::GetUnicodeGlyph(WChar key) { if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) return 0; return this->glyph_to_spriteid_map[GB(key, 8, 8)][GB(key, 0, 8)]; } -void SpriteFontCache::SetUnicodeGlyph(GlyphID key, SpriteID sprite) +void SpriteFontCache::SetUnicodeGlyph(WChar key, SpriteID sprite) { if (this->glyph_to_spriteid_map == nullptr) this->glyph_to_spriteid_map = CallocT<SpriteID*>(256); if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) this->glyph_to_spriteid_map[GB(key, 8, 8)] = CallocT<SpriteID>(256); diff --git a/src/gfx_func.h b/src/gfx_func.h index 3def1c85a..0ccdabac3 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -112,7 +112,7 @@ int DrawString(int left, int right, int top, StringID str, TextColour colour = T int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL); int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = (SA_TOP | SA_LEFT), bool underline = false, FontSize fontsize = FS_NORMAL); -void DrawCharCentered(uint32 c, int x, int y, TextColour colour); +void DrawCharCentered(WChar c, int x, int y, TextColour colour); void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode = FILLRECT_OPAQUE); void GfxFillPolygon(const std::vector<Point> &shape, int colour, FillRectMode mode = FILLRECT_OPAQUE); @@ -164,7 +164,7 @@ void SortResolutions(); bool ToggleFullScreen(bool fs); /* gfx.cpp */ -byte GetCharacterWidth(FontSize size, uint32 key); +byte GetCharacterWidth(FontSize size, WChar key); byte GetDigitWidth(FontSize size = FS_NORMAL); void GetBroadestDigit(uint *front, uint *next, FontSize size = FS_NORMAL); diff --git a/src/string_type.h b/src/string_type.h index ced1ab1de..623d74661 100644 --- a/src/string_type.h +++ b/src/string_type.h @@ -32,7 +32,7 @@ enum CharSetFilter { }; /** Type for wide characters, i.e. non-UTF8 encoded unicode characters. */ -typedef uint32 WChar; +typedef char32_t WChar; /* The following are directional formatting codes used to get the LTR and RTL strings right: * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */ diff --git a/src/textbuf_type.h b/src/textbuf_type.h index a238aa74b..b4f234f73 100644 --- a/src/textbuf_type.h +++ b/src/textbuf_type.h @@ -53,7 +53,7 @@ struct Textbuf { void DeleteAll(); bool InsertClipboard(); - bool InsertChar(uint32 key); + bool InsertChar(WChar key); bool InsertString(const char *str, bool marked, const char *caret = nullptr, const char *insert_location = nullptr, const char *replacement_end = nullptr); bool DeleteChar(uint16 keycode); |