mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r25836) -Codechange: Use NUM_INDUSTRYTYPES_PER_GRF instead of NUM_INDUSTRYTYPES to properly distinguish limits per NewGRF and limits of the pool.
This commit is contained in:
parent
ac599625da
commit
a521af8cf8
@ -22,8 +22,10 @@ struct IndustryTileSpec;
|
|||||||
|
|
||||||
static const IndustryID INVALID_INDUSTRY = 0xFFFF;
|
static const IndustryID INVALID_INDUSTRY = 0xFFFF;
|
||||||
|
|
||||||
static const IndustryType NEW_INDUSTRYOFFSET = 37; ///< original number of industries
|
static const IndustryType NUM_INDUSTRYTYPES_PER_GRF = 64; ///< maximum number of industry types per NewGRF
|
||||||
static const IndustryType NUM_INDUSTRYTYPES = 64; ///< total number of industries, new and old
|
|
||||||
|
static const IndustryType NEW_INDUSTRYOFFSET = 37; ///< original number of industry types
|
||||||
|
static const IndustryType NUM_INDUSTRYTYPES = 64; ///< total number of industry types, new and old
|
||||||
static const IndustryType INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES; ///< one above amount is considered invalid
|
static const IndustryType INVALID_INDUSTRYTYPE = NUM_INDUSTRYTYPES; ///< one above amount is considered invalid
|
||||||
|
|
||||||
static const IndustryGfx INDUSTRYTILE_NOANIM = 0xFF; ///< flag to mark industry tiles as having no animation
|
static const IndustryGfx INDUSTRYTILE_NOANIM = 0xFF; ///< flag to mark industry tiles as having no animation
|
||||||
|
@ -3215,14 +3215,14 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
|
|||||||
{
|
{
|
||||||
ChangeInfoResult ret = CIR_SUCCESS;
|
ChangeInfoResult ret = CIR_SUCCESS;
|
||||||
|
|
||||||
if (indid + numinfo > NUM_INDUSTRYTYPES) {
|
if (indid + numinfo > NUM_INDUSTRYTYPES_PER_GRF) {
|
||||||
grfmsg(1, "IndustriesChangeInfo: Too many industries loaded (%u), max (%u). Ignoring.", indid + numinfo, NUM_INDUSTRYTYPES);
|
grfmsg(1, "IndustriesChangeInfo: Too many industries loaded (%u), max (%u). Ignoring.", indid + numinfo, NUM_INDUSTRYTYPES_PER_GRF);
|
||||||
return CIR_INVALID_ID;
|
return CIR_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate industry specs if they haven't been allocated already. */
|
/* Allocate industry specs if they haven't been allocated already. */
|
||||||
if (_cur.grffile->industryspec == NULL) {
|
if (_cur.grffile->industryspec == NULL) {
|
||||||
_cur.grffile->industryspec = CallocT<IndustrySpec*>(NUM_INDUSTRYTYPES);
|
_cur.grffile->industryspec = CallocT<IndustrySpec*>(NUM_INDUSTRYTYPES_PER_GRF);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numinfo; i++) {
|
for (int i = 0; i < numinfo; i++) {
|
||||||
@ -7846,7 +7846,7 @@ static void ResetCustomIndustries()
|
|||||||
/* We are verifiying both tiles and industries specs loaded from the grf file
|
/* We are verifiying both tiles and industries specs loaded from the grf file
|
||||||
* First, let's deal with industryspec */
|
* First, let's deal with industryspec */
|
||||||
if (industryspec != NULL) {
|
if (industryspec != NULL) {
|
||||||
for (uint i = 0; i < NUM_INDUSTRYTYPES; i++) {
|
for (uint i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) {
|
||||||
IndustrySpec *ind = industryspec[i];
|
IndustrySpec *ind = industryspec[i];
|
||||||
if (ind == NULL) continue;
|
if (ind == NULL) continue;
|
||||||
|
|
||||||
@ -8482,7 +8482,7 @@ static void FinaliseIndustriesArray()
|
|||||||
IndustrySpec **&industryspec = (*file)->industryspec;
|
IndustrySpec **&industryspec = (*file)->industryspec;
|
||||||
IndustryTileSpec **&indtspec = (*file)->indtspec;
|
IndustryTileSpec **&indtspec = (*file)->indtspec;
|
||||||
if (industryspec != NULL) {
|
if (industryspec != NULL) {
|
||||||
for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
|
for (int i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) {
|
||||||
IndustrySpec *indsp = industryspec[i];
|
IndustrySpec *indsp = industryspec[i];
|
||||||
|
|
||||||
if (indsp != NULL && indsp->enabled) {
|
if (indsp != NULL && indsp->enabled) {
|
||||||
|
Loading…
Reference in New Issue
Block a user