(svn r17928) -Codechange: ShowErrorMessage() now takes the summary string before the details string.

Gentlemen, swap your string parameters.
This commit is contained in:
alberth 2009-10-31 19:46:51 +00:00
parent 4ce1f5f0a0
commit 44aacfc59f
24 changed files with 75 additions and 75 deletions

View File

@ -178,7 +178,7 @@ struct AIListWindow : public Window {
case AIL_WIDGET_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERROR_NOTAVAILABLE, 0, 0);
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
} else {
#if defined(ENABLE_NETWORK)
ShowNetworkContentListWindow(NULL, CONTENT_TYPE_AI);
@ -365,7 +365,7 @@ struct AISettingsWindow : public Window {
if (_settings_newgame.difficulty.diff_level != 3) {
_settings_newgame.difficulty.diff_level = 3;
ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0);
ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
}
} else if (!bool_item) {
/* Display a query box so users can enter a custom value. */
@ -962,6 +962,6 @@ void ShowAIDebugWindow(CompanyID show_company)
if (w == NULL) w = new AIDebugWindow(&_ai_debug_desc, 0);
if (show_company != INVALID_COMPANY) w->ChangeToAI(show_company);
} else {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_AI_DEBUG_SERVER_ONLY, 0, 0);
ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, 0, 0);
}
}

View File

@ -304,7 +304,7 @@ void AIInstance::Died()
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
if (info != NULL) {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_AI_PLEASE_REPORT_CRASH, 0, 0);
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, 0, 0);
if (info->GetURL() != NULL) {
AILog::Info("Please report the error to the following URL:");

View File

@ -416,6 +416,6 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
new BuildBridgeWindow(&_build_bridge_desc, start, end, type, bl);
} else {
delete bl;
ShowErrorMessage(errmsg, STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
}
}

View File

@ -535,7 +535,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
* The server will ditch any server commands a client sends to it, so effectively
* this guards the server from executing functions for an invalid company. */
if (_game_mode == GM_NORMAL && (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) == 0 && !Company::IsValidID(_current_company)) {
if (my_cmd) ShowErrorMessage(_error_message, error_part1, x, y);
if (my_cmd) ShowErrorMessage(error_part1, _error_message, x, y);
return false;
}
@ -555,7 +555,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
SetTownRatingTestMode(false);
if (CmdFailed(res)) {
res.SetGlobalErrorMessage();
ShowErrorMessage(_error_message, error_part1, x, y);
ShowErrorMessage(error_part1, _error_message, x, y);
} else {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
}
@ -626,7 +626,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
if (res2.GetCost() != 0 && tile != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2.GetCost());
if (_additional_cash_required != 0) {
SetDParam(0, _additional_cash_required);
if (my_cmd) ShowErrorMessage(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY, error_part1, x, y);
if (my_cmd) ShowErrorMessage(error_part1, STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY, x, y);
if (res2.GetCost() == 0) goto callb_err;
}
}
@ -640,7 +640,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
show_error:
/* show error message if the command fails? */
if (IsLocalCompany() && error_part1 != 0 && my_cmd) {
ShowErrorMessage(_error_message, error_part1, x, y);
ShowErrorMessage(error_part1, _error_message, x, y);
}
callb_err:

View File

@ -1282,7 +1282,7 @@ public:
case SCMFW_WIDGET_LOAD:
this->face = _company_manager_face;
ScaleAllCompanyManagerFaceBits(this->face);
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0);
ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, 0, 0);
this->UpdateData();
this->SetDirty();
break;
@ -1296,7 +1296,7 @@ public:
/* Save button */
case SCMFW_WIDGET_SAVE:
_company_manager_face = this->face;
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_SAVE_DONE, 0, 0);
ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, 0, 0);
break;
/* Toggle gender (male/female) button */
@ -1372,11 +1372,11 @@ public:
if (!StrEmpty(str)) {
this->face = strtoul(str, NULL, 10);
ScaleAllCompanyManagerFaceBits(this->face);
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0);
ShowErrorMessage(STR_FACE_FACECODE_SET, INVALID_STRING_ID, 0, 0);
this->UpdateData();
this->SetDirty();
} else {
ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0);
ShowErrorMessage(STR_FACE_FACECODE_ERR, INVALID_STRING_ID, 0, 0);
}
}
};

