mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use StringParameters to pass parameters for ErrorWindow strings
parent
9872fd5dc8
commit
bd80ff4d57
|
@ -276,7 +276,7 @@ struct AIConfigWindow : public Window {
|
|||
|
||||
case WID_AIC_CONTENT_DOWNLOAD:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
ShowNetworkContentListWindow(nullptr, CONTENT_TYPE_AI);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void AIInstance::Died()
|
|||
|
||||
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
|
||||
if (info != nullptr) {
|
||||
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, MakeParameters(), WL_WARNING);
|
||||
|
||||
if (!info->GetURL().empty()) {
|
||||
ScriptLog::Info("Please report the error to the following URL:");
|
||||
|
|
|
@ -444,6 +444,6 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
|||
if (!bl.empty()) {
|
||||
new BuildBridgeWindow(&_build_bridge_desc, start, end, transport_type, road_rail_type, std::move(bl));
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, MakeParameters(), WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
|
|||
* If yes, disallow the change. */
|
||||
for (TileIndex t = 0; t < Map::Size(); t++) {
|
||||
if ((int32_t)TileHeight(t) > new_value) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
/* Return old, unchanged value */
|
||||
return _settings_game.construction.map_height_limit;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ std::tuple<bool, bool, bool> CommandHelperBase::InternalPostBefore(Commands cmd,
|
|||
bool only_sending = _networking && !network_command;
|
||||
|
||||
if (_pause_mode != PM_UNPAUSED && !IsCommandAllowedWhilePaused(cmd) && !estimate_only) {
|
||||
ShowErrorMessage(err_message, STR_ERROR_NOT_ALLOWED_WHILE_PAUSED, WL_INFO, TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE);
|
||||
ShowErrorMessage(err_message, STR_ERROR_NOT_ALLOWED_WHILE_PAUSED, MakeParameters(), WL_INFO, TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE);
|
||||
return { true, estimate_only, only_sending };
|
||||
} else {
|
||||
return { false, estimate_only, only_sending };
|
||||
|
|
|
@ -1660,7 +1660,7 @@ public:
|
|||
case WID_SCMF_LOAD:
|
||||
this->face = _company_manager_face;
|
||||
ScaleAllCompanyManagerFaceBits(this->face);
|
||||
ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
this->UpdateData();
|
||||
this->SetDirty();
|
||||
break;
|
||||
|
@ -1674,7 +1674,7 @@ public:
|
|||
/* Save button */
|
||||
case WID_SCMF_SAVE:
|
||||
_company_manager_face = this->face;
|
||||
ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
break;
|
||||
|
||||
/* Toggle gender (male/female) button */
|
||||
|
@ -1751,11 +1751,11 @@ public:
|
|||
if (!StrEmpty(str)) {
|
||||
this->face = std::strtoul(str, nullptr, 10);
|
||||
ScaleAllCompanyManagerFaceBits(this->face);
|
||||
ShowErrorMessage(STR_FACE_FACECODE_SET, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_FACE_FACECODE_SET, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
this->UpdateData();
|
||||
this->SetDirty();
|
||||
} else {
|
||||
ShowErrorMessage(STR_FACE_FACECODE_ERR, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_FACE_FACECODE_ERR, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -931,10 +931,10 @@ struct DepotWindow : Window {
|
|||
})) {
|
||||
OnVehicleSelect(*begin);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
} else {
|
||||
/* If CTRL is pressed: If all the vehicles in this list share orders, then copy orders */
|
||||
|
@ -946,10 +946,10 @@ struct DepotWindow : Window {
|
|||
})) {
|
||||
OnVehicleSelect(*begin);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUY_TRAIN + (*begin)->type, STR_ERROR_CAN_T_CLONE_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1298,9 +1298,8 @@ void CheckEngines()
|
|||
}
|
||||
|
||||
if (min_date < INT32_MAX) {
|
||||
SetDParam(0, min_date);
|
||||
ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_YET, STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION, WL_WARNING);
|
||||
ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_YET, STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION, MakeParameters(min_date), WL_WARNING);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL, STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION, WL_WARNING);
|
||||
ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL, STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION, MakeParameters(), WL_WARNING);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
void SetDParamStr(uint n, const char *str);
|
||||
void SetDParamStr(uint n, const std::string &str);
|
||||
|
||||
void CopyOutDParams();
|
||||
void CopyOutDParams(class StringParameters &¶ms);
|
||||
};
|
||||
|
||||
/** Define a queue with errors. */
|
||||
|
@ -65,7 +65,7 @@ void ScheduleErrorMessage(ErrorList &datas);
|
|||
void ScheduleErrorMessage(const ErrorMessageData &data);
|
||||
|
||||
void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc);
|
||||
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = nullptr, uint textref_stack_size = 0, const uint32_t *textref_stack = nullptr, StringID extra_msg = INVALID_STRING_ID);
|
||||
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, class StringParameters &¶ms, WarningLevel wl, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = nullptr, uint textref_stack_size = 0, const uint32_t *textref_stack = nullptr, StringID extra_msg = INVALID_STRING_ID);
|
||||
bool HideActiveErrorMessage();
|
||||
|
||||
void ClearErrorMessages();
|
||||
|
|
|
@ -113,7 +113,7 @@ ErrorMessageData::ErrorMessageData(StringID summary_msg, StringID detailed_msg,
|
|||
/**
|
||||
* Copy error parameters from current DParams.
|
||||
*/
|
||||
void ErrorMessageData::CopyOutDParams()
|
||||
void ErrorMessageData::CopyOutDParams(StringParameters &¶ms)
|
||||
{
|
||||
if (this->detailed_msg == STR_ERROR_OWNED_BY) {
|
||||
/* The parameters are set by SetDParamsForOwnedBy. */
|
||||
|
@ -123,7 +123,7 @@ void ErrorMessageData::CopyOutDParams()
|
|||
|
||||
/* Get parameters using type information */
|
||||
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
|
||||
CopyOutDParam(this->params, 20);
|
||||
CopyOutDParam(this->params, std::move(params));
|
||||
if (this->textref_stack_size > 0) StopTextRefStackUsage();
|
||||
}
|
||||
|
||||
|
@ -366,13 +366,14 @@ void UnshowCriticalError()
|
|||
*/
|
||||
void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc)
|
||||
{
|
||||
ShowErrorMessage(summary_msg, cc.GetErrorMessage(), WL_INFO, x, y, cc.GetTextRefStackGRF(), cc.GetTextRefStackSize(), cc.GetTextRefStack(), cc.GetExtraErrorMessage());
|
||||
ShowErrorMessage(summary_msg, cc.GetErrorMessage(), MakeParameters(), WL_INFO, x, y, cc.GetTextRefStackGRF(), cc.GetTextRefStackSize(), cc.GetTextRefStack(), cc.GetExtraErrorMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an error message in a window.
|
||||
* @param summary_msg General error message showed in first line. Must be valid.
|
||||
* @param detailed_msg Detailed error message showed in second line. Can be INVALID_STRING_ID.
|
||||
* @param params Parameters for the error message.
|
||||
* @param wl Message severity.
|
||||
* @param x World X position (TileVirtX) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
|
||||
* @param y World Y position (TileVirtY) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
|
||||
|
@ -381,7 +382,7 @@ void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc)
|
|||
* @param textref_stack Values to put on the #TextRefStack.
|
||||
* @param extra_msg Extra error message shown in third line. Can be INVALID_STRING_ID.
|
||||
*/
|
||||
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y, const GRFFile *textref_stack_grffile, uint textref_stack_size, const uint32_t *textref_stack, StringID extra_msg)
|
||||
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, StringParameters &¶ms, WarningLevel wl, int x, int y, const GRFFile *textref_stack_grffile, uint textref_stack_size, const uint32_t *textref_stack, StringID extra_msg)
|
||||
{
|
||||
assert(textref_stack_size == 0 || (textref_stack_grffile != nullptr && textref_stack != nullptr));
|
||||
if (summary_msg == STR_NULL) summary_msg = STR_EMPTY;
|
||||
|
@ -412,7 +413,7 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
|
|||
if (_settings_client.gui.errmsg_duration == 0 && !is_critical) return;
|
||||
|
||||
ErrorMessageData data(summary_msg, detailed_msg, is_critical, x, y, textref_stack_grffile, textref_stack_size, textref_stack, extra_msg);
|
||||
data.CopyOutDParams();
|
||||
data.CopyOutDParams(std::move(params));
|
||||
|
||||
ErrmsgWindow *w = (ErrmsgWindow*)FindWindowById(WC_ERRMSG, 0);
|
||||
if (w != nullptr) {
|
||||
|
|
|
@ -640,7 +640,7 @@ public:
|
|||
|
||||
case WID_SL_MISSING_NEWGRFS:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else if (_load_check_data.HasNewGrfs()) {
|
||||
ShowMissingContentWindow(_load_check_data.grfconfig);
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ public:
|
|||
|
||||
case WID_SL_CONTENT_DOWNLOAD:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
assert(this->fop == SLO_LOAD);
|
||||
switch (this->abstract_filetype) {
|
||||
|
@ -752,7 +752,7 @@ public:
|
|||
|
||||
if (this->IsWidgetLowered(WID_SL_DELETE_SELECTION)) { // Delete button clicked
|
||||
if (!FiosDelete(this->filename_editbox.text.buf)) {
|
||||
ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
this->InvalidateData(SLIWD_RESCAN_FILES);
|
||||
/* Reset file name to current date on successful delete */
|
||||
|
|
|
@ -296,7 +296,7 @@ struct GSConfigWindow : public Window {
|
|||
|
||||
case WID_GSC_CONTENT_DOWNLOAD:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
ShowNetworkContentListWindow(nullptr, CONTENT_TYPE_GAME);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ void GameInstance::Died()
|
|||
|
||||
const GameInfo *info = Game::GetInfo();
|
||||
if (info != nullptr) {
|
||||
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, MakeParameters(), WL_WARNING);
|
||||
|
||||
if (!info->GetURL().empty()) {
|
||||
ScriptLog::Info("Please report the error to the following URL:");
|
||||
|
|
|
@ -142,20 +142,20 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map)
|
|||
|
||||
fp = FioFOpenFile(filename, "rb", HEIGHTMAP_DIR);
|
||||
if (fp == nullptr) {
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (png_ptr == nullptr) {
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, MakeParameters(), WL_ERROR);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == nullptr || setjmp(png_jmpbuf(png_ptr))) {
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, MakeParameters(), WL_ERROR);
|
||||
fclose(fp);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
return false;
|
||||
|
@ -171,7 +171,7 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map)
|
|||
/* Maps of wrong colour-depth are not used.
|
||||
* (this should have been taken care of by stripping alpha and 16-bit samples on load) */
|
||||
if ((png_get_channels(png_ptr, info_ptr) != 1) && (png_get_channels(png_ptr, info_ptr) != 3) && (png_get_bit_depth(png_ptr, info_ptr) != 8)) {
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_IMAGE_TYPE, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_IMAGE_TYPE, MakeParameters(), WL_ERROR);
|
||||
fclose(fp);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
return false;
|
||||
|
@ -181,7 +181,7 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map)
|
|||
uint height = png_get_image_height(png_ptr, info_ptr);
|
||||
|
||||
if (!IsValidHeightmapDimension(width, height)) {
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_HEIGHTMAP_TOO_LARGE, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_HEIGHTMAP_TOO_LARGE, MakeParameters(), WL_ERROR);
|
||||
fclose(fp);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
return false;
|
||||
|
@ -275,21 +275,21 @@ static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map)
|
|||
|
||||
f = FioFOpenFile(filename, "rb", HEIGHTMAP_DIR);
|
||||
if (f == nullptr) {
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
BmpInitializeBuffer(&buffer, f);
|
||||
|
||||
if (!BmpReadHeader(&buffer, &info, &data)) {
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, MakeParameters(), WL_ERROR);
|
||||
fclose(f);
|
||||
BmpDestroyData(&data);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidHeightmapDimension(info.width, info.height)) {
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_HEIGHTMAP_TOO_LARGE, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_HEIGHTMAP_TOO_LARGE, MakeParameters(), WL_ERROR);
|
||||
fclose(f);
|
||||
BmpDestroyData(&data);
|
||||
return false;
|
||||
|
@ -297,7 +297,7 @@ static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map)
|
|||
|
||||
if (map != nullptr) {
|
||||
if (!BmpReadBitmap(&buffer, &info, &data)) {
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, MakeParameters(), WL_ERROR);
|
||||
fclose(f);
|
||||
BmpDestroyData(&data);
|
||||
return false;
|
||||
|
|
|
@ -2096,9 +2096,9 @@ CommandCost CmdBuildIndustry(DoCommandFlag flags, TileIndex tile, IndustryType i
|
|||
}
|
||||
if (ret.Failed() && IsLocalCompany()) {
|
||||
if (prospect_success) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_PROSPECT_INDUSTRY, STR_ERROR_NO_SUITABLE_PLACES_FOR_PROSPECTING, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_PROSPECT_INDUSTRY, STR_ERROR_NO_SUITABLE_PLACES_FOR_PROSPECTING, MakeParameters(), WL_INFO);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_PROSPECT_INDUSTRY, STR_ERROR_PROSPECTING_WAS_UNLUCKY, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_PROSPECT_INDUSTRY, STR_ERROR_PROSPECTING_WAS_UNLUCKY, MakeParameters(), WL_INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3087,8 +3087,7 @@ void CheckIndustries()
|
|||
if (chance == 0 || !force_at_least_one) continue; // Types that are not available can be skipped.
|
||||
|
||||
const IndustrySpec *is = GetIndustrySpec(it);
|
||||
SetDParam(0, is->name);
|
||||
ShowErrorMessage(STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES, STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION, WL_WARNING);
|
||||
ShowErrorMessage(STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES, STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION, MakeParameters(is->name), WL_WARNING);
|
||||
|
||||
count++;
|
||||
if (count >= 3) break; // Don't swamp the user with errors.
|
||||
|
|
|
@ -255,8 +255,7 @@ void CcBuildIndustry(Commands, const CommandCost &result, TileIndex tile, Indust
|
|||
if (indtype < NUM_INDUSTRYTYPES) {
|
||||
const IndustrySpec *indsp = GetIndustrySpec(indtype);
|
||||
if (indsp->enabled) {
|
||||
SetDParam(0, indsp->name);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, result.GetErrorMessage(), WL_INFO, TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, result.GetErrorMessage(), MakeParameters(indsp->name), WL_INFO, TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -600,7 +599,7 @@ public:
|
|||
if (!confirmed) return;
|
||||
|
||||
if (Town::GetNumItems() == 0) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, MakeParameters(), WL_INFO);
|
||||
} else {
|
||||
Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
|
||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
|
||||
|
@ -701,8 +700,7 @@ public:
|
|||
if (_game_mode == GM_EDITOR) {
|
||||
/* Show error if no town exists at all */
|
||||
if (Town::GetNumItems() == 0) {
|
||||
SetDParam(0, indsp->name);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO, pt.x, pt.y);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, STR_ERROR_MUST_FOUND_TOWN_FIRST, MakeParameters(indsp->name), WL_INFO, pt.x, pt.y);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ struct SelectGameWindow : public Window {
|
|||
|
||||
case WID_SGI_PLAY_NETWORK:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
ShowNetworkGameWindow();
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ struct SelectGameWindow : public Window {
|
|||
case WID_SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
|
||||
case WID_SGI_CONTENT_DOWNLOAD:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
ShowNetworkContentListWindow();
|
||||
}
|
||||
|
|
|
@ -550,8 +550,7 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y)
|
|||
cost = -cost;
|
||||
msg = STR_MESSAGE_ESTIMATED_INCOME;
|
||||
}
|
||||
SetDParam(0, cost);
|
||||
ShowErrorMessage(msg, INVALID_STRING_ID, WL_INFO, x, y);
|
||||
ShowErrorMessage(msg, INVALID_STRING_ID, MakeParameters(cost), WL_INFO, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool)
|
|||
ClientNetworkEmergencySave();
|
||||
_switch_mode = SM_MENU;
|
||||
_networking = false;
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
|
||||
return this->CloseConnection(NETWORK_RECV_STATUS_CLIENT_QUIT);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ uint NetworkCalculateLag(const NetworkClientSocket *cs)
|
|||
void ShowNetworkError(StringID error_string)
|
||||
{
|
||||
_switch_mode = SM_MENU;
|
||||
ShowErrorMessage(error_string, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(error_string, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -845,7 +845,7 @@ bool NetworkValidateServerName(std::string &server_name)
|
|||
StrTrimInPlace(server_name);
|
||||
if (!server_name.empty()) return true;
|
||||
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_BAD_SERVER_NAME, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_BAD_SERVER_NAME, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -574,7 +574,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *)
|
|||
Debug(net, 9, "Client::Receive_SERVER_FULL()");
|
||||
|
||||
/* We try to join a server which is full */
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
|
||||
return NETWORK_RECV_STATUS_SERVER_FULL;
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *
|
|||
Debug(net, 9, "Client::Receive_SERVER_BANNED()");
|
||||
|
||||
/* We try to join a server where we are banned */
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
|
||||
return NETWORK_RECV_STATUS_SERVER_BANNED;
|
||||
}
|
||||
|
@ -685,10 +685,10 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p
|
|||
if (error < (ptrdiff_t)lengthof(network_error_strings)) err = network_error_strings[error];
|
||||
/* In case of kicking a client, we assume there is a kick message in the packet if we can read one byte */
|
||||
if (error == NETWORK_ERROR_KICKED && p->CanReadFromPacket(1)) {
|
||||
SetDParamStr(0, p->Recv_string(NETWORK_CHAT_LENGTH));
|
||||
ShowErrorMessage(err, STR_NETWORK_ERROR_KICK_MESSAGE, WL_CRITICAL);
|
||||
auto message = p->Recv_string(NETWORK_CHAT_LENGTH);
|
||||
ShowErrorMessage(err, STR_NETWORK_ERROR_KICK_MESSAGE, MakeParameters(message), WL_CRITICAL);
|
||||
} else {
|
||||
ShowErrorMessage(err, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(err, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
/* Perform an emergency save if we had already entered the game */
|
||||
|
@ -726,7 +726,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(P
|
|||
}
|
||||
|
||||
/* NewGRF mismatch, bail out */
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NEWGRF_MISMATCH, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NEWGRF_MISMATCH, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -883,7 +883,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
|
|||
this->last_packet = std::chrono::steady_clock::now();
|
||||
|
||||
if (!load_success) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_SAVEGAMEERROR, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
return NETWORK_RECV_STATUS_SAVEGAME;
|
||||
}
|
||||
/* If the savegame has successfully loaded, ALL windows have been removed,
|
||||
|
@ -1123,7 +1123,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet
|
|||
/* Only when we're trying to join we really
|
||||
* care about the server shutting down. */
|
||||
if (this->status >= STATUS_JOIN) {
|
||||
ShowErrorMessage(STR_NETWORK_MESSAGE_SERVER_SHUTDOWN, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_MESSAGE_SERVER_SHUTDOWN, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
if (this->status == STATUS_ACTIVE) ClientNetworkEmergencySave();
|
||||
|
@ -1142,7 +1142,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet
|
|||
* Client ID modulo 16 + 1 (value 0 means no reconnect).
|
||||
* This way reconnects should be spread out a bit. */
|
||||
_network_reconnect = _network_own_client_id % 16 + 1;
|
||||
ShowErrorMessage(STR_NETWORK_MESSAGE_SERVER_REBOOT, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NETWORK_MESSAGE_SERVER_REBOOT, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
if (this->status == STATUS_ACTIVE) ClientNetworkEmergencySave();
|
||||
|
@ -1246,8 +1246,8 @@ void ClientNetworkGameSocketHandler::CheckConnection()
|
|||
if (std::chrono::duration_cast<std::chrono::seconds>(last_lag) == std::chrono::duration_cast<std::chrono::seconds>(lag)) return;
|
||||
|
||||
last_lag = lag;
|
||||
SetDParam(0, std::chrono::duration_cast<std::chrono::seconds>(lag).count());
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_CLIENT_GUI_LOST_CONNECTION_CAPTION, STR_NETWORK_ERROR_CLIENT_GUI_LOST_CONNECTION, WL_INFO);
|
||||
auto duration = std::chrono::duration_cast<std::chrono::seconds>(lag).count();
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_CLIENT_GUI_LOST_CONNECTION_CAPTION, STR_NETWORK_ERROR_CLIENT_GUI_LOST_CONNECTION, MakeParameters(duration), WL_INFO);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1339,7 +1339,7 @@ bool NetworkValidateClientName(std::string &client_name)
|
|||
StrTrimInPlace(client_name);
|
||||
if (NetworkIsValidClientName(client_name)) return true;
|
||||
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_BAD_PLAYER_NAME, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_BAD_PLAYER_NAME, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p)
|
|||
size_t toRead = p->RemainingBytesToTransfer();
|
||||
if (toRead != 0 && (size_t)p->TransferOut(TransferOutFWrite, this->curFile) != toRead) {
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, MakeParameters(), WL_ERROR);
|
||||
this->CloseConnection();
|
||||
fclose(this->curFile);
|
||||
this->curFile = nullptr;
|
||||
|
@ -531,7 +531,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
|
|||
if (filename.empty() || (this->curFile = fopen(filename.c_str(), "wb")) == nullptr) {
|
||||
/* Unless that fails of course... */
|
||||
CloseWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ void ClientNetworkContentSocketHandler::AfterDownload()
|
|||
|
||||
this->OnDownloadComplete(this->curInfo->id);
|
||||
} else {
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -954,7 +954,7 @@ public:
|
|||
void OnConnect(bool success) override
|
||||
{
|
||||
if (!success) {
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
this->Close();
|
||||
return;
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type1, ContentT
|
|||
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST);
|
||||
new NetworkContentListWindow(&_network_content_list_desc, cv != nullptr, types);
|
||||
#else
|
||||
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, MakeParameters(), WL_ERROR);
|
||||
/* Connection failed... clean up the mess */
|
||||
if (cv != nullptr) {
|
||||
for (ContentInfo *ci : *cv) delete ci;
|
||||
|
|
|
@ -135,7 +135,7 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *p)
|
|||
return false;
|
||||
|
||||
case NETWORK_COORDINATOR_ERROR_REGISTRATION_FAILED:
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_REGISTRATION_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_REGISTRATION_FAILED, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
|
||||
/* To prevent that we constantly try to reconnect, switch to local game. */
|
||||
_settings_client.network.server_game_type = SERVER_GAME_TYPE_LOCAL;
|
||||
|
@ -159,7 +159,7 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *p)
|
|||
}
|
||||
|
||||
case NETWORK_COORDINATOR_ERROR_REUSE_OF_INVITE_CODE:
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_REUSE_OF_INVITE_CODE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_REUSE_OF_INVITE_CODE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
|
||||
/* To prevent that we constantly battle for the same invite-code, switch to local game. */
|
||||
_settings_client.network.server_game_type = SERVER_GAME_TYPE_LOCAL;
|
||||
|
@ -184,7 +184,7 @@ bool ClientNetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(Packet *p)
|
|||
_network_server_connection_type = (ConnectionType)p->Recv_uint8();
|
||||
|
||||
if (_network_server_connection_type == CONNECTION_TYPE_ISOLATED) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_ISOLATED, STR_NETWORK_ERROR_COORDINATOR_ISOLATED_DETAIL, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_COORDINATOR_ISOLATED, STR_NETWORK_ERROR_COORDINATOR_ISOLATED_DETAIL, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
|
||||
/* Users can change the invite code in the settings, but this has no effect
|
||||
|
|
|
@ -502,10 +502,7 @@ void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
|
|||
|
||||
if (!HasBit(grfconfig->grf_bugs, GBUG_UNKNOWN_CB_RESULT)) {
|
||||
SetBit(grfconfig->grf_bugs, GBUG_UNKNOWN_CB_RESULT);
|
||||
SetDParamStr(0, grfconfig->GetName());
|
||||
SetDParam(1, cbid);
|
||||
SetDParam(2, cb_res);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT, MakeParameters(grfconfig->GetName(), cbid, cb_res), WL_CRITICAL);
|
||||
}
|
||||
|
||||
/* debug output */
|
||||
|
|
|
@ -51,18 +51,21 @@ void ShowNewGRFError()
|
|||
/* Only show Fatal and Error level messages */
|
||||
if (!c->error.has_value() || (c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL && c->error->severity != STR_NEWGRF_ERROR_MSG_ERROR)) continue;
|
||||
|
||||
SetDParamStr(0, c->GetName());
|
||||
SetDParam (1, c->error->message != STR_NULL ? c->error->message : STR_JUST_RAW_STRING);
|
||||
SetDParamStr(2, c->error->custom_message);
|
||||
SetDParamStr(3, c->filename);
|
||||
SetDParamStr(4, c->error->data);
|
||||
ArrayStringParameters<20> params;
|
||||
assert(c->error->param_value.size() < 20 - 5);
|
||||
|
||||
params.SetParam(0, c->GetName());
|
||||
params.SetParam(1, c->error->message != STR_NULL ? c->error->message : STR_JUST_RAW_STRING);
|
||||
params.SetParam(2, c->error->custom_message);
|
||||
params.SetParam(3, c->filename);
|
||||
params.SetParam(4, c->error->data);
|
||||
for (uint i = 0; i < c->error->param_value.size(); i++) {
|
||||
SetDParam(5 + i, c->error->param_value[i]);
|
||||
params.SetParam(5 + i, c->error->param_value[i]);
|
||||
}
|
||||
if (c->error->severity == STR_NEWGRF_ERROR_MSG_FATAL) {
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, std::move(params), WL_CRITICAL);
|
||||
} else {
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_POPUP, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_POPUP, INVALID_STRING_ID, std::move(params), WL_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1153,7 +1156,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||
case WID_NS_CONTENT_DOWNLOAD:
|
||||
case WID_NS_CONTENT_DOWNLOAD2:
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
} else {
|
||||
this->CloseChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
|
||||
|
@ -1533,14 +1536,14 @@ private:
|
|||
for (list = &this->actives; *list != nullptr; list = &(*list)->next, ins_pos--) {
|
||||
if (ins_pos == 0) entry = list; // Insert position? Save.
|
||||
if ((*list)->ident.grfid == this->avail_sel->ident.grfid) {
|
||||
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
return false;
|
||||
}
|
||||
if (!HasBit((*list)->flags, GCF_STATIC)) count++;
|
||||
}
|
||||
if (entry == nullptr) entry = list;
|
||||
if (count >= NETWORK_MAX_GRF_COUNT) {
|
||||
ShowErrorMessage(STR_NEWGRF_TOO_MANY_NEWGRFS, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_NEWGRF_TOO_MANY_NEWGRFS, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -614,9 +614,7 @@ void IndustryProductionCallback(Industry *ind, int reason)
|
|||
* 'loop' is provided as 16 bits to the newgrf, so abort when those are exceeded. */
|
||||
if (loop >= 0x10000) {
|
||||
/* display error message */
|
||||
SetDParamStr(0, spec->grf_prop.grffile->filename);
|
||||
SetDParam(1, spec->name);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, WL_WARNING);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, MakeParameters(spec->grf_prop.grffile->filename, spec->name), WL_WARNING);
|
||||
|
||||
/* abort the function early, this error isn't critical and will allow the game to continue to run */
|
||||
break;
|
||||
|
@ -629,10 +627,12 @@ void IndustryProductionCallback(Industry *ind, int reason)
|
|||
|
||||
if (group->version == 0xFF) {
|
||||
/* Result was marked invalid on load, display error message */
|
||||
SetDParamStr(0, spec->grf_prop.grffile->filename);
|
||||
SetDParam(1, spec->name);
|
||||
SetDParam(2, ind->location.tile);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK, WL_WARNING);
|
||||
auto params = MakeParameters(
|
||||
spec->grf_prop.grffile->filename,
|
||||
spec->name,
|
||||
ind->location.tile
|
||||
);
|
||||
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK, std::move(params), WL_WARNING);
|
||||
|
||||
/* abort the function early, this error isn't critical and will allow the game to continue to run */
|
||||
break;
|
||||
|
|
|
@ -1126,8 +1126,7 @@ void SwitchToMode(SwitchMode new_mode)
|
|||
ResetWindowSystem();
|
||||
|
||||
if (!SafeLoad(_file_to_saveload.name, _file_to_saveload.file_op, _file_to_saveload.detail_ftype, GM_NORMAL, NO_DIRECTORY)) {
|
||||
SetDParamStr(0, GetSaveLoadErrorString());
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(GetSaveLoadErrorString()), WL_CRITICAL);
|
||||
} else {
|
||||
if (_file_to_saveload.abstract_ftype == FT_SCENARIO) {
|
||||
OnStartScenario();
|
||||
|
@ -1169,8 +1168,7 @@ void SwitchToMode(SwitchMode new_mode)
|
|||
/* Cancel the saveload pausing */
|
||||
Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, false);
|
||||
} else {
|
||||
SetDParamStr(0, GetSaveLoadErrorString());
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(GetSaveLoadErrorString()), WL_CRITICAL);
|
||||
}
|
||||
|
||||
UpdateSocialIntegration(GM_EDITOR);
|
||||
|
@ -1187,7 +1185,7 @@ void SwitchToMode(SwitchMode new_mode)
|
|||
case SM_MENU: // Switch to game intro menu
|
||||
LoadIntroGame();
|
||||
if (BaseSounds::ini_set.empty() && BaseSounds::GetUsedSet()->fallback && SoundDriver::GetInstance()->HasOutput()) {
|
||||
ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
BaseSounds::ini_set = BaseSounds::GetUsedSet()->name;
|
||||
}
|
||||
if (_settings_client.network.participate_survey == PS_ASK) {
|
||||
|
@ -1205,8 +1203,7 @@ void SwitchToMode(SwitchMode new_mode)
|
|||
case SM_SAVE_GAME: // Save game.
|
||||
/* Make network saved games on pause compatible to singleplayer mode */
|
||||
if (SaveOrLoad(_file_to_saveload.name, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY) != SL_OK) {
|
||||
SetDParamStr(0, GetSaveLoadErrorString());
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(GetSaveLoadErrorString()), WL_ERROR);
|
||||
} else {
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
}
|
||||
|
|
|
@ -1494,7 +1494,7 @@ public:
|
|||
})) {
|
||||
OnVehicleSelect(*begin);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_COPY_ORDER_LIST, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_COPY_ORDER_LIST, STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
} else {
|
||||
/* If CTRL is pressed: If all the vehicles in this list share orders, then copy orders */
|
||||
|
@ -1503,7 +1503,7 @@ public:
|
|||
})) {
|
||||
OnVehicleSelect(*begin);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_SHARE_ORDER_LIST, STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_SHARE_ORDER_LIST, STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST, MakeParameters(), WL_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -723,8 +723,8 @@ bool AfterLoadGame()
|
|||
}
|
||||
|
||||
switch (gcf_res) {
|
||||
case GLC_COMPATIBLE: ShowErrorMessage(STR_NEWGRF_COMPATIBLE_LOAD_WARNING, INVALID_STRING_ID, WL_CRITICAL); break;
|
||||
case GLC_NOT_FOUND: ShowErrorMessage(STR_NEWGRF_DISABLED_WARNING, INVALID_STRING_ID, WL_CRITICAL); _pause_mode = PM_PAUSED_ERROR; break;
|
||||
case GLC_COMPATIBLE: ShowErrorMessage(STR_NEWGRF_COMPATIBLE_LOAD_WARNING, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL); break;
|
||||
case GLC_NOT_FOUND: ShowErrorMessage(STR_NEWGRF_DISABLED_WARNING, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL); _pause_mode = PM_PAUSED_ERROR; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -1915,7 +1915,7 @@ bool AfterLoadGame()
|
|||
* There would be trams without tram track under causing crashes sooner or later. */
|
||||
for (RoadVehicle *v : RoadVehicle::Iterate()) {
|
||||
if (v->First() == v && HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM)) {
|
||||
ShowErrorMessage(STR_WARNING_LOADGAME_REMOVED_TRAMS, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_WARNING_LOADGAME_REMOVED_TRAMS, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
delete v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2679,8 +2679,7 @@ static const SaveLoadFormat *GetSavegameFormat(const std::string &full_name, byt
|
|||
size_t processed;
|
||||
long level = std::stol(complevel, &processed, 10);
|
||||
if (processed == 0 || level != Clamp(level, slf->min_compression, slf->max_compression)) {
|
||||
SetDParamStr(0, complevel);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL, MakeParameters(complevel), WL_CRITICAL);
|
||||
} else {
|
||||
*compression_level = level;
|
||||
}
|
||||
|
@ -2689,9 +2688,7 @@ static const SaveLoadFormat *GetSavegameFormat(const std::string &full_name, byt
|
|||
}
|
||||
}
|
||||
|
||||
SetDParamStr(0, name);
|
||||
SetDParamStr(1, def->name);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM, MakeParameters(name, def->name), WL_CRITICAL);
|
||||
}
|
||||
*compression_level = def->default_compression;
|
||||
return def;
|
||||
|
@ -2772,8 +2769,7 @@ const char *GetSaveLoadErrorString()
|
|||
/** Show a gui message when saving has failed */
|
||||
static void SaveFileError()
|
||||
{
|
||||
SetDParamStr(0, GetSaveLoadErrorString());
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(GetSaveLoadErrorString()), WL_ERROR);
|
||||
SaveFileDone();
|
||||
}
|
||||
|
||||
|
@ -3052,7 +3048,7 @@ SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop,
|
|||
/* An instance of saving is already active, so don't go saving again */
|
||||
if (_sl.saveinprogress && fop == SLO_SAVE && dft == DFT_GAME_FILE && threaded) {
|
||||
/* if not an autosave, but a user action, show error message */
|
||||
if (!_do_autosave) ShowErrorMessage(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, WL_ERROR);
|
||||
if (!_do_autosave) ShowErrorMessage(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return SL_OK;
|
||||
}
|
||||
WaitTillSaved();
|
||||
|
@ -3150,7 +3146,7 @@ void DoAutoOrNetsave(FiosNumberedSaveName &counter)
|
|||
|
||||
Debug(sl, 2, "Autosaving to '{}'", filename);
|
||||
if (SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR) != SL_OK) {
|
||||
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -952,15 +952,12 @@ static bool RealMakeScreenshot(ScreenshotType t, std::string name, uint32_t widt
|
|||
|
||||
if (ret) {
|
||||
if (t == SC_HEIGHTMAP) {
|
||||
SetDParamStr(0, _screenshot_name);
|
||||
SetDParam(1, _heightmap_highest_peak);
|
||||
ShowErrorMessage(STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY, INVALID_STRING_ID, MakeParameters(_screenshot_name, _heightmap_highest_peak), WL_WARNING);
|
||||
} else {
|
||||
SetDParamStr(0, _screenshot_name);
|
||||
ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, MakeParameters(_screenshot_name), WL_WARNING);
|
||||
}
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1354,7 +1354,7 @@ Window *ShowScriptDebugWindow(CompanyID show_company, bool new_window)
|
|||
}
|
||||
return new ScriptDebugWindow(&_script_debug_desc, i, show_company);
|
||||
} else {
|
||||
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
@ -1015,8 +1015,7 @@ static void GraphicsSetLoadConfig(IniFile &ini)
|
|||
extra_params.resize(lengthof(GRFConfig::param));
|
||||
int count = ParseIntList(item->value->c_str(), &extra_params.front(), extra_params.size());
|
||||
if (count < 0) {
|
||||
SetDParamStr(0, BaseGraphics::ini_data.name);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY, MakeParameters(BaseGraphics::ini_data.name), WL_CRITICAL);
|
||||
count = 0;
|
||||
}
|
||||
extra_params.resize(count);
|
||||
|
@ -1082,8 +1081,7 @@ static GRFConfig *GRFLoadConfig(const IniFile &ini, const char *grpname, bool is
|
|||
if (item.value.has_value() && !item.value->empty()) {
|
||||
int count = ParseIntList(item.value->c_str(), c->param.data(), c->param.size());
|
||||
if (count < 0) {
|
||||
SetDParamStr(0, filename);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_ARRAY, MakeParameters(filename), WL_CRITICAL);
|
||||
count = 0;
|
||||
}
|
||||
c->num_params = count;
|
||||
|
@ -1103,8 +1101,7 @@ static GRFConfig *GRFLoadConfig(const IniFile &ini, const char *grpname, bool is
|
|||
SetDParam(1, STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN);
|
||||
}
|
||||
|
||||
SetDParamStr(0, filename.empty() ? item.name.c_str() : filename);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_GRF, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_GRF, MakeParameters(filename.empty() ? item.name.c_str() : filename), WL_CRITICAL);
|
||||
delete c;
|
||||
continue;
|
||||
}
|
||||
|
@ -1113,9 +1110,7 @@ static GRFConfig *GRFLoadConfig(const IniFile &ini, const char *grpname, bool is
|
|||
bool duplicate = false;
|
||||
for (const GRFConfig *gc = first; gc != nullptr; gc = gc->next) {
|
||||
if (gc->ident.grfid == c->ident.grfid) {
|
||||
SetDParamStr(0, c->filename);
|
||||
SetDParamStr(1, gc->filename);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_DUPLICATE_GRFID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_DUPLICATE_GRFID, MakeParameters(c->filename, gc->filename), WL_CRITICAL);
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1130,7 +1125,7 @@ static GRFConfig *GRFLoadConfig(const IniFile &ini, const char *grpname, bool is
|
|||
SetBit(c->flags, GCF_STATIC);
|
||||
} else if (++num_grfs > NETWORK_MAX_GRF_COUNT) {
|
||||
/* Check we will not load more non-static NewGRFs than allowed. This could trigger issues for game servers. */
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_CONFIG_ERROR, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED, MakeParameters(), WL_CRITICAL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -716,7 +716,7 @@ struct GameOptionsWindow : Window {
|
|||
case WID_GO_FULLSCREEN_BUTTON: // Click fullscreen on/off
|
||||
/* try to toggle full-screen on/off */
|
||||
if (!ToggleFullScreen(!_fullscreen)) {
|
||||
ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
|
||||
this->SetWidgetDirty(WID_GO_FULLSCREEN_BUTTON);
|
||||
|
@ -724,7 +724,7 @@ struct GameOptionsWindow : Window {
|
|||
|
||||
case WID_GO_VIDEO_ACCEL_BUTTON:
|
||||
_video_hw_accel = !_video_hw_accel;
|
||||
ShowErrorMessage(STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel);
|
||||
this->SetWidgetDirty(WID_GO_VIDEO_ACCEL_BUTTON);
|
||||
#ifndef __APPLE__
|
||||
|
@ -867,7 +867,7 @@ struct GameOptionsWindow : Window {
|
|||
if (!list.empty()) {
|
||||
ShowDropDownList(this, std::move(list), selected, widget);
|
||||
} else {
|
||||
if (widget == WID_GO_RESOLUTION_DROPDOWN) ShowErrorMessage(STR_ERROR_RESOLUTION_LIST_FAILED, INVALID_STRING_ID, WL_ERROR);
|
||||
if (widget == WID_GO_RESOLUTION_DROPDOWN) ShowErrorMessage(STR_ERROR_RESOLUTION_LIST_FAILED, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ struct GameOptionsWindow : Window {
|
|||
if (_settings_client.gui.refresh_rate > 60) {
|
||||
/* Show warning to the user that this refresh rate might not be suitable on
|
||||
* larger maps with many NewGRFs and vehicles. */
|
||||
ShowErrorMessage(STR_GAME_OPTIONS_REFRESH_RATE_WARNING, INVALID_STRING_ID, WL_INFO);
|
||||
ShowErrorMessage(STR_GAME_OPTIONS_REFRESH_RATE_WARNING, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ static void MaxNoAIsChange(int32_t)
|
|||
if (GetGameSettings().difficulty.max_no_competitors != 0 &&
|
||||
AI::GetInfoList()->empty() &&
|
||||
(!_networking || _network_server)) {
|
||||
ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS, 0);
|
||||
|
@ -388,39 +388,39 @@ static bool CheckFreeformEdges(int32_t &new_value)
|
|||
for (Ship *s : Ship::Iterate()) {
|
||||
/* Check if there is a ship on the northern border. */
|
||||
if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const BaseStation *st : BaseStation::Iterate()) {
|
||||
/* Check if there is a non-deleted buoy on the northern border. */
|
||||
if (st->IsInUse() && (TileX(st->xy) == 0 || TileY(st->xy) == 0)) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (uint i = 0; i < Map::MaxX(); i++) {
|
||||
if (TileHeight(TileXY(i, 1)) != 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint i = 1; i < Map::MaxX(); i++) {
|
||||
if (!IsTileType(TileXY(i, Map::MaxY() - 1), MP_WATER) || TileHeight(TileXY(1, Map::MaxY())) != 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint i = 0; i < Map::MaxY(); i++) {
|
||||
if (TileHeight(TileXY(1, i)) != 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (uint i = 1; i < Map::MaxY(); i++) {
|
||||
if (!IsTileType(TileXY(Map::MaxX() - 1, i), MP_WATER) || TileHeight(TileXY(Map::MaxX(), i)) != 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ static bool CheckDynamicEngines(int32_t &)
|
|||
if (_game_mode == GM_MENU) return true;
|
||||
|
||||
if (!EngineOverrideManager::ResetToCurrentNewGRFConfig()) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ static bool CheckMaxHeightLevel(int32_t &new_value)
|
|||
* If yes, disallow the change. */
|
||||
for (TileIndex t = 0; t < Map::Size(); t++) {
|
||||
if ((int32_t)TileHeight(t) > new_value) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, MakeParameters(), WL_ERROR);
|
||||
/* Return old, unchanged value */
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ static bool WarnCorruptSprite(const SpriteFile &file, size_t file_pos, int line)
|
|||
{
|
||||
static byte warning_level = 0;
|
||||
if (warning_level == 0) {
|
||||
SetDParamStr(0, file.GetSimplifiedFilename());
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, MakeParameters(file.GetSimplifiedFilename()), WL_ERROR);
|
||||
}
|
||||
Debug(sprite, warning_level, "[{}] Loading corrupted sprite from {} at position {}", line, file.GetSimplifiedFilename(), file_pos);
|
||||
warning_level = 6;
|
||||
|
|
|
@ -2314,8 +2314,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
|||
* with the colour marker. */
|
||||
static std::string err_str("XXXThe current font is missing some of the characters used in the texts for this language. Using system fallback font instead.");
|
||||
Utf8Encode(err_str.data(), SCC_YELLOW);
|
||||
SetDParamStr(0, err_str);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(err_str), WL_WARNING);
|
||||
}
|
||||
|
||||
if (bad_font && base_font) {
|
||||
|
@ -2335,8 +2334,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
|||
* the string, which takes exactly three characters, so it replaces the "XXX" with the colour marker. */
|
||||
static std::string err_str("XXXThe current font is missing some of the characters used in the texts for this language. Read the readme to see how to solve this.");
|
||||
Utf8Encode(err_str.data(), SCC_YELLOW);
|
||||
SetDParamStr(0, err_str);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_WARNING);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(err_str), WL_WARNING);
|
||||
|
||||
/* Reset the font width */
|
||||
LoadStringWidthTable(searcher->Monospace());
|
||||
|
@ -2363,8 +2361,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
|||
if (_current_text_dir != TD_LTR) {
|
||||
static std::string err_str("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with ICU + Harfbuzz enabled.");
|
||||
Utf8Encode(err_str.data(), SCC_YELLOW);
|
||||
SetDParamStr(0, err_str);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
|
||||
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, MakeParameters(err_str), WL_ERROR);
|
||||
}
|
||||
#endif /* !(WITH_ICU_I18N && WITH_HARFBUZZ) && !WITH_UNISCRIBE && !WITH_COCOA */
|
||||
}
|
||||
|
|
|
@ -2338,7 +2338,7 @@ bool GenerateTowns(TownLayout layout)
|
|||
|
||||
/* If there are no towns at all and we are generating new game, bail out */
|
||||
if (Town::GetNumItems() == 0 && _game_mode != GM_EDITOR) {
|
||||
ShowErrorMessage(STR_ERROR_COULD_NOT_CREATE_TOWN, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_ERROR_COULD_NOT_CREATE_TOWN, INVALID_STRING_ID, MakeParameters(), WL_CRITICAL);
|
||||
}
|
||||
|
||||
return false; // we are still without a town? we failed, simply
|
||||
|
@ -3388,7 +3388,7 @@ static CommandCost TownActionBribe(Town *t, DoCommandFlag flags)
|
|||
|
||||
/* only show error message to the executing player. All errors are handled command.c
|
||||
* but this is special, because it can only 'fail' on a DC_EXEC */
|
||||
if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, INVALID_STRING_ID, WL_INFO);
|
||||
if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, INVALID_STRING_ID, MakeParameters(), WL_INFO);
|
||||
|
||||
/* decrease by a lot!
|
||||
* ChangeTownRating is only for stuff in demolishing. Bribe failure should
|
||||
|
|
|
@ -1240,7 +1240,7 @@ public:
|
|||
Backup<bool> old_generating_world(_generating_world, true, FILE_LINE);
|
||||
UpdateNearestTownForRoadTiles(true);
|
||||
if (!GenerateTowns(this->town_layout)) {
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, WL_INFO);
|
||||
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, MakeParameters(), WL_INFO);
|
||||
}
|
||||
UpdateNearestTownForRoadTiles(false);
|
||||
old_generating_world.Restore();
|
||||
|
|
|
@ -85,9 +85,7 @@ void CheckTrainsLengths()
|
|||
if ((w->track != TRACK_BIT_DEPOT &&
|
||||
std::max(abs(u->x_pos - w->x_pos), abs(u->y_pos - w->y_pos)) != u->CalcNextVehicleOffset()) ||
|
||||
(w->track == TRACK_BIT_DEPOT && TicksToLeaveDepot(u) <= 0)) {
|
||||
SetDParam(0, v->index);
|
||||
SetDParam(1, v->owner);
|
||||
ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, WL_CRITICAL);
|
||||
ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, MakeParameters(v->index, v->owner), WL_CRITICAL);
|
||||
|
||||
if (!_networking && first) {
|
||||
first = false;
|
||||
|
|
|
@ -324,9 +324,7 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
|
|||
|
||||
if (!HasBit(grfconfig->grf_bugs, bug_type)) {
|
||||
SetBit(grfconfig->grf_bugs, bug_type);
|
||||
SetDParamStr(0, grfconfig->GetName());
|
||||
SetDParam(1, engine);
|
||||
ShowErrorMessage(part1, part2, WL_CRITICAL);
|
||||
ShowErrorMessage(part1, part2, MakeParameters(grfconfig->GetName(), engine), WL_CRITICAL);
|
||||
if (!_networking) Command<CMD_PAUSE>::Do(DC_EXEC, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue