summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-14 19:38:19 +0000
committerfrosch <frosch@openttd.org>2009-03-14 19:38:19 +0000
commit3e3177d7778625026778c5821fd952decfca527e (patch)
tree14cad5398d23b448213aed37ccab9b971c4024fd
parentf33d0f17a3aa892e9963665ba107a9e52ed1ed76 (diff)
downloadopenttd-3e3177d7778625026778c5821fd952decfca527e.tar.xz
(svn r15713) -Feature(ette): Allow static newgrfs to set 'GRF ID engine overrides', if the source GRF is static.
-rw-r--r--src/newgrf.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index fd46c74c1..3023beddf 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2520,7 +2520,7 @@ static void SafeChangeInfo(byte *buf, size_t len)
buf++;
uint8 feature = grf_load_byte(&buf);
uint8 numprops = grf_load_byte(&buf);
- grf_load_byte(&buf); // num-info
+ uint numinfo = grf_load_byte(&buf);
grf_load_extended(&buf); // id
if (feature == GSF_BRIDGE && numprops == 1) {
@@ -2528,6 +2528,22 @@ static void SafeChangeInfo(byte *buf, size_t len)
/* Bridge property 0x0D is redefinition of sprite layout tables, which
* is considered safe. */
if (prop == 0x0D) return;
+ } else if (feature == GSF_GLOBALVAR && numprops == 1) {
+ uint8 prop = grf_load_byte(&buf);
+ /* Engine ID Mappings are safe, if the source is static */
+ if (prop == 0x11) {
+ bool is_safe = true;
+ for (uint i = 0; i < numinfo; i++) {
+ uint32 s = grf_load_dword(&buf);
+ grf_load_dword(&buf); // dest
+ const GRFConfig *grfconfig = GetGRFConfig(s);
+ if (grfconfig != NULL && !HasBit(grfconfig->flags, GCF_STATIC)) {
+ is_safe = false;
+ break;
+ }
+ }
+ if (is_safe) return;
+ }
}
SetBit(_cur_grfconfig->flags, GCF_UNSAFE);