summaryrefslogtreecommitdiff
path: root/src/newgrf_gui.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_gui.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_gui.cpp')
-rw-r--r--src/newgrf_gui.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index eac36c3cf..c3007ac42 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -39,10 +39,6 @@
#include <map>
#include "safeguards.h"
-/* Maximum number of NewGRFs that may be loaded. Six reserved slots are:
- * 0 - config, 1 - sound, 2 - base, 3 - logos, 4 - climate, 5 - extra */
-static const int MAX_NEWGRFS = MAX_FILE_SLOTS - 6;
-
/**
* Show the first NewGRF error we can find.
*/
@@ -1509,7 +1505,7 @@ private:
{
if (this->avail_sel == NULL || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false;
- int count = 0;
+ uint count = 0;
GRFConfig **entry = NULL;
GRFConfig **list;
/* Find last entry in the list, checking for duplicate grfid on the way */
@@ -1519,10 +1515,10 @@ private:
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
return false;
}
- count++;
+ if (!HasBit((*list)->flags, GCF_STATIC)) count++;
}
if (entry == NULL) entry = list;
- if (count >= MAX_NEWGRFS) {
+ if (count >= NETWORK_MAX_GRF_COUNT) {
ShowErrorMessage(STR_NEWGRF_TOO_MANY_NEWGRFS, INVALID_STRING_ID, WL_INFO);
return false;
}