View File

@ -65,7 +65,7 @@ void ShowIndustryDirectory();
void ShowSubsidiesList();
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
void ShowErrorMessage(StringID detailed_msg, StringID summary_msg, int x, int y, bool no_timeout = false);
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, int x, int y, bool no_timeout = false);
void ShowSmallMap();
void ShowExtraViewPortWindow(TileIndex tile = INVALID_TILE);

View File

@ -107,20 +107,20 @@ static bool ReadHeightmapPNG(char *filename, uint *x, uint *y, byte **map)
fp = FioFOpenFile(filename, "rb");
if (fp == NULL) {
ShowErrorMessage(STR_ERROR_PNGMAP_FILE_NOT_FOUND, STR_ERROR_PNGMAP, 0, 0);
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, 0, 0);
return false;
}
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL) {
ShowErrorMessage(STR_ERROR_PNGMAP_MISC, STR_ERROR_PNGMAP, 0, 0);
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, 0, 0);
fclose(fp);
return false;
}
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL || setjmp(png_jmpbuf(png_ptr))) {
ShowErrorMessage(STR_ERROR_PNGMAP_MISC, STR_ERROR_PNGMAP, 0, 0);
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, 0, 0);
fclose(fp);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return false;
@ -136,7 +136,7 @@ static bool ReadHeightmapPNG(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 ((info_ptr->channels != 1) && (info_ptr->channels != 3) && (info_ptr->bit_depth != 8)) {
ShowErrorMessage(STR_ERROR_PNGMAP_IMAGE_TYPE, STR_ERROR_PNGMAP, 0, 0);
ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_IMAGE_TYPE, 0, 0);
fclose(fp);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return false;
@ -230,14 +230,14 @@ static bool ReadHeightmapBMP(char *filename, uint *x, uint *y, byte **map)
f = FioFOpenFile(filename, "rb");
if (f == NULL) {
ShowErrorMessage(STR_ERROR_PNGMAP_FILE_NOT_FOUND, STR_ERROR_BMPMAP, 0, 0);
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, 0, 0);
return false;
}
BmpInitializeBuffer(&buffer, f);
if (!BmpReadHeader(&buffer, &info, &data)) {
ShowErrorMessage(STR_ERROR_BMPMAP_IMAGE_TYPE, STR_ERROR_BMPMAP, 0, 0);
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, 0, 0);
fclose(f);
BmpDestroyData(&data);
return false;
@ -245,7 +245,7 @@ static bool ReadHeightmapBMP(char *filename, uint *x, uint *y, byte **map)
if (map != NULL) {
if (!BmpReadBitmap(&buffer, &info, &data)) {
ShowErrorMessage(STR_ERROR_BMPMAP_IMAGE_TYPE, STR_ERROR_BMPMAP, 0, 0);
ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, 0, 0);
fclose(f);
BmpDestroyData(&data);
return false;

View File

@ -427,7 +427,7 @@ public:
this->HandleButtonClick(DPIW_FUND_WIDGET);
if (Town::GetNumItems() == 0) {
ShowErrorMessage(STR_ERROR_MUST_FOUND_TOWN_FIRST, STR_ERROR_CAN_T_GENERATE_INDUSTRIES, 0, 0);
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, 0, 0);
} else {
extern void GenerateIndustries();
_generating_world = true;
@ -462,7 +462,7 @@ public:
/* Show error if no town exists at all */
if (Town::GetNumItems() == 0) {
SetDParam(0, indsp->name);
ShowErrorMessage(STR_ERROR_MUST_FOUND_TOWN_FIRST, STR_ERROR_CAN_T_BUILD_HERE, pt.x, pt.y);
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, STR_ERROR_MUST_FOUND_TOWN_FIRST, pt.x, pt.y);
return;
}
@ -472,7 +472,7 @@ public:
success = DoCommandP(tile, (InteractiveRandomRange(indsp->num_table) << 8) | this->selected_type, seed, CMD_BUILD_INDUSTRY | CMD_MSG(STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY));
if (!success) {
SetDParam(0, indsp->name);
ShowErrorMessage(_error_message, STR_ERROR_CAN_T_BUILD_HERE, pt.x, pt.y);
ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, _error_message, pt.x, pt.y);
}
_ignore_restrictions = false;

