Merge branch 'master' into jgrpp
# Conflicts: # src/console.cpp # src/console_func.h # src/network/network_server.cpp # src/os/unix/unix.cpp # src/spritecache.cpp # src/viewport.cpp
This commit is contained in:
@@ -271,7 +271,7 @@ static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char
|
||||
break;
|
||||
|
||||
case ';': // Cmd separator; execute previous and start new command
|
||||
IConsoleCmdExec(alias_buffer.c_str(), recurse_count);
|
||||
IConsoleCmdExec(alias_buffer, recurse_count);
|
||||
|
||||
alias_buffer.clear();
|
||||
|
||||
@@ -329,15 +329,15 @@ static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char
|
||||
}
|
||||
}
|
||||
|
||||
IConsoleCmdExec(alias_buffer.c_str(), recurse_count);
|
||||
IConsoleCmdExec(alias_buffer, recurse_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a given command passed to us. First chop it up into
|
||||
* individual tokens (separated by spaces), then execute it if possible
|
||||
* @param cmdstr string to be parsed and executed
|
||||
* @param command_string string to be parsed and executed
|
||||
*/
|
||||
void IConsoleCmdExec(const char *cmdstr, const uint recurse_count)
|
||||
void IConsoleCmdExec(const std::string &command_string, const uint recurse_count)
|
||||
{
|
||||
const char *cmdptr;
|
||||
char *tokens[ICON_TOKEN_COUNT], tokenstream[ICON_MAX_STREAMSIZE];
|
||||
@@ -346,17 +346,16 @@ void IConsoleCmdExec(const char *cmdstr, const uint recurse_count)
|
||||
bool longtoken = false;
|
||||
bool foundtoken = false;
|
||||
|
||||
if (cmdstr[0] == '#') return; // comments
|
||||
if (command_string[0] == '#') return; // comments
|
||||
|
||||
for (cmdptr = cmdstr; *cmdptr != '\0'; cmdptr++) {
|
||||
for (cmdptr = command_string.c_str(); *cmdptr != '\0'; cmdptr++) {
|
||||
if (!IsValidChar(*cmdptr, CS_ALPHANUMERAL)) {
|
||||
IConsoleError("command contains malformed characters, aborting");
|
||||
IConsolePrintF(CC_ERROR, "ERROR: command was: '%s'", cmdstr);
|
||||
IConsolePrintF(CC_ERROR, "Command '%s' contains malformed characters.", command_string.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(console, 4, "Executing cmdline: '%s'", cmdstr);
|
||||
DEBUG(console, 4, "Executing cmdline: '%s'", command_string.c_str());
|
||||
|
||||
memset(&tokens, 0, sizeof(tokens));
|
||||
memset(&tokenstream, 0, sizeof(tokenstream));
|
||||
@@ -364,7 +363,7 @@ void IConsoleCmdExec(const char *cmdstr, const uint recurse_count)
|
||||
/* 1. Split up commandline into tokens, separated by spaces, commands
|
||||
* enclosed in "" are taken as one token. We can only go as far as the amount
|
||||
* of characters in our stream or the max amount of tokens we can handle */
|
||||
for (cmdptr = cmdstr, t_index = 0, tstream_i = 0; *cmdptr != '\0'; cmdptr++) {
|
||||
for (cmdptr = command_string.c_str(), t_index = 0, tstream_i = 0; *cmdptr != '\0'; cmdptr++) {
|
||||
if (tstream_i >= lengthof(tokenstream)) {
|
||||
IConsoleError("command line too long");
|
||||
return;
|
||||
|
@@ -27,7 +27,7 @@ void IConsoleWarning(const char *string);
|
||||
void IConsoleError(const char *string);
|
||||
|
||||
/* Parser */
|
||||
void IConsoleCmdExec(const char *cmdstr, const uint recurse_count = 0);
|
||||
void IConsoleCmdExec(const std::string &command_string, const uint recurse_count = 0);
|
||||
void IConsoleCmdExecTokens(uint token_count, char *tokens[], const uint recurse_count = 0);
|
||||
|
||||
bool IsValidConsoleColour(TextColour c);
|
||||
|
@@ -143,7 +143,9 @@ void LoadFreeTypeFont(FontSize fs)
|
||||
FT_Face face = nullptr;
|
||||
|
||||
/* If font is an absolute path to a ttf, try loading that first. */
|
||||
FT_Error error = FT_New_Face(_library, font_name, 0, &face);
|
||||
int32_t index = 0;
|
||||
if (settings->os_handle != nullptr) index = *static_cast<const int32_t *>(settings->os_handle);
|
||||
FT_Error error = FT_New_Face(_library, font_name, index, &face);
|
||||
|
||||
if (error != FT_Err_Ok) {
|
||||
/* Check if font is a relative filename in one of our search-paths. */
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
int glyph_count; ///< The number of glyphs.
|
||||
|
||||
public:
|
||||
FallbackVisualRun(Font *font, const WChar *chars, int glyph_count, int x);
|
||||
FallbackVisualRun(Font *font, const WChar *chars, int glyph_count, int char_offset, int x);
|
||||
FallbackVisualRun(FallbackVisualRun &&other) noexcept;
|
||||
~FallbackVisualRun() override;
|
||||
const Font *GetFont() const override;
|
||||
@@ -104,12 +104,13 @@ public:
|
||||
|
||||
/**
|
||||
* Create the visual run.
|
||||
* @param font The font to use for this run.
|
||||
* @param chars The characters to use for this run.
|
||||
* @param char_count The number of characters in this run.
|
||||
* @param x The initial x position for this run.
|
||||
* @param font The font to use for this run.
|
||||
* @param chars The characters to use for this run.
|
||||
* @param char_count The number of characters in this run.
|
||||
* @param char_offset This run's offset from the start of the layout input string.
|
||||
* @param x The initial x position for this run.
|
||||
*/
|
||||
FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun(Font *font, const WChar *chars, int char_count, int x) :
|
||||
FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun(Font *font, const WChar *chars, int char_count, int char_offset, int x) :
|
||||
font(font), glyph_count(char_count)
|
||||
{
|
||||
const bool isbuiltin = font->fc->IsBuiltInFont();
|
||||
@@ -131,7 +132,7 @@ FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun(Font *font, const
|
||||
this->positions[2 * i + 1] = 0; // No ascender adjustment.
|
||||
}
|
||||
this->positions[2 * i + 2] = this->positions[2 * i] + font->fc->GetGlyphWidth(this->glyphs[i]);
|
||||
this->glyph_to_char[i] = i;
|
||||
this->glyph_to_char[i] = char_offset + i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +296,7 @@ std::unique_ptr<const ParagraphLayouter::Line> FallbackParagraphLayout::NextLine
|
||||
if (*this->buffer == '\0') {
|
||||
/* Only a newline. */
|
||||
this->buffer = nullptr;
|
||||
l->emplace_back(this->runs.begin()->second, this->buffer, 0, 0);
|
||||
l->emplace_back(this->runs.begin()->second, this->buffer, 0, 0, 0);
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -324,7 +325,7 @@ std::unique_ptr<const ParagraphLayouter::Line> FallbackParagraphLayout::NextLine
|
||||
|
||||
if (this->buffer == next_run) {
|
||||
int w = l->GetWidth();
|
||||
l->emplace_back(iter->second, begin, this->buffer - begin, w);
|
||||
l->emplace_back(iter->second, begin, this->buffer - begin, begin - this->buffer_begin, w);
|
||||
++iter;
|
||||
assert(iter != this->runs.end());
|
||||
|
||||
@@ -369,7 +370,7 @@ std::unique_ptr<const ParagraphLayouter::Line> FallbackParagraphLayout::NextLine
|
||||
|
||||
if (l->size() == 0 || last_char - begin > 0) {
|
||||
int w = l->GetWidth();
|
||||
l->emplace_back(iter->second, begin, last_char - begin, w);
|
||||
l->emplace_back(iter->second, begin, last_char - begin, begin - this->buffer_begin, w);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
@@ -281,6 +281,7 @@ static void LoadSpriteTables()
|
||||
LoadNewGRF(SPR_NEWGRFS_BASE, 2);
|
||||
|
||||
uint total_extra_graphics = SPR_NEWGRFS_BASE - SPR_OPENTTD_BASE;
|
||||
DEBUG(sprite, 4, "Checking sprites from fallback grf");
|
||||
_missing_extra_graphics = GetSpriteCountForFile(master_filename, SPR_OPENTTD_BASE, SPR_NEWGRFS_BASE);
|
||||
DEBUG(sprite, 1, "%u extra sprites, %u from baseset, %u from fallback", total_extra_graphics, total_extra_graphics - _missing_extra_graphics, _missing_extra_graphics);
|
||||
|
||||
|
@@ -951,6 +951,7 @@ STR_GAME_OPTIONS_VOLUME_100 :100%
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Valutaenhed
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Valg af valutaenhed
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
|
||||
|
||||
###length 42
|
||||
STR_GAME_OPTIONS_CURRENCY_GBP :Britiske Pund
|
||||
@@ -2835,8 +2836,8 @@ STR_AIRPORT_HELISTATION :Helikopterplads
|
||||
|
||||
STR_AIRPORT_CLASS_SMALL :Små lufthavne
|
||||
STR_AIRPORT_CLASS_LARGE :Store lufthavne
|
||||
STR_AIRPORT_CLASS_HUB :Central lufthavn
|
||||
STR_AIRPORT_CLASS_HELIPORTS :Helikopterlufthavn
|
||||
STR_AIRPORT_CLASS_HUB :Central lufthavne
|
||||
STR_AIRPORT_CLASS_HELIPORTS :Helikopter lufthavne
|
||||
|
||||
STR_STATION_BUILD_NOISE :{BLACK}Genereret støj: {GOLD}{COMMA}
|
||||
|
||||
|
@@ -951,6 +951,7 @@ STR_GAME_OPTIONS_VOLUME_100 :100%
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Valuta
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Valuta kiezen
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
|
||||
|
||||
###length 42
|
||||
STR_GAME_OPTIONS_CURRENCY_GBP :Britse Pond
|
||||
|
@@ -952,6 +952,7 @@ STR_GAME_OPTIONS_VOLUME_100 :100%
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}화폐 단위
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}화폐 단위 선택
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
|
||||
|
||||
###length 42
|
||||
STR_GAME_OPTIONS_CURRENCY_GBP :영국 파운드
|
||||
@@ -4574,6 +4575,8 @@ STR_TIMETABLE_EXPECTED :{BLACK}예정
|
||||
STR_TIMETABLE_SCHEDULED :{BLACK}예정 소요시간 기준
|
||||
STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}시간표 검사 기준을 도착 예정일과 도착 예정 시간 기준 중에서 선택합니다
|
||||
|
||||
STR_TIMETABLE_ARRIVAL :도착: {COLOUR}{DATE_TINY}
|
||||
STR_TIMETABLE_DEPARTURE :착: {COLOUR}{DATE_TINY}
|
||||
|
||||
|
||||
# Date window (for timetable)
|
||||
|
@@ -1331,6 +1331,7 @@ STR_GAME_OPTIONS_VOLUME_100 :100%
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Waluta
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Wybór waluty
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
|
||||
|
||||
###length 42
|
||||
STR_GAME_OPTIONS_CURRENCY_GBP :Funt brytyjski
|
||||
|
@@ -952,6 +952,7 @@ STR_GAME_OPTIONS_VOLUME_100 :100%
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Unidades monetárias
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Selecção de unidades monetárias
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING})
|
||||
|
||||
###length 42
|
||||
STR_GAME_OPTIONS_CURRENCY_GBP :Libra Britânica
|
||||
|
@@ -732,7 +732,7 @@ STR_SMALLMAP_LEGENDA_FOREST :{TINY_FONT}{BLA
|
||||
STR_SMALLMAP_LEGENDA_RAILROAD_STATION :{TINY_FONT}{BLACK}Gorsaf Reilffordd
|
||||
STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY :{TINY_FONT}{BLACK}Man Llwytho Lorïau
|
||||
STR_SMALLMAP_LEGENDA_BUS_STATION :{TINY_FONT}{BLACK}Gorsaf Fysiau
|
||||
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Maes Awyr/Glanfa Hofrenyddion
|
||||
STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT :{TINY_FONT}{BLACK}Maes Awyr/Hofrenfa
|
||||
STR_SMALLMAP_LEGENDA_DOCK :{TINY_FONT}{BLACK}Doc
|
||||
STR_SMALLMAP_LEGENDA_ROUGH_LAND :{TINY_FONT}{BLACK}Tir Garw
|
||||
STR_SMALLMAP_LEGENDA_GRASS_LAND :{TINY_FONT}{BLACK}Glaswelltir
|
||||
@@ -771,6 +771,7 @@ STR_STATUSBAR_PAUSED :{YELLOW}* * WE
|
||||
STR_STATUSBAR_AUTOSAVE :{RED}AWTOGADW
|
||||
STR_STATUSBAR_SAVING_GAME :{RED}* * CADW GÊM * *
|
||||
|
||||
STR_STATUSBAR_SPECTATOR :{WHITE}(gwyliwr)
|
||||
|
||||
# News message history
|
||||
STR_MESSAGE_HISTORY :{WHITE}Hanes Negeseuon
|
||||
@@ -872,7 +873,12 @@ STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}Mae {STA
|
||||
|
||||
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}Cynnig cymhorthdal ar ben:{}{}Ni fydd cludo {STRING} o {STRING} i {STRING} yn derbyn cymhorthdal bellach
|
||||
STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}Cymhorthdal wedi'i dynnu'n ôl:{}{}Ni fydd gwasanaeth {STRING} o {STRING} i {STRING} yn derbyn cymhorthdal bellach
|
||||
STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}Cynnig cymhorthdal:{}{}Bydd y gwasanaeth {STRING} cyntaf o {STRING} i {STRING} yn derbyn {NUM} {P "blwyddyn" "mlynedd"}! o gymhorthdal gan yr awdurdod lleol!
|
||||
###length 4
|
||||
STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF :{BIG_FONT}{BLACK}Cymhorthdal wedi ei ddyfarnu i {STRING}!{}{}Bydd y gwasanaeth {STRING} o {STRING} i {STRING} yn talu 50% yn fwy am {NUM} {P "blwyddyn" "mlynedd"}!
|
||||
STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE :{BIG_FONT}{BLACK}Cymhorthdal wedi ei ddyfarnu i {STRING}!{}{}Bydd y gwasanaeth {STRING} o {STRING} i {STRING} yn talu dwywaith yn fwy am {NUM} {P "blwyddyn" "mlynedd"}!
|
||||
STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE :{BIG_FONT}{BLACK}Cymhorthdal wedi ei ddyfarnu i {STRING}!{}{}Bydd y gwasanaeth {STRING} o {STRING} i {STRING} yn talu teirgwaith yn fwy am {NUM} {P "blwyddyn" "mlynedd"}!
|
||||
STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE :{BIG_FONT}{BLACK}Cymhorthdal wedi ei ddyfarnu i {STRING}!{}{}Bydd y gwasanaeth {STRING} o {STRING} i {STRING} yn talu pedair gwaith yn fwy am {NUM} {P "blwyddyn" "mlynedd"}!
|
||||
|
||||
STR_NEWS_ROAD_REBUILDING :{BIG_FONT}{BLACK}Anrhefn traffig yn {TOWN}!{}{}Daw gwaith ffordd a ariannwyd gan {STRING} â 6 mis o boen i deithwyr ffordd y dref!
|
||||
STR_NEWS_EXCLUSIVE_RIGHTS_TITLE :{BIG_FONT}{BLACK}Monopoli cludiant!
|
||||
@@ -890,6 +896,7 @@ STR_GAME_OPTIONS_CAPTION :{WHITE}Dewisiad
|
||||
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_VOLUME_50 :50%
|
||||
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}Uned Arian
|
||||
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}Dewis unedau arian
|
||||
@@ -955,6 +962,7 @@ STR_GAME_OPTIONS_RESOLUTION_OTHER :arall
|
||||
|
||||
|
||||
|
||||
STR_GAME_OPTIONS_GUI_SCALE_5X :5x
|
||||
|
||||
|
||||
|
||||
@@ -1366,6 +1374,7 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Codir purfeydd
|
||||
STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Uchder Llinell Eira: {STRING}
|
||||
STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Rheoli'r uchder y mae eira'n ymddangos mewn tirwedd is-arctig. Mae eira hefyd yn effeitiho ar gynhyrchu diwydiannau a gofynion twf trefi
|
||||
|
||||
STR_CONFIG_SETTING_SNOW_COVERAGE_VALUE :{NUM}%
|
||||
|
||||
|
||||
STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN :Garwder y tirwedd: {STRING}
|
||||
@@ -1933,6 +1942,7 @@ STR_INTRO_TRANSLATION :{BLACK}Mae'r cy
|
||||
|
||||
# Quit window
|
||||
STR_QUIT_CAPTION :{WHITE}Gadael
|
||||
STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD :{YELLOW}Ydych chi'n siŵr eich bod eisiau gadael OpenTTD?
|
||||
STR_QUIT_YES :{BLACK}Iawn
|
||||
STR_QUIT_NO :{BLACK}Na
|
||||
|
||||
@@ -2251,6 +2261,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** Mae {STRING
|
||||
STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** Mae {STRING} wedi dechrau cwmni newydd (#{2:NUM})
|
||||
STR_NETWORK_MESSAGE_CLIENT_LEFT :*** Mae {STRING} wedi gadael y gêm ({2:STRING})
|
||||
STR_NETWORK_MESSAGE_NAME_CHANGE :*** Mae {STRING} wedi newid ei (h)enw i {STRING}
|
||||
STR_NETWORK_MESSAGE_GIVE_MONEY :*** Rhoddodd {0:STRING} {2:CURRENCY_LONG} i {1:STRING}
|
||||
STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}Fe gaewyd y sesiwn gan y gweinydd
|
||||
STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}Mae'r gweinydd yn ailgychwyn...{}Arhoswch...
|
||||
|
||||
@@ -2374,6 +2385,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Uno pwyn
|
||||
STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Adeiladu pwynt llwybro annibynnol
|
||||
|
||||
# Generic toolbar
|
||||
STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Analluogwyd gan nad oes cerbydau ar gael i'r tanadeiledd yma ar hyn o bryd
|
||||
|
||||
# Rail construction toolbar
|
||||
STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Adeiladu Rheilffyrdd
|
||||
@@ -2528,14 +2540,14 @@ STR_AIRPORT_METRO :Maes awyr metro
|
||||
STR_AIRPORT_INTERNATIONAL :Rhyngwladol
|
||||
STR_AIRPORT_COMMUTER :Cymudol
|
||||
STR_AIRPORT_INTERCONTINENTAL :Rhyng-gyfandirol
|
||||
STR_AIRPORT_HELIPORT :Porth Hofrennydd
|
||||
STR_AIRPORT_HELIPORT :Hofrenfa
|
||||
STR_AIRPORT_HELIDEPOT :Depo Hofrennydd
|
||||
STR_AIRPORT_HELISTATION :Gorsaf Hofrennydd
|
||||
|
||||
STR_AIRPORT_CLASS_SMALL :Meysydd awyr bach
|
||||
STR_AIRPORT_CLASS_LARGE :Meysydd awyr mawr
|
||||
STR_AIRPORT_CLASS_HUB :Meysydd awyr cyfnewid
|
||||
STR_AIRPORT_CLASS_HELIPORTS :Meysydd awyr hofrennydd
|
||||
STR_AIRPORT_CLASS_HELIPORTS :Hofrenfeydd
|
||||
|
||||
STR_STATION_BUILD_NOISE :{BLACK}Swn a gynhyrchir: {GOLD}{COMMA}
|
||||
|
||||
@@ -2619,6 +2631,7 @@ STR_FUND_INDUSTRY_INDUSTRY_BUILD_COST :{BLACK}Côst: {
|
||||
STR_FUND_INDUSTRY_PROSPECT_NEW_INDUSTRY :{BLACK}Mwynchwilio
|
||||
STR_FUND_INDUSTRY_BUILD_NEW_INDUSTRY :{BLACK}Adeiladu
|
||||
STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY :{BLACK}Ariannu
|
||||
STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_QUERY :{YELLOW}Ydych chi'n siŵr eich bod eisiau dileu pob diwydiant?
|
||||
|
||||
# Industry cargoes window
|
||||
STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION :{WHITE}Cadwyn ddiwydiant ar gyfer diwydiant {STRING}
|
||||
@@ -2799,6 +2812,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Manylion
|
||||
STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}Dim gwybodaeth ar gael
|
||||
STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING}
|
||||
STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING}
|
||||
STR_SAVELOAD_PARENT_DIRECTORY :{STRING} (Plygell rhiant)
|
||||
|
||||
STR_SAVELOAD_OSKTITLE :{BLACK}Rhowch enw ar gyfer y gêm a gadwyd
|
||||
|
||||
@@ -2859,6 +2873,7 @@ STR_MAPGEN_HEIGHTMAP_NAME :{BLACK}Enw'r Ma
|
||||
STR_MAPGEN_HEIGHTMAP_SIZE_LABEL :{BLACK}Maint:
|
||||
STR_MAPGEN_HEIGHTMAP_SIZE :{ORANGE}{NUM} x {NUM}
|
||||
|
||||
STR_MAPGEN_SNOW_COVERAGE_QUERY_CAPT :{WHITE}Gorchudd eira (mewn %)
|
||||
STR_MAPGEN_START_DATE_QUERY_CAPT :{WHITE}Newid y flwyddyn gychwyn
|
||||
|
||||
# SE Map generation
|
||||
@@ -2995,6 +3010,7 @@ STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING
|
||||
STR_NEWGRF_ERROR_MSG_WARNING :{RED}Rhybudd: {SILVER}{STRING}
|
||||
STR_NEWGRF_ERROR_MSG_ERROR :{RED}Gwall: {SILVER}{STRING}
|
||||
STR_NEWGRF_ERROR_MSG_FATAL :{RED}Angheuol: {SILVER}{STRING}
|
||||
STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}Mae'r NewGRF "{STRING}" wedi dychwelyd gwall angheuol:{}{STRING}
|
||||
STR_NEWGRF_ERROR_VERSION_NUMBER :Ni fydd {1:STRING} yn gweithio gyda'r fersiwn o TTDPatch yr adroddir gan OpenTTD
|
||||
STR_NEWGRF_ERROR_DOS_OR_WINDOWS :Mae {1:STRING} ar gyfer y fersiwn {STRING} o TTD
|
||||
STR_NEWGRF_ERROR_UNSET_SWITCH :Mae {1:STRING} wedi ei gynllunio i gael ei ddefnyddio gyda {STRING}
|
||||
@@ -3141,6 +3157,7 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{YELLOW} Llwgrw
|
||||
# Goal window
|
||||
STR_GOALS_CAPTION :{WHITE}Amcanion {COMPANY}
|
||||
STR_GOALS_SPECTATOR_CAPTION :{WHITE}Amcanion Bydol
|
||||
STR_GOALS_COMPANY_BUTTON_HELPTEXT :{BLACK}Dangos amcanion y cwmni
|
||||
STR_GOALS_TEXT :{ORANGE}{STRING}
|
||||
STR_GOALS_NONE :{ORANGE}- Dim -
|
||||
STR_GOALS_PROGRESS :{ORANGE}{STRING}
|
||||
@@ -3283,6 +3300,7 @@ STR_FINANCES_CAPTION :{WHITE}Cyllid {
|
||||
STR_FINANCES_YEAR :{WHITE}{NUM}
|
||||
|
||||
###length 3
|
||||
STR_FINANCES_OPERATING_EXPENSES_TITLE :{WHITE}Costau Gweithredol
|
||||
|
||||
|
||||
###length 13
|
||||
@@ -3704,6 +3722,7 @@ STR_REPLACE_MONORAIL_VEHICLES :Cerbydau Monore
|
||||
STR_REPLACE_MAGLEV_VEHICLES :Cerbydau Maglef
|
||||
|
||||
|
||||
STR_REPLACE_REMOVE_WAGON :{BLACK}Tynnu wagenni: ({STRING}): {ORANGE}{STRING}
|
||||
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Gwneud i awtoddisodli gadw hyd y trên yr un peth drwy dynnu wagenni (gan ddechrau yn y blaen), os byddai newid yr injan yn gwneud y trên yn hirach
|
||||
|
||||
# Vehicle view
|
||||
@@ -3794,6 +3813,7 @@ STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Pwys: {L
|
||||
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Pwys: {LTBLUE}{WEIGHT_SHORT} {BLACK}Pŵer: {LTBLUE}{POWER}{BLACK} Cyflym. Max: {LTBLUE}{VELOCITY} {BLACK}Max. T.E.: {LTBLUE}{FORCE}
|
||||
|
||||
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Elw eleni: {LTBLUE}{CURRENCY_LONG} (llynedd: {CURRENCY_LONG})
|
||||
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR_MIN_PERFORMANCE :{BLACK}Elw eleni: {LTBLUE}{CURRENCY_LONG} (Elw llynedd : {CURRENCY_LONG}) {BLACK}Perfformiad isafsymol: {LTBLUE}{POWER_TO_WEIGHT}
|
||||
STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS :{BLACK}Dibynadwyedd: {LTBLUE}{COMMA}% {BLACK}Toriadau ers gwasanaeth olaf: {LTBLUE}{COMMA}
|
||||
|
||||
STR_VEHICLE_INFO_BUILT_VALUE :{LTBLUE}{ENGINE} {BLACK}Codi: {LTBLUE}{NUM}{BLACK} Pris: {LTBLUE}{CURRENCY_LONG}
|
||||
@@ -4140,7 +4160,7 @@ STR_AI_CONFIG_MOVE_DOWN_TOOLTIP :{BLACK}Symud yr
|
||||
STR_AI_CONFIG_GAMESCRIPT :{SILVER}Sgript Gêm
|
||||
STR_AI_CONFIG_AI :{SILVER}AIau
|
||||
|
||||
STR_AI_CONFIG_CHANGE_AI :AI
|
||||
STR_AI_CONFIG_CHANGE_AI :{BLACK} Dewis AI
|
||||
STR_AI_CONFIG_CHANGE_GAMESCRIPT :Sgript Gêm
|
||||
STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Llwytho sgript arall
|
||||
STR_AI_CONFIG_CONFIGURE :{BLACK}Ffurfweddu
|
||||
@@ -4161,6 +4181,7 @@ STR_AI_LIST_ACCEPT_TOOLTIP :{BLACK}Dewis y
|
||||
STR_AI_LIST_CANCEL :{BLACK}Canslo
|
||||
STR_AI_LIST_CANCEL_TOOLTIP :{BLACK}Peidio newid y sgript
|
||||
|
||||
STR_SCREENSHOT_CAPTION :{WHITE}Creu ciplun
|
||||
|
||||
# Script Parameters
|
||||
STR_AI_SETTINGS_CAPTION_AI :AI
|
||||
@@ -4421,6 +4442,7 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :math depo anghy
|
||||
STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}Aeth gormod o amser heibio i allu adnewyddu {VEHICLE}
|
||||
STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Ni weithredwyd unrhyw reolau awtogyfnewid/adnewyddu
|
||||
STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(terfyn arian)
|
||||
STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}Nid yw'r cerbyd newydd yn gallu cario {STRING}
|
||||
|
||||
# Rail construction errors
|
||||
STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Cyfuniad trac amhosib
|
||||
@@ -4601,6 +4623,7 @@ STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION :{WHITE}... rhy
|
||||
STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... nid yw o fewn cyrraedd yr awyren
|
||||
|
||||
# Extra messages which go on the third line of errors, explaining why orders failed
|
||||
STR_ERROR_AIRPORT_NO_PLANES :{WHITE}Nid yw'r awyren yma'n gallu glanio yn yr hofrenfa yma
|
||||
|
||||
# Timetable related errors
|
||||
STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Methu amserlennu cerbyd...
|
||||
@@ -4743,7 +4766,7 @@ STR_SV_STNAME_SIDINGS :Cilffordd {STRI
|
||||
STR_SV_STNAME_BRANCH :Cangen {STRING}
|
||||
STR_SV_STNAME_UPPER :Blaenau {STRING}
|
||||
STR_SV_STNAME_LOWER :Dyffryn {STRING}
|
||||
STR_SV_STNAME_HELIPORT :Hofrenyddborth {STRING}
|
||||
STR_SV_STNAME_HELIPORT :Hofrenfa {STRING}
|
||||
STR_SV_STNAME_FOREST :Coedwig {STRING}
|
||||
STR_SV_STNAME_FALLBACK :{STRING} Gorsaf #{NUM}
|
||||
|
||||
|
@@ -50,37 +50,25 @@ const char *MusicDriver_ExtMidi::Start(const StringList &parm)
|
||||
if (StrEmpty(command)) command = EXTERNAL_PLAYER " " MIDI_ARG;
|
||||
#endif
|
||||
|
||||
/* Count number of arguments, but include 3 extra slots: 1st for command, 2nd for song title, and 3rd for terminating nullptr. */
|
||||
uint num_args = 3;
|
||||
for (const char *t = command; *t != '\0'; t++) if (*t == ' ') num_args++;
|
||||
this->command_tokens.clear();
|
||||
|
||||
this->params = CallocT<char *>(num_args);
|
||||
this->params[0] = stredup(command);
|
||||
std::string_view view = command;
|
||||
for (;;) {
|
||||
auto pos = view.find(' ');
|
||||
this->command_tokens.emplace_back(view.substr(0, pos));
|
||||
|
||||
/* Replace space with \0 and add next arg to params */
|
||||
uint p = 1;
|
||||
while (true) {
|
||||
this->params[p] = strchr(this->params[p - 1], ' ');
|
||||
if (this->params[p] == nullptr) break;
|
||||
|
||||
this->params[p][0] = '\0';
|
||||
this->params[p]++;
|
||||
p++;
|
||||
if (pos == std::string_view::npos) break;
|
||||
view.remove_prefix(pos + 1);
|
||||
}
|
||||
|
||||
/* Last parameter is the song file. */
|
||||
this->params[p] = this->song;
|
||||
|
||||
this->song[0] = '\0';
|
||||
this->song.clear();
|
||||
this->pid = -1;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MusicDriver_ExtMidi::Stop()
|
||||
{
|
||||
free(params[0]);
|
||||
free(params);
|
||||
this->song[0] = '\0';
|
||||
this->song.clear();
|
||||
this->DoStop();
|
||||
}
|
||||
|
||||
@@ -88,14 +76,14 @@ void MusicDriver_ExtMidi::PlaySong(const MusicSongInfo &song)
|
||||
{
|
||||
std::string filename = MidiFile::GetSMFFile(song);
|
||||
if (!filename.empty()) {
|
||||
strecpy(this->song, filename.c_str(), lastof(this->song));
|
||||
this->song = std::move(filename);
|
||||
this->DoStop();
|
||||
}
|
||||
}
|
||||
|
||||
void MusicDriver_ExtMidi::StopSong()
|
||||
{
|
||||
this->song[0] = '\0';
|
||||
this->song.clear();
|
||||
this->DoStop();
|
||||
}
|
||||
|
||||
@@ -106,7 +94,7 @@ bool MusicDriver_ExtMidi::IsSongPlaying()
|
||||
this->pid = -1;
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) == 255) this->failed = true;
|
||||
}
|
||||
if (this->pid == -1 && this->song[0] != '\0') this->DoPlay();
|
||||
if (this->pid == -1 && !this->song.empty()) this->DoPlay();
|
||||
return this->pid != -1;
|
||||
}
|
||||
|
||||
@@ -124,7 +112,14 @@ void MusicDriver_ExtMidi::DoPlay()
|
||||
close(0);
|
||||
int d = open("/dev/null", O_RDONLY);
|
||||
if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) {
|
||||
execvp(this->params[0], this->params);
|
||||
/* execvp is nasty as it *allows* the passed parameters to be written
|
||||
* for backward compatibility, however we are a fork so do not care. */
|
||||
std::vector<char *> parameters;
|
||||
for (auto &token : this->command_tokens) parameters.emplace_back(token.data());
|
||||
parameters.emplace_back(this->song.data());
|
||||
parameters.emplace_back(nullptr);
|
||||
|
||||
execvp(parameters[0], parameters.data());
|
||||
}
|
||||
_exit(255);
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@
|
||||
|
||||
class MusicDriver_ExtMidi : public MusicDriver {
|
||||
private:
|
||||
char **params;
|
||||
char song[MAX_PATH];
|
||||
std::vector<std::string> command_tokens;
|
||||
std::string song;
|
||||
pid_t pid;
|
||||
bool failed = false;
|
||||
|
||||
|
@@ -21,25 +21,7 @@
|
||||
*/
|
||||
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast);
|
||||
|
||||
#if defined(HAVE_GETIFADDRS)
|
||||
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // GETIFADDRS implementation
|
||||
{
|
||||
struct ifaddrs *ifap, *ifa;
|
||||
|
||||
if (getifaddrs(&ifap) != 0) return;
|
||||
|
||||
for (ifa = ifap; ifa != nullptr; ifa = ifa->ifa_next) {
|
||||
if (!(ifa->ifa_flags & IFF_BROADCAST)) continue;
|
||||
if (ifa->ifa_broadaddr == nullptr) continue;
|
||||
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
||||
|
||||
NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
|
||||
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
|
||||
}
|
||||
freeifaddrs(ifap);
|
||||
}
|
||||
|
||||
#elif defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Win32 implementation
|
||||
{
|
||||
SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
@@ -82,48 +64,22 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Wi
|
||||
closesocket(sock);
|
||||
}
|
||||
|
||||
#else /* not HAVE_GETIFADDRS */
|
||||
|
||||
#include "../../string_func.h"
|
||||
|
||||
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // !GETIFADDRS implementation
|
||||
#else /* not WIN32 */
|
||||
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast)
|
||||
{
|
||||
SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock == INVALID_SOCKET) return;
|
||||
struct ifaddrs *ifap, *ifa;
|
||||
|
||||
char buf[4 * 1024]; // Arbitrary buffer size
|
||||
struct ifconf ifconf;
|
||||
if (getifaddrs(&ifap) != 0) return;
|
||||
|
||||
ifconf.ifc_len = sizeof(buf);
|
||||
ifconf.ifc_buf = buf;
|
||||
if (ioctl(sock, SIOCGIFCONF, &ifconf) == -1) {
|
||||
closesocket(sock);
|
||||
return;
|
||||
for (ifa = ifap; ifa != nullptr; ifa = ifa->ifa_next) {
|
||||
if (!(ifa->ifa_flags & IFF_BROADCAST)) continue;
|
||||
if (ifa->ifa_broadaddr == nullptr) continue;
|
||||
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
||||
|
||||
NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
|
||||
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
|
||||
}
|
||||
|
||||
const char *buf_end = buf + ifconf.ifc_len;
|
||||
for (const char *p = buf; p < buf_end;) {
|
||||
const struct ifreq *req = (const struct ifreq*)p;
|
||||
|
||||
if (req->ifr_addr.sa_family == AF_INET) {
|
||||
struct ifreq r;
|
||||
|
||||
strecpy(r.ifr_name, req->ifr_name, lastof(r.ifr_name));
|
||||
if (ioctl(sock, SIOCGIFFLAGS, &r) != -1 &&
|
||||
(r.ifr_flags & IFF_BROADCAST) &&
|
||||
ioctl(sock, SIOCGIFBRDADDR, &r) != -1) {
|
||||
NetworkAddress addr(&r.ifr_broadaddr, sizeof(sockaddr));
|
||||
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
|
||||
}
|
||||
}
|
||||
|
||||
p += sizeof(struct ifreq);
|
||||
#if defined(AF_LINK) && !defined(SUNOS)
|
||||
p += req->ifr_addr.sa_len - sizeof(struct sockaddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
closesocket(sock);
|
||||
freeifaddrs(ifap);
|
||||
}
|
||||
#endif /* all NetworkFindBroadcastIPsInternals */
|
||||
|
||||
|
@@ -94,15 +94,7 @@ typedef unsigned long in_addr_t;
|
||||
# include <netinet/tcp.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <net/if.h>
|
||||
/* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */
|
||||
# if !defined(__sgi__) && !defined(SUNOS) \
|
||||
&& !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX)
|
||||
/* If for any reason ifaddrs.h does not exist on your system, comment out
|
||||
* the following two lines and an alternative way will be used to fetch
|
||||
* the list of IPs from the system. */
|
||||
# include <ifaddrs.h>
|
||||
# define HAVE_GETIFADDRS
|
||||
# endif
|
||||
# include <ifaddrs.h>
|
||||
# if !defined(INADDR_NONE)
|
||||
# define INADDR_NONE 0xffffffff
|
||||
# endif
|
||||
|
@@ -500,7 +500,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *p)
|
||||
DEBUG(net, 3, "[admin] Rcon command from '%s' (%s): %s", this->admin_name.c_str(), this->admin_version.c_str(), command.c_str());
|
||||
|
||||
_redirect_console_to_admin = this->index;
|
||||
IConsoleCmdExec(command.c_str());
|
||||
IConsoleCmdExec(command);
|
||||
_redirect_console_to_admin = INVALID_ADMIN_ID;
|
||||
return this->SendRconEnd(command);
|
||||
}
|
||||
|
@@ -705,19 +705,19 @@ void ClientNetworkContentSocketHandler::OnReceiveData(const char *data, size_t l
|
||||
check_not_null(p);
|
||||
p++; // Start after the '/'
|
||||
|
||||
char tmp[MAX_PATH];
|
||||
if (strecpy(tmp, p, lastof(tmp)) == lastof(tmp)) {
|
||||
this->OnFailure();
|
||||
return;
|
||||
}
|
||||
std::string filename = p;
|
||||
/* Remove the extension from the string. */
|
||||
for (uint i = 0; i < 2; i++) {
|
||||
p = strrchr(tmp, '.');
|
||||
check_and_terminate(p);
|
||||
auto pos = filename.find_last_of('.');
|
||||
if (pos == std::string::npos) {
|
||||
this->OnFailure();
|
||||
return;
|
||||
}
|
||||
filename.erase(pos);
|
||||
}
|
||||
|
||||
/* Copy the string, without extension, to the filename. */
|
||||
this->curInfo->filename = tmp;
|
||||
this->curInfo->filename = std::move(filename);
|
||||
|
||||
/* Request the next file. */
|
||||
if (!this->BeforeDownload()) {
|
||||
|
@@ -1702,7 +1702,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *p)
|
||||
|
||||
_redirect_console_to_client = this->client_id;
|
||||
this->rcon_reply_key = ss.shared_data + 32; /* second key */
|
||||
IConsoleCmdExec(command.c_str());
|
||||
IConsoleCmdExec(command);
|
||||
_redirect_console_to_client = INVALID_CLIENT_ID;
|
||||
this->rcon_auth_failures = 0;
|
||||
this->rcon_reply_key = nullptr;
|
||||
|
@@ -111,8 +111,8 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is
|
||||
|
||||
/* First create a pattern to match the wanted language. */
|
||||
FcPattern *pat = FcNameParse((const FcChar8 *)lang.c_str());
|
||||
/* We only want to know the filename. */
|
||||
FcObjectSet *os = FcObjectSetBuild(FC_FILE, FC_SPACING, FC_SLANT, FC_WEIGHT, nullptr);
|
||||
/* We only want to know these attributes. */
|
||||
FcObjectSet *os = FcObjectSetBuild(FC_FILE, FC_INDEX, FC_SPACING, FC_SLANT, FC_WEIGHT, nullptr);
|
||||
/* Get the list of filenames matching the wanted language. */
|
||||
FcFontSet *fs = FcFontList(nullptr, pat, os);
|
||||
|
||||
@@ -123,6 +123,7 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is
|
||||
if (fs != nullptr) {
|
||||
int best_weight = -1;
|
||||
const char *best_font = nullptr;
|
||||
int best_index = 0;
|
||||
|
||||
for (int i = 0; i < fs->nfont; i++) {
|
||||
FcPattern *font = fs->fonts[i];
|
||||
@@ -146,7 +147,12 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is
|
||||
FcPatternGetInteger(font, FC_WEIGHT, 0, &value);
|
||||
if (value <= best_weight) continue;
|
||||
|
||||
callback->SetFontNames(settings, (const char *)file);
|
||||
/* Possible match based on attributes, get index. */
|
||||
int32_t index;
|
||||
res = FcPatternGetInteger(font, FC_INDEX, 0, &index);
|
||||
if (res != FcResultMatch) continue;
|
||||
|
||||
callback->SetFontNames(settings, (const char *)file, &index);
|
||||
|
||||
bool missing = callback->FindMissingGlyphs();
|
||||
DEBUG(fontcache, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
|
||||
@@ -154,12 +160,13 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is
|
||||
if (!missing) {
|
||||
best_weight = value;
|
||||
best_font = (const char *)file;
|
||||
best_index = index;
|
||||
}
|
||||
}
|
||||
|
||||
if (best_font != nullptr) {
|
||||
ret = true;
|
||||
callback->SetFontNames(settings, best_font);
|
||||
callback->SetFontNames(settings, best_font, &best_index);
|
||||
InitFontCache(callback->Monospace());
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef WITH_SDL2
|
||||
#include <SDL.h>
|
||||
@@ -50,10 +51,6 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_THREADS
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# if defined(WITH_SDL)
|
||||
/* the mac implementation needs this file included in the same file as main() */
|
||||
@@ -141,29 +138,30 @@ static const char *GetLocalCode()
|
||||
* Convert between locales, which from and which to is set in the calling
|
||||
* functions OTTD2FS() and FS2OTTD().
|
||||
*/
|
||||
static const char *convert_tofrom_fs(iconv_t convd, const char *name, char *outbuf, size_t outlen)
|
||||
static std::string convert_tofrom_fs(iconv_t convd, const std::string &name)
|
||||
{
|
||||
/* There are different implementations of iconv. The older ones,
|
||||
* e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
|
||||
* IEEE 1003.1 (2004), pass a non-const pointer. */
|
||||
#ifdef HAVE_NON_CONST_ICONV
|
||||
char *inbuf = const_cast<char*>(name);
|
||||
char *inbuf = const_cast<char*>(name.data());
|
||||
#else
|
||||
const char *inbuf = name;
|
||||
const char *inbuf = name.data();
|
||||
#endif
|
||||
|
||||
size_t inlen = strlen(name);
|
||||
char *buf = outbuf;
|
||||
|
||||
strecpy(outbuf, name, outbuf + outlen);
|
||||
/* If the output is UTF-32, then 1 ASCII character becomes 4 bytes. */
|
||||
size_t inlen = name.size();
|
||||
std::string buf(inlen * 4, '\0');
|
||||
|
||||
size_t outlen = buf.size();
|
||||
char *outbuf = buf.data();
|
||||
iconv(convd, nullptr, nullptr, nullptr, nullptr);
|
||||
if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
|
||||
DEBUG(misc, 0, "[iconv] error converting '%s'. Errno %d", name, errno);
|
||||
DEBUG(misc, 0, "[iconv] error converting '%s'. Errno %d", name.c_str(), errno);
|
||||
return name;
|
||||
}
|
||||
|
||||
*outbuf = '\0';
|
||||
/* FIX: invalid characters will abort conversion, but they shouldn't occur? */
|
||||
buf.resize(outbuf - buf.data());
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -175,8 +173,6 @@ static const char *convert_tofrom_fs(iconv_t convd, const char *name, char *outb
|
||||
std::string OTTD2FS(const std::string &name)
|
||||
{
|
||||
static iconv_t convd = (iconv_t)(-1);
|
||||
char buf[1024] = {};
|
||||
|
||||
if (convd == (iconv_t)(-1)) {
|
||||
const char *env = GetLocalCode();
|
||||
convd = iconv_open(env, INTERNALCODE);
|
||||
@@ -186,7 +182,7 @@ std::string OTTD2FS(const std::string &name)
|
||||
}
|
||||
}
|
||||
|
||||
return convert_tofrom_fs(convd, name.c_str(), buf, lengthof(buf));
|
||||
return convert_tofrom_fs(convd, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,8 +193,6 @@ std::string OTTD2FS(const std::string &name)
|
||||
std::string FS2OTTD(const std::string &name)
|
||||
{
|
||||
static iconv_t convd = (iconv_t)(-1);
|
||||
char buf[1024] = {};
|
||||
|
||||
if (convd == (iconv_t)(-1)) {
|
||||
const char *env = GetLocalCode();
|
||||
convd = iconv_open(INTERNALCODE, env);
|
||||
@@ -208,7 +202,7 @@ std::string FS2OTTD(const std::string &name)
|
||||
}
|
||||
}
|
||||
|
||||
return convert_tofrom_fs(convd, name.c_str(), buf, lengthof(buf));
|
||||
return convert_tofrom_fs(convd, name);
|
||||
}
|
||||
|
||||
#endif /* WITH_ICONV */
|
||||
@@ -311,11 +305,9 @@ void OSOpenBrowser(const char *url)
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
void SetCurrentThreadName(const char *threadName) {
|
||||
#if !defined(NO_THREADS) && defined(__GLIBC__)
|
||||
#if __GLIBC_PREREQ(2, 12)
|
||||
#if defined(__GLIBC__)
|
||||
if (threadName) pthread_setname_np(pthread_self(), threadName);
|
||||
#endif /* __GLIBC_PREREQ(2, 12) */
|
||||
#endif /* !defined(NO_THREADS) && defined(__GLIBC__) */
|
||||
#endif /* defined(__GLIBC__) */
|
||||
#if defined(__APPLE__)
|
||||
MacOSSetThreadName(threadName);
|
||||
#endif /* defined(__APPLE__) */
|
||||
|
@@ -1832,7 +1832,7 @@ static const NWidgetPart _nested_smallmap_bar[] = {
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_CENTERMAP),
|
||||
SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), SetFill(1, 1),
|
||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_BLANK),
|
||||
SetDataTip(SPR_DOT_SMALL, STR_NULL), SetFill(1, 1),
|
||||
SetDataTip(SPR_EMPTY, STR_NULL), SetFill(1, 1),
|
||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_CONTOUR),
|
||||
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), SetFill(1, 1),
|
||||
NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_VEHICLES),
|
||||
|
@@ -98,8 +98,7 @@ void SoundDriver_Win32::Stop()
|
||||
|
||||
/* Stop the sound thread. */
|
||||
_waveout = nullptr;
|
||||
SetEvent(_event);
|
||||
WaitForSingleObject(_thread, INFINITE);
|
||||
SignalObjectAndWait(_event, _thread, INFINITE, FALSE);
|
||||
|
||||
/* Close the sound device. */
|
||||
waveOutReset(waveout);
|
||||
|
@@ -352,7 +352,10 @@ uint GetSpriteCountForFile(const std::string &filename, SpriteID begin, SpriteID
|
||||
for (SpriteID i = begin; i != end; i++) {
|
||||
if (SpriteExists(i)) {
|
||||
SpriteCache *sc = GetSpriteCache(i);
|
||||
if (sc->file == file) count++;
|
||||
if (sc->file == file) {
|
||||
count++;
|
||||
DEBUG(sprite, 4, "Sprite: %u", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@@ -1024,7 +1027,7 @@ void IncreaseSpriteLRU()
|
||||
|
||||
/* Adjust all LRU values */
|
||||
if (_sprite_lru_counter >= 0xC0000000) {
|
||||
DEBUG(sprite, 3, "Fixing lru %u, inuse=" PRINTF_SIZE, _sprite_lru_counter, GetSpriteCacheUsage());
|
||||
DEBUG(sprite, 5, "Fixing lru %u, inuse=" PRINTF_SIZE, _sprite_lru_counter, GetSpriteCacheUsage());
|
||||
|
||||
for (SpriteID i = 0; i != _spritecache.size(); i++) {
|
||||
SpriteCache *sc = GetSpriteCache(i);
|
||||
|
@@ -2559,10 +2559,10 @@ bool MissingGlyphSearcher::FindMissingGlyphs()
|
||||
std::string size_name;
|
||||
|
||||
switch (size) {
|
||||
case 0: size_name = "medium"; break;
|
||||
case 1: size_name = "small"; break;
|
||||
case 2: size_name = "large"; break;
|
||||
case 3: size_name = "mono"; break;
|
||||
case FS_NORMAL: size_name = "medium"; break;
|
||||
case FS_SMALL: size_name = "small"; break;
|
||||
case FS_LARGE: size_name = "large"; break;
|
||||
case FS_MONO: size_name = "mono"; break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
static const SpriteID SPR_SELECT_TILE = 752;
|
||||
static const SpriteID SPR_DOT = 774; // corner marker for lower/raise land
|
||||
static const SpriteID SPR_DOT_SMALL = 4078;
|
||||
static const SpriteID SPR_EMPTY = 4078; // empty (transparent blue) sprite
|
||||
static const SpriteID SPR_WHITE_POINT = 4079;
|
||||
|
||||
/* ASCII */
|
||||
|
@@ -97,7 +97,6 @@ bool IsNonGameThread();
|
||||
template<class TFn, class... TArgs>
|
||||
inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&&... _Ax)
|
||||
{
|
||||
#ifndef NO_THREADS
|
||||
try {
|
||||
static std::mutex thread_startup_mutex;
|
||||
std::lock_guard<std::mutex> lock(thread_startup_mutex);
|
||||
@@ -132,7 +131,6 @@ inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&
|
||||
/* Something went wrong, the system we are running on might not support threads. */
|
||||
DEBUG(misc, 1, "Can't create thread '%s': %s", name, e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "../sl/saveload.h"
|
||||
#include "../thread.h"
|
||||
#include "../window_func.h"
|
||||
#include <iostream>
|
||||
#include "dedicated_v.h"
|
||||
|
||||
#if defined(UNIX)
|
||||
@@ -49,24 +50,18 @@ static void DedicatedSignalHandler(int sig)
|
||||
|
||||
static HANDLE _hInputReady, _hWaitForInputHandling;
|
||||
static HANDLE _hThread; // Thread to close
|
||||
static char _win_console_thread_buffer[200];
|
||||
static std::string _win_console_thread_buffer;
|
||||
|
||||
/* Windows Console thread. Just loop and signal when input has been received */
|
||||
static void WINAPI CheckForConsoleInput()
|
||||
{
|
||||
SetCurrentThreadName("ottd:win-console");
|
||||
|
||||
DWORD nb;
|
||||
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
for (;;) {
|
||||
ReadFile(hStdin, _win_console_thread_buffer, lengthof(_win_console_thread_buffer), &nb, nullptr);
|
||||
if (nb >= lengthof(_win_console_thread_buffer)) nb = lengthof(_win_console_thread_buffer) - 1;
|
||||
_win_console_thread_buffer[nb] = '\0';
|
||||
std::getline(std::cin, _win_console_thread_buffer);
|
||||
|
||||
/* Signal input waiting that input is read and wait for it being handled
|
||||
* SignalObjectAndWait() should be used here, but it's unsupported in Win98< */
|
||||
SetEvent(_hInputReady);
|
||||
WaitForSingleObject(_hWaitForInputHandling, INFINITE);
|
||||
/* Signal input waiting that input is read and wait for it being handled. */
|
||||
SignalObjectAndWait(_hInputReady, _hWaitForInputHandling, INFINITE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,31 +171,23 @@ static bool InputWaiting()
|
||||
|
||||
static void DedicatedHandleKeyInput()
|
||||
{
|
||||
static char input_line[1024] = "";
|
||||
|
||||
if (!InputWaiting()) return;
|
||||
|
||||
if (_exit_game) return;
|
||||
|
||||
std::string input_line;
|
||||
#if defined(UNIX)
|
||||
if (fgets(input_line, lengthof(input_line), stdin) == nullptr) return;
|
||||
if (!std::getline(std::cin, input_line)) return;
|
||||
#else
|
||||
/* Handle console input, and signal console thread, it can accept input again */
|
||||
static_assert(lengthof(_win_console_thread_buffer) <= lengthof(input_line));
|
||||
strecpy(input_line, _win_console_thread_buffer, lastof(input_line));
|
||||
std::swap(input_line, _win_console_thread_buffer);
|
||||
SetEvent(_hWaitForInputHandling);
|
||||
#endif
|
||||
|
||||
/* Remove trailing \r or \n */
|
||||
for (char *c = input_line; *c != '\0'; c++) {
|
||||
if (*c == '\n' || *c == '\r' || c == lastof(input_line)) {
|
||||
*c = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
StrMakeValidInPlace(input_line, lastof(input_line));
|
||||
|
||||
IConsoleCmdExec(input_line); // execute command
|
||||
/* Remove any trailing \r or \n, and ensure the string is valid. */
|
||||
auto p = input_line.find_last_not_of("\r\n");
|
||||
if (p != std::string::npos) p++;
|
||||
IConsoleCmdExec(StrMakeValid(input_line.substr(0, p)));
|
||||
}
|
||||
|
||||
void VideoDriver_Dedicated::MainLoop()
|
||||
|
@@ -1626,7 +1626,7 @@ static void DrawTileSelection(const TileInfo *ti)
|
||||
if (IsSteepSlope(ti->tileh)) z -= TILE_HEIGHT;
|
||||
}
|
||||
}
|
||||
DrawSelectionSprite(_cur_dpi->zoom <= ZOOM_LVL_DETAIL ? SPR_DOT : SPR_DOT_SMALL, PAL_NONE, ti, z, foundation_part);
|
||||
DrawSelectionSprite(SPR_DOT, PAL_NONE, ti, z, foundation_part);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user