summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-01-15 21:13:47 +0000
committerfrosch <frosch@openttd.org>2011-01-15 21:13:47 +0000
commit6e4dd5615878c658cf687a73dc1990f9e903df86 (patch)
tree29eddd4bfb56a83ab7ba2e131372d79535fb8b79 /src/newgrf_config.cpp
parent4d8a93c870428d8cdffad9a453aef91a1365f97e (diff)
downloadopenttd-6e4dd5615878c658cf687a73dc1990f9e903df86.tar.xz
(svn r21814) -Fix/Add: Check GRF version from action 8, and disallow usage of GRFs with versions above 7.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index e7be72fab..aed73655c 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -444,7 +444,7 @@ GRFListCompatibility IsGoodGRFConfigList(GRFConfig *grfconfig)
for (GRFConfig *c = grfconfig; c != NULL; c = c->next) {
const GRFConfig *f = FindGRFConfig(c->ident.grfid, FGCM_EXACT, c->ident.md5sum);
- if (f == NULL) {
+ if (f == NULL || HasBit(f->flags, GCF_INVALID)) {
char buf[256];
/* If we have not found the exactly matching GRF try to find one with the
@@ -630,6 +630,8 @@ const GRFConfig *FindGRFConfig(uint32 grfid, FindGRFConfigMode mode, const uint8
if (!c->ident.HasGrfIdentifier(grfid, md5sum)) continue;
/* return it, if the exact same newgrf is found, or if we do not care about finding "the best" */
if (md5sum != NULL || mode == FGCM_ANY) return c;
+ /* Skip incompatible stuff, unless explicitly allowed */
+ if (mode != FGCM_NEWEST && HasBit(c->flags, GCF_INVALID)) continue;
/* check version compatibility */
if (mode == FGCM_COMPATIBLE && (c->version < desired_version || c->min_loadable_version > desired_version)) continue;
/* remember the newest one as "the best" */