View File

@ -122,7 +122,7 @@ struct SelectGameWindow : public Window {
case SGI_PLAY_NETWORK:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERROR_NOTAVAILABLE, 0, 0);
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
} else {
ShowNetworkGameWindow();
}
@ -141,7 +141,7 @@ struct SelectGameWindow : public Window {
case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case SGI_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERROR_NOTAVAILABLE, 0, 0);
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
} else {
ShowNetworkContentListWindow();
}

View File

@ -556,22 +556,22 @@ struct ErrmsgWindow : public Window {
private:
uint duration; ///< Length of display of the message. 0 means forever,
uint64 decode_params[20]; ///< Parameters of the message strings.
StringID detailed_msg; ///< Detailed error message showed in second line. Can be #INVALID_STRING_ID.
StringID summary_msg; ///< General error message showed in first line. Must be valid.
StringID detailed_msg; ///< Detailed error message showed in second line. Can be #INVALID_STRING_ID.
bool show_company_manager_face; ///< Display the face of the manager in the window.
Rect area_detailed; ///< Area available for #detailed_msg in the #EMW_MESSAGE widget.
Rect area_summary; ///< Area available for #summary_msg in the #EMW_MESSAGE widget.
Rect area_detailed; ///< Area available for #detailed_msg in the #EMW_MESSAGE widget.
public:
ErrmsgWindow(Point pt, int width, int height, StringID detailed_msg, StringID summary_msg, const Widget *widget, bool show_company_manager_face, bool no_timeout) :
ErrmsgWindow(Point pt, int width, int height, StringID summary_msg, StringID detailed_msg, const Widget *widget, bool show_company_manager_face, bool no_timeout) :
Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
show_company_manager_face(show_company_manager_face)
{
this->duration = no_timeout ? 0 : _settings_client.gui.errmsg_duration;
CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
this->detailed_msg = detailed_msg;
this->summary_msg = summary_msg;
this->detailed_msg = detailed_msg;
this->desc_flags = WDF_STD_BTN | WDF_DEF_WIDGET;
SwitchToErrorRefStack();
@ -596,10 +596,10 @@ public:
this->area_summary.bottom = height - WD_FRAMERECT_BOTTOM;
} else {
int over = (height - h) / 2;
this->area_detailed.bottom = height - WD_FRAMERECT_BOTTOM;
this->area_detailed.top = this->area_detailed.bottom - height_detailed - over;
this->area_summary.top = this->widget[EMW_MESSAGE].top + WD_FRAMERECT_TOP;
this->area_summary.bottom = this->area_summary.top + height_summary + over;
this->area_detailed.bottom = height - WD_FRAMERECT_BOTTOM;
this->area_detailed.top = this->area_detailed.bottom - height_detailed - over;
}
this->FindWindowPlacementAndResize(width, height);
@ -663,13 +663,13 @@ public:
/**
* Display an error message in a window.
* @param detailed_msg Detailed error message showed in second line. Can be INVALID_STRING_ID.
* @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 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.
* @param no_timeout Set to true, if the message is that important that it should not close automatically after some time.
*/
void ShowErrorMessage(StringID detailed_msg, StringID summary_msg, int x, int y, bool no_timeout)
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, int x, int y, bool no_timeout)
{
static Widget *generated_errmsg_widgets = NULL;
static Widget *generated_errmsg_face_widgets = NULL;
@ -703,7 +703,7 @@ void ShowErrorMessage(StringID detailed_msg, StringID summary_msg, int x, int y,
const Widget *wid = InitializeWidgetArrayFromNestedWidgets(_nested_errmsg_widgets, lengthof(_nested_errmsg_widgets),
_errmsg_widgets, &generated_errmsg_widgets);
new ErrmsgWindow(pt, 240, 46, detailed_msg, summary_msg, wid, false, no_timeout);
new ErrmsgWindow(pt, 240, 46, summary_msg, detailed_msg, wid, false, no_timeout);
} else {
if ((x | y) != 0) {
pt = RemapCoords2(x, y);
@ -717,7 +717,7 @@ void ShowErrorMessage(StringID detailed_msg, StringID summary_msg, int x, int y,
const Widget *wid = InitializeWidgetArrayFromNestedWidgets(_nested_errmsg_face_widgets, lengthof(_nested_errmsg_face_widgets),
_errmsg_face_widgets, &generated_errmsg_face_widgets);
new ErrmsgWindow(pt, 334, 137, detailed_msg, summary_msg, wid, true, no_timeout);
new ErrmsgWindow(pt, 334, 137, summary_msg, detailed_msg, wid, true, no_timeout);
}
}
@ -730,7 +730,7 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y)
msg = STR_MESSAGE_ESTIMATED_INCOME;
}
SetDParam(0, cost);
ShowErrorMessage(INVALID_STRING_ID, msg, x, y);
ShowErrorMessage(msg, INVALID_STRING_ID, x, y);
}
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
@ -1990,7 +1990,7 @@ public:
case SLWW_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERROR_NOTAVAILABLE, 0, 0);
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
} else {
#if defined(ENABLE_NETWORK)
switch (_saveload_mode) {
@ -2038,7 +2038,7 @@ public:
if (this->IsWidgetLowered(SLWW_DELETE_SELECTION)) { // Delete button clicked
if (!FiosDelete(this->text.buf)) {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_UNABLE_TO_DELETE_FILE, 0, 0);
ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, 0, 0);
} else {
BuildFileList();
/* Reset file name to current date on successful delete */

View File

@ -382,7 +382,7 @@ DEF_CONTENT_RECEIVE_COMMAND(Client, PACKET_CONTENT_SERVER_CONTENT)
if (filename == NULL) {
/* Unless that fails ofcourse... */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, 0, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, 0, 0);
this->Close();
return false;
}
@ -394,7 +394,7 @@ DEF_CONTENT_RECEIVE_COMMAND(Client, PACKET_CONTENT_SERVER_CONTENT)
size_t toRead = (size_t)(p->size - p->pos);
if (fwrite(p->buffer + p->pos, 1, toRead, this->curFile) != toRead) {
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, 0, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, 0, 0);
this->Close();
fclose(this->curFile);
this->curFile = NULL;
@ -417,7 +417,7 @@ DEF_CONTENT_RECEIVE_COMMAND(Client, PACKET_CONTENT_SERVER_CONTENT)
this->OnDownloadComplete(this->curInfo->id);
} else {
ShowErrorMessage(INVALID_STRING_ID, STR_CONTENT_ERROR_COULD_NOT_EXTRACT, 0, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, 0, 0);
}
}
}

