summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2017-01-14 13:12:49 +0000
committerfrosch <frosch@openttd.org>2017-01-14 13:12:49 +0000
commitec9a920aab1af1001abb216a89cdc13e0ba1c3ab (patch)
tree08b793017fae46a658fda51e8e2d5720867335b2 /src/newgrf.cpp
parent6696e5c4e1aca4a928dc88656497c63b6ebda6fa (diff)
downloadopenttd-ec9a920aab1af1001abb216a89cdc13e0ba1c3ab.tar.xz
(svn r27729) -Codechange: Do not count static NewGRF when checking for the maximum number of NewGRFs in a game.
-Codechange: Remove LAST_GRF_SLOT and MAX_NEWGRFS. Now NETWORK_MAX_GRF_COUNT is the only constant to specify the maximum number of non-static NewGRF. -Codechange: Increase the number of file slots, effectively increasing the maximum number of static NewGRF and baseset GRFs.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 8d85b383d..7b862149d 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -8860,8 +8860,8 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage, S
if (stage == GLS_ACTIVATION && !HasBit(config->flags, GCF_RESERVED)) return;
}
- if (file_index > LAST_GRF_SLOT) {
- DEBUG(grf, 0, "'%s' is not loaded as the maximum number of GRFs has been reached", filename);
+ if (file_index >= MAX_FILE_SLOTS) {
+ DEBUG(grf, 0, "'%s' is not loaded as the maximum number of file slots has been reached", filename);
config->status = GCS_DISABLED;
config->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
return;
@@ -9263,6 +9263,7 @@ void LoadNewGRF(uint load_index, uint file_index)
}
uint slot = file_index;
+ uint num_non_static = 0;
_cur.stage = stage;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
@@ -9277,6 +9278,16 @@ void LoadNewGRF(uint load_index, uint file_index)
}
if (stage == GLS_LABELSCAN) InitNewGRFFile(c);
+
+ if (!HasBit(c->flags, GCF_STATIC) && !HasBit(c->flags, GCF_SYSTEM)) {
+ if (num_non_static == NETWORK_MAX_GRF_COUNT) {
+ DEBUG(grf, 0, "'%s' is not loaded as the maximum number of non-static GRFs has been reached", c->filename);
+ c->status = GCS_DISABLED;
+ c->error = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
+ continue;
+ }
+ num_non_static++;
+ }
LoadNewGRFFile(c, slot++, stage, subdir);
if (stage == GLS_RESERVE) {
SetBit(c->flags, GCF_RESERVED);