summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-15 00:00:51 +0000
committerrubidium <rubidium@openttd.org>2009-12-15 00:00:51 +0000
commit3e6c530e1ea1139d18ebe31fa6e99460cdfbce6e (patch)
tree7461637cdc7d48ef9c1e132200b58bdba076c1de /src
parent5450167efc292ab93ab841077e71a7d63cfc7e05 (diff)
downloadopenttd-3e6c530e1ea1139d18ebe31fa6e99460cdfbce6e.tar.xz
(svn r18506) -Fix [FS#3368]: no error message was created for the first fatal NewGRF error.
Diffstat (limited to 'src')
-rw-r--r--src/genworld.cpp3
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/newgrf.h1
-rw-r--r--src/newgrf_gui.cpp23
-rw-r--r--src/saveload/afterload.cpp1
5 files changed, 29 insertions, 0 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 2bc8d97ff..05cac4d1a 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -32,6 +32,7 @@
#include "saveload/saveload.h"
#include "void_map.h"
#include "town.h"
+#include "newgrf.h"
#include "table/sprites.h"
@@ -168,6 +169,8 @@ static void _GenerateWorld(void *arg)
CleanupGeneration();
+ ShowNewGRFError();
+
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
DEBUG(desync, 1, "new_map: %i\n", _settings_game.game_creation.generation_seed);
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 28b702250..25d5b8294 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2325,6 +2325,7 @@ STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{RAW_ST
STR_NEWGRF_ERROR_MSG_WARNING :{RED}Warning: {SILVER}{RAW_STRING}
STR_NEWGRF_ERROR_MSG_ERROR :{RED}Error: {SILVER}{RAW_STRING}
STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{RAW_STRING}
+STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}A fatal NewGRF error has occurred: {}{STRING5}
STR_NEWGRF_ERROR_VERSION_NUMBER :{1:STRING1} will not work with the TTDPatch version reported by OpenTTD.
STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{1:STRING1} is for the {STRING1} version of TTD.
STR_NEWGRF_ERROR_UNSET_SWITCH :{1:STRING1} is designed to be used with {STRING1}
diff --git a/src/newgrf.h b/src/newgrf.h
index b9009c4fe..ea9b890a0 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -147,5 +147,6 @@ bool HasGrfMiscBit(GrfMiscBit bit);
bool GetGlobalVariable(byte param, uint32 *value);
StringID MapGRFStringID(uint32 grfid, StringID str);
+void ShowNewGRFError();
#endif /* NEWGRF_H */
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index c6fdf8450..1515e4ba5 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -26,6 +26,29 @@
#include "table/strings.h"
#include "table/sprites.h"
+/**
+ * Show the first NewGRF error we can find.
+ */
+void ShowNewGRFError()
+{
+ for (const GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
+ /* We only want to show fatal errors */
+ if (c->error == NULL || c->error->severity != STR_NEWGRF_ERROR_MSG_FATAL) continue;
+
+ SetDParam (0, c->error->custom_message == NULL ? c->error->message : STR_JUST_RAW_STRING);
+ SetDParamStr(1, c->error->custom_message);
+ SetDParam (2, STR_JUST_RAW_STRING);
+ SetDParamStr(3, c->filename);
+ SetDParam (4, STR_JUST_RAW_STRING);
+ SetDParamStr(5, c->error->data);
+ 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);
+ break;
+ }
+}
+
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a
* comma or a space character
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 39dcfde85..beba40d2d 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -261,6 +261,7 @@ static void InitializeWindowsAndCaches()
UpdateAirportsNoise();
CheckTrainsLengths();
+ ShowNewGRFError();
}
typedef void (CDECL *SignalHandlerPointer)(int);