diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 9802c9a543..133f3e3da2 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -313,23 +313,44 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT if ((fs.fsCsb[0] & info->locale.lsCsbSupported[0]) == 0 && (fs.fsCsb[1] & info->locale.lsCsbSupported[1]) == 0) return 1; } - const char *english_name = GetEnglishFontName(logfont); - const char *font_name = WIDE_TO_MB((const TCHAR*)logfont->elfFullName); - DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name); + char font_name[MAX_PATH]; +#if defined(UNICODE) + WIDE_TO_MB_BUFFER((const TCHAR*)logfont->elfFullName, font_name, lengthof(font_name)); +#else + strecpy(font_name, (const TCHAR*)logfont->elfFullName, lastof(font_name)); +#endif + /* Add english name after font name */ + const char *english_name = GetEnglishFontName(logfont); + strecpy(font_name + strlen(font_name) + 1, english_name, lastof(font_name)); + + /* Check whether we can actually load the font. */ + bool ft_init = _library != NULL; + bool found = false; + FT_Face face; + /* Init FreeType if needed. */ + if ((ft_init || FT_Init_FreeType(&_library) == FT_Err_Ok) && GetFontByFaceName(font_name, &face) == FT_Err_Ok) { + FT_Done_Face(face); + found = true; + } + if (!ft_init) { + /* Uninit FreeType if we did the init. */ + FT_Done_FreeType(_library); + _library = NULL; + } + + if (!found) return 1; + + DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name); strecpy(info->settings->small_font, font_name, lastof(info->settings->small_font)); strecpy(info->settings->medium_font, font_name, lastof(info->settings->medium_font)); strecpy(info->settings->large_font, font_name, lastof(info->settings->large_font)); - - /* Add english name after font name */ - strecpy(info->settings->small_font + strlen(info->settings->small_font) + 1, english_name, lastof(info->settings->small_font)); - strecpy(info->settings->medium_font + strlen(info->settings->medium_font) + 1, english_name, lastof(info->settings->medium_font)); - strecpy(info->settings->large_font + strlen(info->settings->large_font) + 1, english_name, lastof(info->settings->large_font)); return 0; // stop enumerating } bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, const char *str) { + DEBUG(freetype, 1, "Trying fallback fonts"); EFCParam langInfo; if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(TCHAR)) == 0) { /* Invalid langid or some other mysterious error, can't determine fallback font. */ diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 2dbec89cef..515e7f60e3 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -512,7 +512,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by if (v == NULL) { /* Vehicle does not exist, so we're in a purchase list */ switch (variable) { - case 0x43: return _current_company | (LiveryHelper(object->u.vehicle.self_type, NULL) << 24); // Owner information + case 0x43: return _current_company | (Company::IsValidAiID(_current_company) ? 0x10000 : 0) | (LiveryHelper(object->u.vehicle.self_type, NULL) << 24); // Owner information case 0x46: return 0; // Motion counter case 0x47: { // Vehicle cargo info const Engine *e = Engine::Get(object->u.vehicle.self_type); diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index c1bfdfdb66..a39120fcbc 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -182,12 +182,6 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par } if (industry == NULL) { - /* industry does not exist, only use those variables that are "safe" */ - switch (variable) { - /* Manhattan distance of closes dry/water tile */ - case 0x43: return GetClosestWaterDistance(tile, (indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0); - } - DEBUG(grf, 1, "Unhandled property 0x%X (no available industry) in callback 0x%x", variable, object->callback); *available = false; diff --git a/src/table/settings.h b/src/table/settings.h index 6357b8e09a..9bc07b9798 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -604,7 +604,7 @@ const SettingDesc _settings[] = { SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), #ifdef ENABLE_NETWORK - SDTC_VAR(gui.network_chat_box_width, SLE_UINT16, S, 0, 700, 200, 65535, 0, STR_NULL, NULL), + SDTC_VAR(gui.network_chat_box_width, SLE_UINT16, S, 0, 620, 200, 65535, 0, STR_NULL, NULL), SDTC_VAR(gui.network_chat_box_height, SLE_UINT8, S, 0, 25, 5, 255, 0, STR_NULL, NULL), SDTC_VAR(network.sync_freq, SLE_UINT16,C|S,NO, 100, 0, 100, 0, STR_NULL, NULL), diff --git a/src/viewport.cpp b/src/viewport.cpp index 09bc1efe6a..50d0bb2b1f 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2163,7 +2163,7 @@ static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex } /** Calculates height difference between one tile and another - * Multiplies the result to suit the standard given by minimap - 50 meters high + * Multiplies the result to suit the standard given by minimap - 25 meters high * To correctly get the height difference we need the direction we are dragging * in, as well as with what kind of tool we are dragging. For example a horizontal * autorail tool that starts in bottom and ends at the top of a tile will need the @@ -2244,8 +2244,8 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t } if (swap) Swap(h0, h1); - /* Minimap shows height in intervals of 50 meters, let's do the same */ - return (int)(h1 - h0) * 50; + /* Minimap shows height in intervals of 25 meters, let's do the same */ + return (int)(h1 - h0) * 25; } static const StringID measure_strings_length[] = {STR_NULL, STR_MEASURE_LENGTH, STR_MEASURE_LENGTH_HEIGHTDIFF};