|
|
@ -29,12 +29,17 @@
|
|
|
|
#include "newgrf_text.h"
|
|
|
|
#include "newgrf_text.h"
|
|
|
|
#include "textfile_gui.h"
|
|
|
|
#include "textfile_gui.h"
|
|
|
|
#include "tilehighlight_func.h"
|
|
|
|
#include "tilehighlight_func.h"
|
|
|
|
|
|
|
|
#include "fios.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "widgets/newgrf_widget.h"
|
|
|
|
#include "widgets/newgrf_widget.h"
|
|
|
|
#include "widgets/misc_widget.h"
|
|
|
|
#include "widgets/misc_widget.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "table/sprites.h"
|
|
|
|
#include "table/sprites.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.
|
|
|
|
* Show the first NewGRF error we can find.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -1432,6 +1437,7 @@ private:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this->avail_sel == NULL || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false;
|
|
|
|
if (this->avail_sel == NULL || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
GRFConfig **entry = NULL;
|
|
|
|
GRFConfig **entry = NULL;
|
|
|
|
GRFConfig **list;
|
|
|
|
GRFConfig **list;
|
|
|
|
/* Find last entry in the list, checking for duplicate grfid on the way */
|
|
|
|
/* Find last entry in the list, checking for duplicate grfid on the way */
|
|
|
@ -1441,8 +1447,13 @@ private:
|
|
|
|
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
|
|
|
|
ShowErrorMessage(STR_NEWGRF_DUPLICATE_GRFID, INVALID_STRING_ID, WL_INFO);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (entry == NULL) entry = list;
|
|
|
|
if (entry == NULL) entry = list;
|
|
|
|
|
|
|
|
if (count >= MAX_NEWGRFS) {
|
|
|
|
|
|
|
|
ShowErrorMessage(STR_NEWGRF_TOO_MANY_NEWGRFS, INVALID_STRING_ID, WL_INFO);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GRFConfig *c = new GRFConfig(*this->avail_sel); // Copy GRF details from scanned list.
|
|
|
|
GRFConfig *c = new GRFConfig(*this->avail_sel); // Copy GRF details from scanned list.
|
|
|
|
c->SetParameterDefaults();
|
|
|
|
c->SetParameterDefaults();
|
|
|
|