mirror of https://github.com/OpenTTD/OpenTTD
(svn r24603) [1.2] -Backport from trunk:
- Fix: [OSX] Some compile problems in mac-only code [FS#5296] (r24524) - Fix: The gender of an industry name is defined by the industry-type part of the name, not by the town-name part, even if it comes first (r24523, r24522) - Fix: GStexts were compiled incompletely when containing certain string codes (r24516, r24515) - Fix: The mousewheel did not work in the build waypoint window [FS#5285] (r24507)release/1.2
parent
141a2f7ebc
commit
53b160e011
|
@ -147,11 +147,6 @@ struct StringListReader : StringReader {
|
|||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* virtual */ void HandlePragma(char *str)
|
||||
{
|
||||
strgen_fatal("unknown pragma '%s'", str);
|
||||
}
|
||||
};
|
||||
|
||||
/** Class for writing an encoded language. */
|
||||
|
@ -183,7 +178,10 @@ struct TranslationWriter : LanguageWriter {
|
|||
|
||||
void Write(const byte *buffer, size_t length)
|
||||
{
|
||||
*this->strings->Append() = strndup((const char*)buffer, length);
|
||||
char *dest = MallocT<char>(length + 1);
|
||||
memcpy(dest, buffer, length);
|
||||
dest[length] = '\0';
|
||||
*this->strings->Append() = dest;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
|
||||
/* this function is a lightly modified version of some code from Apple's developer homepage to detect G5 CPUs at runtime */
|
||||
main()
|
||||
int main()
|
||||
{
|
||||
host_basic_info_data_t hostInfo;
|
||||
mach_msg_type_number_t infoCount;
|
||||
|
|
|
@ -1766,7 +1766,7 @@ static const NWidgetPart _nested_build_waypoint_widgets[] = {
|
|||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, WID_BRW_WAYPOINT_MATRIX), SetPIP(3, 2, 3), SetScrollbar(WID_BRW_SCROLL),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BRW_WAYPOINT), SetMinimalSize(66, 60), SetDataTip(0x0, STR_WAYPOINT_GRAPHICS_TOOLTIP), EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BRW_WAYPOINT), SetMinimalSize(66, 60), SetDataTip(0x0, STR_WAYPOINT_GRAPHICS_TOOLTIP), SetScrollbar(WID_BRW_SCROLL), EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BRW_SCROLL),
|
||||
|
|
|
@ -147,11 +147,6 @@ void FileStringReader::HandlePragma(char *str)
|
|||
strecpy(_lang.own_name, str + 8, lastof(_lang.own_name));
|
||||
} else if (!memcmp(str, "isocode ", 8)) {
|
||||
strecpy(_lang.isocode, str + 8, lastof(_lang.isocode));
|
||||
} else if (!memcmp(str, "plural ", 7)) {
|
||||
_lang.plural_form = atoi(str + 7);
|
||||
if (_lang.plural_form >= lengthof(_plural_forms)) {
|
||||
error("Invalid pluralform %d", _lang.plural_form);
|
||||
}
|
||||
} else if (!memcmp(str, "textdir ", 8)) {
|
||||
if (!memcmp(str + 8, "ltr", 3)) {
|
||||
_lang.text_dir = TD_LTR;
|
||||
|
@ -208,7 +203,7 @@ void FileStringReader::HandlePragma(char *str)
|
|||
_lang.num_cases++;
|
||||
}
|
||||
} else {
|
||||
error("unknown pragma '%s'", str);
|
||||
StringReader::HandlePragma(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ struct StringReader {
|
|||
* Handle the pragma of the file.
|
||||
* @param str The pragma string to parse.
|
||||
*/
|
||||
virtual void HandlePragma(char *str) = 0;
|
||||
virtual void HandlePragma(char *str);
|
||||
|
||||
/**
|
||||
* Start parsing the file.
|
||||
|
|
|
@ -783,6 +783,17 @@ void StringReader::HandleString(char *str)
|
|||
}
|
||||
}
|
||||
|
||||
void StringReader::HandlePragma(char *str)
|
||||
{
|
||||
if (!memcmp(str, "plural ", 7)) {
|
||||
_lang.plural_form = atoi(str + 7);
|
||||
if (_lang.plural_form >= lengthof(_plural_forms)) {
|
||||
strgen_fatal("Invalid pluralform %d", _lang.plural_form);
|
||||
}
|
||||
} else {
|
||||
strgen_fatal("unknown pragma '%s'", str);
|
||||
}
|
||||
}
|
||||
|
||||
static void rstrip(char *buf)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ static char **_langpack_offs;
|
|||
static LanguagePack *_langpack;
|
||||
static uint _langtab_num[TAB_COUNT]; ///< Offset into langpack offs
|
||||
static uint _langtab_start[TAB_COUNT]; ///< Offset into langpack offs
|
||||
static bool _keep_gender_data = false; ///< Should we retain the gender data in the current string?
|
||||
static bool _scan_for_gender_data = false; ///< Are we scanning for the gender of the current string? (instead of formatting it)
|
||||
|
||||
|
||||
const char *GetStringPtr(StringID string)
|
||||
|
@ -880,11 +880,11 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
|||
|
||||
/* Now do the string formatting. */
|
||||
char buf[256];
|
||||
bool old_kgd = _keep_gender_data;
|
||||
_keep_gender_data = true;
|
||||
bool old_sgd = _scan_for_gender_data;
|
||||
_scan_for_gender_data = true;
|
||||
StringParameters tmp_params(args->GetPointerToOffset(offset), args->num_param - offset, NULL);
|
||||
p = FormatString(buf, input, &tmp_params, lastof(buf));
|
||||
_keep_gender_data = old_kgd;
|
||||
_scan_for_gender_data = old_sgd;
|
||||
*p = '\0';
|
||||
|
||||
/* And determine the string. */
|
||||
|
@ -900,7 +900,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
|||
/* This sets up the gender for the string.
|
||||
* We just ignore this one. It's used in {G 0 Der Die Das} to determine the case. */
|
||||
case SCC_GENDER_INDEX: // {GENDER 0}
|
||||
if (_keep_gender_data) {
|
||||
if (_scan_for_gender_data) {
|
||||
buff += Utf8Encode(buff, SCC_GENDER_INDEX);
|
||||
*buff++ = *str++;
|
||||
} else {
|
||||
|
@ -1314,11 +1314,18 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
|
|||
const Industry *i = Industry::GetIfValid(args->GetInt32(SCC_INDUSTRY_NAME));
|
||||
if (i == NULL) break;
|
||||
|
||||
/* First print the town name and the industry type name. */
|
||||
int64 args_array[2] = {i->town->index, GetIndustrySpec(i->type)->name};
|
||||
StringParameters tmp_params(args_array);
|
||||
if (_scan_for_gender_data) {
|
||||
/* Gender is defined by the industry type.
|
||||
* STR_FORMAT_INDUSTRY_NAME may have the town first, so it would result in the gender of the town name */
|
||||
StringParameters tmp_params(NULL, 0, NULL);
|
||||
buff = FormatString(buff, GetStringPtr(GetIndustrySpec(i->type)->name), &tmp_params, last, next_substr_case_index);
|
||||
} else {
|
||||
/* First print the town name and the industry type name. */
|
||||
int64 args_array[2] = {i->town->index, GetIndustrySpec(i->type)->name};
|
||||
StringParameters tmp_params(args_array);
|
||||
|
||||
buff = FormatString(buff, GetStringPtr(STR_FORMAT_INDUSTRY_NAME), &tmp_params, last, next_substr_case_index);
|
||||
buff = FormatString(buff, GetStringPtr(STR_FORMAT_INDUSTRY_NAME), &tmp_params, last, next_substr_case_index);
|
||||
}
|
||||
next_substr_case_index = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
|
|||
CocoaSubdriver *ret;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COCOA_QUARTZ && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
#if defined(ENABLE_COCOA_QUARTZ) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
/* The reason for the version mismatch is due to the fact that the 10.4 binary needs to work on 10.5 as well. */
|
||||
if (MacOSVersionIsAtLeast(10, 5, 0)) {
|
||||
ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp);
|
||||
|
@ -254,7 +254,7 @@ static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp)
|
|||
if (ret != NULL) return ret;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COCOA_QUARTZ && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
#if defined(ENABLE_COCOA_QUARTZ) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
|
||||
/*
|
||||
* If we get here we are running 10.4 or earlier and either openttd was compiled without the QuickDraw driver
|
||||
* or it failed to load for some reason. Fall back to Quartz if possible even though that driver is slower.
|
||||
|
|
|
@ -65,7 +65,7 @@ struct OTTD_QuartzGammaTable {
|
|||
@end
|
||||
|
||||
@implementation NSScreen (NSScreenAccess)
|
||||
- (void) setFrame:(NSRect)frame;
|
||||
- (void) setFrame:(NSRect)frame
|
||||
{
|
||||
/* The 64 bits libraries don't seem to know about _frame, so this hack won't work. */
|
||||
#if !__LP64__
|
||||
|
|
Loading…
Reference in New Issue