summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-01-10 19:30:40 +0000
committerpeter1138 <peter1138@openttd.org>2009-01-10 19:30:40 +0000
commit510e0ce083b4e4207bf0da42e7ebbf06f1491a08 (patch)
tree8436866fc391f16108270d7e668fcaf90304adc1
parent238c0a5d1f38c5ddd1656a3805d6927bba7df117 (diff)
downloadopenttd-510e0ce083b4e4207bf0da42e7ebbf06f1491a08.tar.xz
(svn r14979) -Fix: Disable a NewGRF from loading if it contains multiple Action 8s
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/newgrf.cpp10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index a44b2d1b9..4edbf7ae4 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3260,6 +3260,7 @@ STR_NEWGRF_ERROR_UNEXPECTED_SPRITE :Unexpected spri
STR_NEWGRF_ERROR_UNKNOWN_PROPERTY :Unknown Action 0 property.
STR_NEWGRF_ERROR_INVALID_ID :Attempt to use invalid ID.
STR_NEWGRF_ERROR_CORRUPT_SPRITE :{YELLOW}{RAW_STRING} contains a corrupt sprite. All corrupt sprites will be shown as a red question mark (?).
+STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Contains multiple Action 8 entries.
STR_NEWGRF_PRESET_LIST_TIP :{BLACK}Load the selected preset
STR_NEWGRF_PRESET_SAVE :{BLACK}Save preset
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 19ff34803..e30e670ab 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4140,6 +4140,16 @@ static void GRFInfo(byte *buf, size_t len)
uint32 grfid = grf_load_dword(&buf);
const char *name = grf_load_string(&buf, len - 6);
+ if (_cur_stage < GLS_RESERVE && _cur_grfconfig->status != GCS_UNKNOWN) {
+ _cur_grfconfig->status = GCS_DISABLED;
+ _cur_grfconfig->error = CallocT<GRFError>(1);
+ _cur_grfconfig->error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
+ _cur_grfconfig->error->message = STR_NEWGRF_ERROR_MULTIPLE_ACTION_8;
+
+ _skip_sprites = -1;
+ return;
+ }
+
_cur_grffile->grfid = grfid;
_cur_grffile->grf_version = version;
_cur_grfconfig->status = _cur_stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;