1
0
Fork 0

Feature: Increase number of stations/roadstops per NewGRF.

pull/10765/head
Peter Nelson 2023-04-18 00:12:34 +01:00 committed by PeterN
parent bc7dfd7b46
commit 0b72297d57
2 changed files with 5 additions and 4 deletions

View File

@ -314,7 +314,8 @@ public:
typedef void (*SpecialSpriteHandler)(ByteReader *buf); typedef void (*SpecialSpriteHandler)(ByteReader *buf);
static const uint NUM_STATIONS_PER_GRF = 255; ///< Number of StationSpecs per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on. /** The maximum amount of stations a single GRF is allowed to add */
static const uint NUM_STATIONS_PER_GRF = UINT16_MAX - 1;
/** Temporary engine data used when loading only */ /** Temporary engine data used when loading only */
struct GRFTempEngineData { struct GRFTempEngineData {
@ -1988,7 +1989,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
} }
case 0x0A: { // Copy sprite layout case 0x0A: { // Copy sprite layout
byte srcid = buf->ReadByte(); uint16_t srcid = buf->ReadExtendedByte();
const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get(); const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get();
if (srcstatspec == nullptr) { if (srcstatspec == nullptr) {
@ -2042,7 +2043,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
break; break;
case 0x0F: { // Copy custom layout case 0x0F: { // Copy custom layout
byte srcid = buf->ReadByte(); uint16_t srcid = buf->ReadExtendedByte();
const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get(); const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get();
if (srcstatspec == nullptr) { if (srcstatspec == nullptr) {

View File

@ -20,7 +20,7 @@
#include "road.h" #include "road.h"
/** The maximum amount of roadstops a single GRF is allowed to add */ /** The maximum amount of roadstops a single GRF is allowed to add */
static const int NUM_ROADSTOPS_PER_GRF = 255; static const int NUM_ROADSTOPS_PER_GRF = UINT16_MAX - 1;
enum RoadStopClassID : byte { enum RoadStopClassID : byte {
ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value