View File

@ -755,7 +755,7 @@ public:
virtual void OnConnect(bool success)
{
if (!success) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONTENT_ERROR_COULD_NOT_CONNECT, 0, 0);
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, 0, 0);
delete this;
}
@ -895,7 +895,7 @@ void ShowNetworkContentListWindow(ContentVector *cv, ContentType type)
DeleteWindowById(WC_NETWORK_WINDOW, 1);
new NetworkContentListWindow(&_network_content_list_desc, cv != NULL);
#else
ShowErrorMessage(STR_CONTENT_NO_ZLIB_SUB, STR_CONTENT_NO_ZLIB, 0, 0);
ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, 0, 0);
/* Connection failed... clean up the mess */
if (cv != NULL) {
for (ContentIterator iter = cv->Begin(); iter != cv->End(); iter++) delete *iter;

View File

@ -353,7 +353,7 @@ public:
/* Find last entry in the list, checking for duplicate grfid on the way */
for (list = this->list; *list != NULL; list = &(*list)->next) {
if ((*list)->grfid == src->grfid) {
ShowErrorMessage(INVALID_STRING_ID, STR_NEWGRF_DUPLICATE_GRFID, 0, 0);
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, 0, 0);
return;
}
}
@ -835,7 +835,7 @@ struct NewGRFWindow : public Window {
case SNGRFS_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERROR_NOTAVAILABLE, 0, 0);
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
} else {
#if defined(ENABLE_NETWORK)
/* Only show the things in the current list, or everything when nothing's selected */

View File

@ -529,7 +529,7 @@ void IndustryProductionCallback(Industry *ind, int reason)
/* display error message */
SetDParamStr(0, spec->grf_prop.grffile->filename);
SetDParam(1, spec->name);
ShowErrorMessage(STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, STR_NEWGRF_BUGGY, 0, 0);
ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, 0, 0);
/* abort the function early, this error isn't critical and will allow the game to continue to run */
break;

