diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/airport.h | 4 | ||||
-rw-r--r-- | src/newgrf.cpp | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/airport.h b/src/airport.h index 34266e36c..31c68ef00 100644 --- a/src/airport.h +++ b/src/airport.h @@ -20,7 +20,9 @@ static const uint MAX_TERMINALS = 8; ///< maximum number static const uint MAX_HELIPADS = 3; ///< maximum number of helipads per airport static const uint MAX_ELEMENTS = 255; ///< maximum number of aircraft positions at airport -static const uint NUM_AIRPORTTILES = 256; ///< total number of airport tiles +static const uint NUM_AIRPORTTILES_PER_GRF = 255; ///< Number of airport tiles per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on. + +static const uint NUM_AIRPORTTILES = 256; ///< Total number of airport tiles. static const uint NEW_AIRPORTTILE_OFFSET = 74; ///< offset of first newgrf airport tile static const uint INVALID_AIRPORTTILE = NUM_AIRPORTTILES; ///< id for an invalid airport tile diff --git a/src/newgrf.cpp b/src/newgrf.cpp index d4851f88f..f2006e024 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4118,14 +4118,14 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro { ChangeInfoResult ret = CIR_SUCCESS; - if (airtid + numinfo > NUM_AIRPORTTILES) { - grfmsg(1, "AirportTileChangeInfo: Too many airport tiles loaded (%u), max (%u). Ignoring.", airtid + numinfo, NUM_AIRPORTTILES); + if (airtid + numinfo > NUM_AIRPORTTILES_PER_GRF) { + grfmsg(1, "AirportTileChangeInfo: Too many airport tiles loaded (%u), max (%u). Ignoring.", airtid + numinfo, NUM_AIRPORTTILES_PER_GRF); return CIR_INVALID_ID; } /* Allocate airport tile specs if they haven't been allocated already. */ if (_cur.grffile->airtspec == NULL) { - _cur.grffile->airtspec = CallocT<AirportTileSpec*>(NUM_AIRPORTTILES); + _cur.grffile->airtspec = CallocT<AirportTileSpec*>(NUM_AIRPORTTILES_PER_GRF); } for (int i = 0; i < numinfo; i++) { @@ -7826,7 +7826,7 @@ static void ResetCustomAirports() AirportTileSpec **&airporttilespec = (*file)->airtspec; if (airporttilespec != NULL) { - for (uint i = 0; i < NUM_AIRPORTTILES; i++) { + for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) { free(airporttilespec[i]); } free(airporttilespec); @@ -8581,7 +8581,7 @@ static void FinaliseAirportsArray() AirportTileSpec **&airporttilespec = (*file)->airtspec; if (airporttilespec != NULL) { - for (uint i = 0; i < NUM_AIRPORTTILES; i++) { + for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) { if (airporttilespec[i] != NULL && airporttilespec[i]->enabled) { _airporttile_mngr.SetEntitySpec(airporttilespec[i]); } |