1
0
Fork 0

(svn r19856) [1.0] -Backport from trunk:

- Fix: Height in smallmap was different from measured heights [FS#3808]
- Fix: [NewGRF] Vehicle var 43 missed AI information in purchase list (r19761)
- Fix: Try harder to find a suitable font that can be loaded, i.e. while searching for a suitable font test whether you can open it [FS#3740] (r19753)
- Fix: Make sure the chat area fits in the default window size; if you want it larger, you can always change/override it in the config file [FS#3798] (r19751)
- Fix: [NewGRF] Industry var 0x43 is not 'safe' during callbacks 22 and 38 either (r19750)
release/1.0
rubidium 2010-05-18 21:38:09 +00:00
parent 1e5d35634d
commit 3f1bc42eb0
5 changed files with 34 additions and 19 deletions

View File

@ -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. */

View File

@ -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);

View File

@ -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;

View File

@ -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),

View File

@ -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};