View File

@ -777,9 +777,9 @@ static void ShowScreenshotResult(bool b)
if (b) {
extern char _screenshot_name[];
SetDParamStr(0, _screenshot_name);
ShowErrorMessage(INVALID_STRING_ID, STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, 0, 0);
ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, 0, 0);
} else {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_SCREENSHOT_FAILED, 0, 0);
ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, 0, 0);
}
}
@ -866,7 +866,7 @@ static void StartScenario()
if (_file_to_saveload.mode == SL_INVALID) {
DEBUG(sl, 0, "Savegame is obsolete or invalid format: '%s'", _file_to_saveload.name);
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
_game_mode = GM_MENU;
return;
}
@ -882,7 +882,7 @@ static void StartScenario()
if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, SCENARIO_DIR) != SL_OK) {
LoadIntroGame();
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
}
_settings_game.difficulty = _settings_newgame.difficulty;
@ -998,7 +998,7 @@ void SwitchToMode(SwitchMode new_mode)
if (!SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL, NO_DIRECTORY)) {
LoadIntroGame();
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
} else {
if (_saveload_mode == SLD_LOAD_SCENARIO) {
StartupEngines();
@ -1041,7 +1041,7 @@ void SwitchToMode(SwitchMode new_mode)
_settings_newgame.game_creation.starting_year = _cur_year;
} else {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
}
break;
}
@ -1054,7 +1054,7 @@ void SwitchToMode(SwitchMode new_mode)
/* Make network saved games on pause compatible to singleplayer */
if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
} else {
DeleteWindowById(WC_SAVELOAD, 0);
}
@ -1071,7 +1071,7 @@ void SwitchToMode(SwitchMode new_mode)
}
if (_switch_mode_errorstr != INVALID_STRING_ID) {
ShowErrorMessage(INVALID_STRING_ID, _switch_mode_errorstr, 0, 0, true);
ShowErrorMessage(_switch_mode_errorstr, INVALID_STRING_ID, 0, 0, true);
}
}
@ -1219,7 +1219,7 @@ static void DoAutosave()
DEBUG(sl, 2, "Autosaving to '%s'", buf);
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK) {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_AUTOSAVE_FAILED, 0, 0);
ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, 0, 0);
}
}

View File

@ -1697,7 +1697,7 @@ const char *GetSaveLoadErrorString()
static void SaveFileError()
{
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, STR_NULL, 0, 0);
ShowErrorMessage(STR_NULL, STR_JUST_RAW_STRING, 0, 0);
SaveFileDone();
}
@ -1791,7 +1791,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
/* An instance of saving is already active, so don't go saving again */
if (_ts.saveinprogress && mode == SL_SAVE) {
/* if not an autosave, but a user action, show error message */
if (!_do_autosave) ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_SAVE_STILL_IN_PROGRESS, 0, 0);
if (!_do_autosave) ShowErrorMessage(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, 0, 0);
return SL_OK;
}
WaitTillSaved();

View File

@ -813,7 +813,7 @@ static bool DifficultyChange(int32)
{
if (_game_mode == GM_MENU) {
if (_settings_newgame.difficulty.diff_level != 3) {
ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0);
ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
_settings_newgame.difficulty.diff_level = 3;
}
SetWindowClassesDirty(WC_SELECT_GAME);
@ -888,14 +888,14 @@ static bool CheckFreeformEdges(int32 p1)
Ship *s;
FOR_ALL_SHIPS(s) {
if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_EMPTY, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, 0, 0);
return false;
}
}
Station *st;
FOR_ALL_STATIONS(st) {
if (TileX(st->xy) == 0 || TileY(st->xy) == 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_EMPTY, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, 0, 0);
return false;
}
}
@ -904,25 +904,25 @@ static bool CheckFreeformEdges(int32 p1)
} else {
for (uint i = 0; i < MapMaxX(); i++) {
if (TileHeight(TileXY(i, 1)) != 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_WATER, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
return false;
}
}
for (uint i = 1; i < MapMaxX(); i++) {
if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_WATER, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
return false;
}
}
for (uint i = 0; i < MapMaxY(); i++) {
if (TileHeight(TileXY(1, i)) != 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_WATER, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
return false;
}
}
for (uint i = 1; i < MapMaxY(); i++) {
if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_EDGES_NOT_WATER, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
return false;
}
}
@ -951,7 +951,7 @@ static bool ChangeDynamicEngines(int32 p1)
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (IsCompanyBuildableVehicleType(v)) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, 0, 0);
ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, 0, 0);
return false;
}
}

