summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-02-24 14:46:15 +0000
committersmatz <smatz@openttd.org>2010-02-24 14:46:15 +0000
commitf051066bc451479a0c2ff44e2554941628a62f6a (patch)
tree239197109c12b15a24e9ae8ab70a7549e34d4a8b
parentc1e2bc90cd3751dfa316519cfe2f558aa2697b2c (diff)
downloadopenttd-f051066bc451479a0c2ff44e2554941628a62f6a.tar.xz
(svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit
-rw-r--r--src/ai/ai_gui.cpp6
-rw-r--r--src/ai/ai_gui.hpp2
-rw-r--r--src/ai/ai_instance.cpp2
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/command.cpp2
-rw-r--r--src/company_gui.cpp8
-rw-r--r--src/gui.h11
-rw-r--r--src/heightmap.cpp14
-rw-r--r--src/industry_gui.cpp6
-rw-r--r--src/intro_gui.cpp4
-rw-r--r--src/misc_gui.cpp13
-rw-r--r--src/music_gui.cpp2
-rw-r--r--src/network/network_content.cpp6
-rw-r--r--src/network/network_content_gui.cpp4
-rw-r--r--src/newgrf_gui.cpp6
-rw-r--r--src/newgrf_industries.cpp2
-rw-r--r--src/openttd.cpp16
-rw-r--r--src/saveload/saveload.cpp4
-rw-r--r--src/screenshot.cpp4
-rw-r--r--src/settings.cpp18
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/spriteloader/grf.cpp2
-rw-r--r--src/strings.cpp4
-rw-r--r--src/town_cmd.cpp4
-rw-r--r--src/town_gui.cpp4
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle.cpp2
27 files changed, 83 insertions, 71 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 33286f500..beeed22bc 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -314,7 +314,7 @@ struct AISettingsWindow : public Window {
if (_game_mode == GM_MENU) {
if (_settings_newgame.difficulty.diff_level != 3) {
_settings_newgame.difficulty.diff_level = 3;
- ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, WL_WARNING);
}
} else if (_settings_game.difficulty.diff_level != 3) {
IConsoleSetSetting("difficulty.diff_level", 3);
@@ -632,7 +632,7 @@ struct AIConfigWindow : public Window {
case AIC_WIDGET_CONTENT_DOWNLOAD:
if (!_network_available) {
- ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
#if defined(ENABLE_NETWORK)
ShowNetworkContentListWindow(NULL, CONTENT_TYPE_AI);
@@ -1013,6 +1013,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(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_AI_DEBUG_SERVER_ONLY, INVALID_STRING_ID, WL_INFO);
}
}
diff --git a/src/ai/ai_gui.hpp b/src/ai/ai_gui.hpp
index 254e2955c..e76681636 100644
--- a/src/ai/ai_gui.hpp
+++ b/src/ai/ai_gui.hpp
@@ -22,7 +22,7 @@ void ShowAIConfigWindow();
static inline void ShowAIConfigWindow()
{
- ShowErrorMessage(STR_ERROR_NO_AI, STR_ERROR_NO_AI_SUB, 0, 0);
+ ShowErrorMessage(STR_ERROR_NO_AI, STR_ERROR_NO_AI_SUB, WL_INFO);
}
static inline void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY) {ShowAIConfigWindow();}
#endif /* ENABLE_AI */
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index 95250fd6c..41ec1c85e 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -297,7 +297,7 @@ void AIInstance::Died()
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
if (info != NULL) {
- ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
if (info->GetURL() != NULL) {
AILog::Info("Please report the error to the following URL:");
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 98d47c492..cccfbedde 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -412,6 +412,6 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
new BuildBridgeWindow(&_build_bridge_desc, start, end, type, bl);
} else {
delete bl;
- ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
+ ShowErrorMessage(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, errmsg, WL_INFO, TileX(end) * TILE_SIZE, TileY(end) * TILE_SIZE);
}
}
diff --git a/src/command.cpp b/src/command.cpp
index 430f9d2eb..eb992a2d2 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -511,7 +511,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16);
if (estimate_only || (IsLocalCompany() && error_part1 != 0 && my_cmd)) {
- ShowErrorMessage(error_part1, _error_message, x, y);
+ ShowErrorMessage(error_part1, _error_message, WL_INFO, x, y);
}
} else if (estimate_only) {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index ce9242c2b..c4e7b5e51 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -1418,7 +1418,7 @@ public:
case SCMFW_WIDGET_LOAD:
this->face = _company_manager_face;
ScaleAllCompanyManagerFaceBits(this->face);
- ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, WL_INFO);
this->UpdateData();
this->SetDirty();
break;
@@ -1432,7 +1432,7 @@ public:
/* Save button */
case SCMFW_WIDGET_SAVE:
_company_manager_face = this->face;
- ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, WL_INFO);
break;
/* Toggle gender (male/female) button */
@@ -1509,11 +1509,11 @@ public:
if (!StrEmpty(str)) {
this->face = strtoul(str, NULL, 10);
ScaleAllCompanyManagerFaceBits(this->face);
- ShowErrorMessage(STR_FACE_FACECODE_SET, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_FACE_FACECODE_SET, INVALID_STRING_ID, WL_INFO);
this->UpdateData();
this->SetDirty();
} else {
- ShowErrorMessage(STR_FACE_FACECODE_ERR, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_FACE_FACECODE_ERR, INVALID_STRING_ID, WL_INFO);
}
}
};
diff --git a/src/gui.h b/src/gui.h
index 11e501f3d..f6a0e14df 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -52,7 +52,16 @@ void ShowIndustryDirectory();
void ShowSubsidiesList();
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
-void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, int x, int y, bool no_timeout = false);
+
+/** Message severity/type */
+enum WarningLevel {
+ WL_INFO, ///< Used for DoCommand-like (and some nonfatal AI GUI) errors/information
+ WL_WARNING, ///< Other information
+ WL_ERROR, ///< Errors (eg. saving/loading failed)
+ WL_CRITICAL, ///< Critical errors, the MessageBox is shown in all cases
+};
+
+void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0);
void ShowExtraViewPortWindow(TileIndex tile = INVALID_TILE);
diff --git a/src/heightmap.cpp b/src/heightmap.cpp
index 68a1ecffb..9b72a873f 100644
--- a/src/heightmap.cpp
+++ b/src/heightmap.cpp
@@ -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, STR_ERROR_PNGMAP_FILE_NOT_FOUND, 0, 0);
+ ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR);
return false;
}
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL) {
- ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, 0, 0);
+ ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, WL_ERROR);
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, STR_ERROR_PNGMAP_MISC, 0, 0);
+ ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_MISC, WL_ERROR);
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 ((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, 0, 0);
+ ShowErrorMessage(STR_ERROR_PNGMAP, STR_ERROR_PNGMAP_IMAGE_TYPE, WL_ERROR);
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_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, 0, 0);
+ ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_PNGMAP_FILE_NOT_FOUND, WL_ERROR);
return false;
}
BmpInitializeBuffer(&buffer, f);
if (!BmpReadHeader(&buffer, &info, &data)) {
- ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, 0, 0);
+ ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, WL_ERROR);
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, STR_ERROR_BMPMAP_IMAGE_TYPE, 0, 0);
+ ShowErrorMessage(STR_ERROR_BMPMAP, STR_ERROR_BMPMAP_IMAGE_TYPE, WL_ERROR);
fclose(f);
BmpDestroyData(&data);
return false;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 56ceeb81b..0380ebb20 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -423,7 +423,7 @@ public:
this->HandleButtonClick(DPIW_FUND_WIDGET);
if (Town::GetNumItems() == 0) {
- ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, 0, 0);
+ ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_INDUSTRIES, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO);
} else {
extern void GenerateIndustries();
_generating_world = true;
@@ -458,7 +458,7 @@ public:
/* 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, pt.x, pt.y);
+ ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, STR_ERROR_MUST_FOUND_TOWN_FIRST, WL_INFO, pt.x, pt.y);
return;
}
@@ -468,7 +468,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(STR_ERROR_CAN_T_BUILD_HERE, _error_message, pt.x, pt.y);
+ ShowErrorMessage(STR_ERROR_CAN_T_BUILD_HERE, _error_message, WL_INFO, pt.x, pt.y);
}
_ignore_restrictions = false;
diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp
index f65d68f9f..5cb4a3890 100644
--- a/src/intro_gui.cpp
+++ b/src/intro_gui.cpp
@@ -121,7 +121,7 @@ struct SelectGameWindow : public Window {
case SGI_PLAY_NETWORK:
if (!_network_available) {
- ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
ShowNetworkGameWindow();
}
@@ -140,7 +140,7 @@ struct SelectGameWindow : public Window {
case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case SGI_CONTENT_DOWNLOAD:
if (!_network_available) {
- ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
ShowNetworkContentListWindow();
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index c456394f6..0e9a75162 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -33,6 +33,7 @@
#include "window_func.h"
#include "tilehighlight_func.h"
#include "querystring_gui.h"
+#include "console_func.h"
#include "core/geometry_func.hpp"
#include "table/strings.h"
@@ -690,14 +691,16 @@ public:
* 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 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.
- * @param no_timeout Set to true, if the message is that important that it should not close automatically after some time.
*/
-void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, int x, int y, bool no_timeout)
+void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y)
{
DeleteWindowById(WC_ERRMSG, 0);
+ bool no_timeout = wl == WL_CRITICAL;
+
if (_settings_client.gui.errmsg_duration == 0 && !no_timeout) return;
if (summary_msg == STR_NULL) summary_msg = STR_EMPTY;
@@ -716,7 +719,7 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y)
msg = STR_MESSAGE_ESTIMATED_INCOME;
}
SetDParam(0, cost);
- ShowErrorMessage(msg, INVALID_STRING_ID, x, y);
+ ShowErrorMessage(msg, INVALID_STRING_ID, WL_INFO, x, y);
}
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
@@ -1874,7 +1877,7 @@ public:
case SLWW_CONTENT_DOWNLOAD:
if (!_network_available) {
- ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
#if defined(ENABLE_NETWORK)
switch (_saveload_mode) {
@@ -1922,7 +1925,7 @@ public:
if (this->IsWidgetLowered(SLWW_DELETE_SELECTION)) { // Delete button clicked
if (!FiosDelete(this->text.buf)) {
- ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR);
} else {
BuildFileList();
/* Reset file name to current date on successful delete */
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 4ede5801e..5907da582 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -803,6 +803,6 @@ static const WindowDesc _music_window_desc(
void ShowMusicWindow()
{
- if (BaseMusic::GetUsedSet()->num_available == 0) ShowErrorMessage(STR_ERROR_NO_SONGS, INVALID_STRING_ID, 0, 0);
+ if (BaseMusic::GetUsedSet()->num_available == 0) ShowErrorMessage(STR_ERROR_NO_SONGS, INVALID_STRING_ID, WL_WARNING);
AllocateWindowDescFront<MusicWindow>(&_music_window_desc, 0);
}
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index b5177d6ad..d5ed2a374 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -422,7 +422,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_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, 0, 0);
+ ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, WL_ERROR);
this->Close();
fclose(this->curFile);
this->curFile = NULL;
@@ -456,7 +456,7 @@ bool ClientNetworkContentSocketHandler::BeforeDownload()
if (filename == NULL) {
/* Unless that fails ofcourse... */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
- ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, 0, 0);
+ ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD_FILE_NOT_WRITABLE, STR_CONTENT_ERROR_COULD_NOT_DOWNLOAD, WL_ERROR);
return false;
}
@@ -483,7 +483,7 @@ void ClientNetworkContentSocketHandler::AfterDownload()
this->OnDownloadComplete(this->curInfo->id);
} else {
- ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_EXTRACT, INVALID_STRING_ID, WL_ERROR);
}
}
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index bb77aea6d..a25a5ad4a 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -742,7 +742,7 @@ public:
virtual void OnConnect(bool success)
{
if (!success) {
- ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR);
delete this;
return;
}
@@ -886,7 +886,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, STR_CONTENT_NO_ZLIB_SUB, 0, 0);
+ ShowErrorMessage(STR_CONTENT_NO_ZLIB, STR_CONTENT_NO_ZLIB_SUB, WL_ERROR);
/* Connection failed... clean up the mess */
if (cv != NULL) {
for (ContentIterator iter = cv->Begin(); iter != cv->End(); iter++) delete *iter;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 96c3d7bea..23fafad3c 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -44,7 +44,7 @@ void ShowNewGRFError()
for (uint i = 0; i < c->error->num_params; i++) {
SetDParam(6 + i, c->error->param_value[i]);
}
- ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(STR_NEWGRF_ERROR_FATAL_POPUP, INVALID_STRING_ID, WL_CRITICAL);
break;
}
}
@@ -370,7 +370,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(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
return;
}
}
@@ -850,7 +850,7 @@ struct NewGRFWindow : public Window {
case SNGRFS_CONTENT_DOWNLOAD:
if (!_network_available) {
- ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
#if defined(ENABLE_NETWORK)
/* Only show the things in the current list, or everything when nothing's selected */
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 905e66739..ceff4923f 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -537,7 +537,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, STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, 0, 0);
+ ShowErrorMessage(STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK, WL_WARNING);
/* abort the function early, this error isn't critical and will allow the game to continue to run */
break;
diff --git a/src/openttd.cpp b/src/openttd.cpp
index a1559592e..869cb6f81 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -870,7 +870,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(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
_game_mode = GM_MENU;
return;
}
@@ -886,7 +886,7 @@ static void StartScenario()
if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, SCENARIO_DIR) != SL_OK) {
LoadIntroGame();
SetDParamStr(0, GetSaveLoadErrorString());
- ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
_settings_game.difficulty = _settings_newgame.difficulty;
@@ -1002,7 +1002,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(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
} else {
if (_saveload_mode == SLD_LOAD_SCENARIO) {
StartupEngines();
@@ -1047,7 +1047,7 @@ void SwitchToMode(SwitchMode new_mode)
DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
} else {
SetDParamStr(0, GetSaveLoadErrorString());
- ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
break;
}
@@ -1055,7 +1055,7 @@ void SwitchToMode(SwitchMode new_mode)
case SM_MENU: // Switch to game intro menu
LoadIntroGame();
if (BaseSounds::ini_set == NULL && BaseSounds::GetUsedSet()->fallback) {
- ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, WL_CRITICAL);
BaseSounds::ini_set = strdup(BaseSounds::GetUsedSet()->name);
}
break;
@@ -1064,7 +1064,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(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
} else {
DeleteWindowById(WC_SAVELOAD, 0);
}
@@ -1081,7 +1081,7 @@ void SwitchToMode(SwitchMode new_mode)
}
if (_switch_mode_errorstr != INVALID_STRING_ID) {
- ShowErrorMessage(_switch_mode_errorstr, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(_switch_mode_errorstr, INVALID_STRING_ID, WL_CRITICAL);
}
}
@@ -1239,7 +1239,7 @@ static void DoAutosave()
DEBUG(sl, 2, "Autosaving to '%s'", buf);
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK) {
- ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
}
}
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 0d081df73..7a9c81e98 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1743,7 +1743,7 @@ const char *GetSaveLoadErrorString()
static void SaveFileError()
{
SetDParamStr(0, GetSaveLoadErrorString());
- ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
SaveFileDone();
}
@@ -1833,7 +1833,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(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, 0, 0);
+ if (!_do_autosave) ShowErrorMessage(STR_ERROR_SAVE_STILL_IN_PROGRESS, INVALID_STRING_ID, WL_ERROR);
return SL_OK;
}
WaitTillSaved();
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index eb0901fb1..b5198e276 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -659,9 +659,9 @@ bool MakeScreenshot(ScreenshotType t, const char *name)
if (ret) {
SetDParamStr(0, _screenshot_name);
- ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_MESSAGE_SCREENSHOT_SUCCESSFULLY, INVALID_STRING_ID, WL_WARNING);
} else {
- ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_SCREENSHOT_FAILED, INVALID_STRING_ID, WL_ERROR);
}
return ret;
diff --git a/src/settings.cpp b/src/settings.cpp
index 9c9dd1f37..901860848 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -857,7 +857,7 @@ static bool DifficultyChange(int32)
{
if (_game_mode == GM_MENU) {
if (_settings_newgame.difficulty.diff_level != 3) {
- ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_WARNING_DIFFICULTY_TO_CUSTOM, INVALID_STRING_ID, WL_WARNING);
_settings_newgame.difficulty.diff_level = 3;
}
SetWindowClassesDirty(WC_SELECT_GAME);
@@ -870,7 +870,7 @@ static bool DifficultyChange(int32)
AI::GetInfoList()->size() == 0 &&
#endif /* ENABLE_AI */
(!_networking || _network_server)) {
- ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
}
/* If we are a network-client, update the difficult setting (if it is open).
@@ -925,14 +925,14 @@ static bool CheckFreeformEdges(int32 p1)
Ship *s;
FOR_ALL_SHIPS(s) {
if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
Station *st;
FOR_ALL_STATIONS(st) {
if (TileX(st->xy) == 0 || TileY(st->xy) == 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
@@ -941,25 +941,25 @@ static bool CheckFreeformEdges(int32 p1)
} else {
for (uint i = 0; i < MapMaxX(); i++) {
if (TileHeight(TileXY(i, 1)) != 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
for (uint i = 1; i < MapMaxX(); i++) {
if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
for (uint i = 0; i < MapMaxY(); i++) {
if (TileHeight(TileXY(1, i)) != 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
for (uint i = 1; i < MapMaxY(); i++) {
if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
- ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_WATER, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
@@ -988,7 +988,7 @@ static bool ChangeDynamicEngines(int32 p1)
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (IsCompanyBuildableVehicleType(v)) {
- ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, INVALID_STRING_ID, WL_ERROR);
return false;
}
}
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 0173bfb6d..70dc8a47c 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -331,7 +331,7 @@ struct GameOptionsWindow : Window {
case GOW_FULLSCREEN_BUTTON: // Click fullscreen on/off
/* try to toggle full-screen on/off */
if (!ToggleFullScreen(!_fullscreen)) {
- ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR);
}
this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen);
this->SetDirty();
@@ -660,7 +660,7 @@ public:
AI::GetInfoList()->size() == 0 &&
#endif /* ENABLE_AI */
this->opt_mod_temp.difficulty.max_no_competitors != 0) {
- ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(STR_WARNING_NO_SUITABLE_AI, INVALID_STRING_ID, WL_CRITICAL);
}
return;
}
diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp
index de47201e1..335daa1a2 100644
--- a/src/spriteloader/grf.cpp
+++ b/src/spriteloader/grf.cpp
@@ -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(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, WL_ERROR);
}
DEBUG(sprite, warning_level, "[%i] Loading corrupted sprite from %s at position %i", line, FioGetFilename(file_slot), (int)file_pos);
warning_level = 6;
diff --git a/src/strings.cpp b/src/strings.cpp
index e27560b53..11c8c587f 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1602,7 +1602,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(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_WARNING);
/* Reset the font width */
LoadStringWidthTable();
@@ -1635,7 +1635,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(STR_JUST_RAW_STRING, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
#endif
}
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 6ab50c3ff..637405a65 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2309,7 +2309,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(STR_ERROR_TOWN_EXPAND_WARN_NO_ROADS, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_TOWN_EXPAND_WARN_NO_ROADS, INVALID_STRING_ID, WL_WARNING);
warned_no_roads = true;
}
@@ -2453,7 +2453,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, STR_ERROR_BRIBE_FAILED_2, 0, 0);
+ if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, STR_ERROR_BRIBE_FAILED_2, WL_INFO);
/* decrease by a lot!
* ChangeTownRating is only for stuff in demolishing. Bribe failure should
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 56732d5d8..c479939bf 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -462,7 +462,7 @@ public:
if (this->CanDeleteTown()) {
delete this->town;
} else {
- ShowErrorMessage(STR_ERROR_TOWN_CAN_T_DELETE, INVALID_STRING_ID, 0, 0);
+ ShowErrorMessage(STR_ERROR_TOWN_CAN_T_DELETE, INVALID_STRING_ID, WL_INFO);
}
break;
}
@@ -1149,7 +1149,7 @@ public:
_generating_world = true;
UpdateNearestTownForRoadTiles(true);
if (!GenerateTowns(this->town_layout)) {
- ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, 0, 0);
+ ShowErrorMessage(STR_ERROR_CAN_T_GENERATE_TOWN, STR_ERROR_NO_SPACE_FOR_TOWN, WL_INFO);
}
UpdateNearestTownForRoadTiles(false);
_generating_world = false;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 0f2ae36b2..976fe6467 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -186,7 +186,7 @@ void CheckTrainsLengths()
(w->track == TRACK_BIT_DEPOT && TicksToLeaveDepot(u) <= 0)) {
SetDParam(0, v->index);
SetDParam(1, v->owner);
- ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, 0, 0, true);
+ ShowErrorMessage(STR_BROKEN_VEHICLE_LENGTH, INVALID_STRING_ID, WL_CRITICAL);
if (!_networking) DoCommandP(0, PM_PAUSED_ERROR, 1, CMD_PAUSE);
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index f0a1d40da..a8968db8d 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -202,7 +202,7 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
SetBit(grfconfig->grf_bugs, bug_type);
SetDParamStr(0, grfconfig->name);
SetDParam(1, engine);
- ShowErrorMessage(part1, part2, 0, 0, true);
+ ShowErrorMessage(part1, part2, WL_CRITICAL);
if (!_networking) DoCommand(0, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, 1, DC_EXEC, CMD_PAUSE);
}