View File

@ -315,7 +315,7 @@ struct GameOptionsWindow : Window {
case GOW_FULLSCREEN_BUTTON: // Click fullscreen on/off
/* try to toggle full-screen on/off */
if (!ToggleFullScreen(!_fullscreen)) {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_FULLSCREEN_FAILED, 0, 0);
ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, 0, 0);
}
this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen);
this->SetDirty();

View File

@ -31,7 +31,7 @@ static bool WarnCorruptSprite(uint8 file_slot, size_t file_pos, int line)
static byte warning_level = 0;
if (warning_level == 0) {
SetDParamStr(0, FioGetFilename(file_slot));
ShowErrorMessage(INVALID_STRING_ID, STR_NEWGRF_ERROR_CORRUPT_SPRITE, 0, 0);
ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, 0, 0);
}
DEBUG(sprite, warning_level, "[%i] Loading corrupted sprite from %s at position %i", line, FioGetFilename(file_slot), (int)file_pos);
warning_level = 6;

View File

@ -1577,7 +1577,7 @@ void CheckForMissingGlyphsInLoadedLanguagePack()
static char *err_str = strdup("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, SCC_YELLOW);
SetDParamStr(0, err_str);
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
/* Reset the font width */
LoadStringWidthTable();
@ -1610,7 +1610,7 @@ void CheckForMissingGlyphsInLoadedLanguagePack()
static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
Utf8Encode(err_str, SCC_YELLOW);
SetDParamStr(0, err_str);
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
}
#endif
}

View File

@ -2291,7 +2291,7 @@ void ExpandTown(Town *t)
* but do this only onces per openttd run. */
static bool warned_no_roads = false;
if (!_settings_game.economy.allow_town_roads && !warned_no_roads) {
ShowErrorMessage(INVALID_STRING_ID, STR_ERROR_TOWN_EXPAND_WARN_NO_ROADS, 0, 0);
ShowErrorMessage(STR_ERROR_TOWN_EXPAND_WARN_NO_ROADS, INVALID_STRING_ID, 0, 0);
warned_no_roads = true;
}
@ -2435,7 +2435,7 @@ static void TownActionBribe(Town *t)
/* only show errormessage 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_2, STR_ERROR_BRIBE_FAILED, 0, 0);
if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, STR_ERROR_BRIBE_FAILED_2, 0, 0);
/* decrease by a lot!
* ChangeTownRating is only for stuff in demolishing. Bribe failure should

View File

@ -1046,7 +1046,7 @@ public:
_generating_world = true;
UpdateNearestTownForRoadTiles(true);
if (!GenerateTowns(this->town_layout)) {
ShowErrorMessage(STR_ERROR_NO_SPACE_FOR_TOWN, STR_ERROR_CAN_T_GENERATE_TOWN, 0, 0);
ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, 0, 0);
}
UpdateNearestTownForRoadTiles(false);
_generating_world = false;

View File

@ -198,7 +198,7 @@ void CheckTrainsLengths()
(w->track == TRACK_BIT_DEPOT && TicksToLeaveDepot(u) <= 0)) {
SetDParam(0, v->index);
SetDParam(1, v->owner);
ShowErrorMessage(INVALID_STRING_ID, STR_BROKEN_VEHICLE_LENGTH, 0, 0, true);
ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, 0, 0, true);
if (!_networking) DoCommandP(0, PM_PAUSED_ERROR, 1, CMD_PAUSE);
}

View File

@ -130,7 +130,7 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
SetBit(grfconfig->grf_bugs, bug_type);
SetDParamStr(0, grfconfig->name);
SetDParam(1, engine);
ShowErrorMessage(part2, part1, 0, 0, true);
ShowErrorMessage(part1, part2, 0, 0, true);
if (!_networking) DoCommand(0, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, 1, DC_EXEC, CMD_PAUSE);
}