Merge branch 'master' into jgrpp

# Conflicts:
#	src/animated_tile.cpp
#	src/cargopacket.h
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/date.cpp
#	src/disaster_vehicle.cpp
#	src/dock_gui.cpp
#	src/economy.cpp
#	src/engine.cpp
#	src/error_gui.cpp
#	src/fontcache/spritefontcache.cpp
#	src/game/game_gui.cpp
#	src/game/game_text.cpp
#	src/gfx.cpp
#	src/graph_gui.cpp
#	src/highscore_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/english_AU.txt
#	src/lang/english_US.txt
#	src/lang/finnish.txt
#	src/lang/french.txt
#	src/lang/italian.txt
#	src/lang/portuguese.txt
#	src/lang/russian.txt
#	src/lang/turkish.txt
#	src/lang/vietnamese.txt
#	src/main_gui.cpp
#	src/misc_gui.cpp
#	src/network/network_gui.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf.h
#	src/newgrf_generic.cpp
#	src/news_gui.cpp
#	src/openttd.cpp
#	src/os/unix/unix.cpp
#	src/os/windows/font_win32.cpp
#	src/os/windows/win32.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/misc_sl.cpp
#	src/saveload/oldloader_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/script/script_gui.cpp
#	src/settings_table.cpp
#	src/signs_gui.cpp
#	src/smallmap_gui.cpp
#	src/smallmap_gui.h
#	src/spritecache.cpp
#	src/spritecache.h
#	src/spriteloader/grf.cpp
#	src/station_cmd.cpp
#	src/statusbar_gui.cpp
#	src/stdafx.h
#	src/strgen/strgen_base.cpp
#	src/subsidy.cpp
#	src/table/settings/difficulty_settings.ini
#	src/texteff.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/town_gui.cpp
#	src/townname.cpp
#	src/vehicle.cpp
#	src/waypoint_cmd.cpp
#	src/widgets/dropdown.cpp
#	src/window.cpp
This commit is contained in:
Jonathan G Rennison
2023-05-26 19:36:48 +01:00
170 changed files with 1526 additions and 1238 deletions

View File

@@ -250,7 +250,7 @@ struct GRFTempEngineData {
}
};
static GRFTempEngineData *_gted; ///< Temporary engine data used during NewGRF loading
static std::vector<GRFTempEngineData> _gted; ///< Temporary engine data used during NewGRF loading
/**
* Contains the GRF ID of the owner of a vehicle if it has been reserved.
@@ -590,11 +590,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
if (engine_pool_size != Engine::GetPoolSize()) {
/* Resize temporary engine data ... */
_gted = ReallocT(_gted, Engine::GetPoolSize());
/* and blank the new block. */
size_t len = (Engine::GetPoolSize() - engine_pool_size) * sizeof(*_gted);
memset(_gted + engine_pool_size, 0, len);
_gted.resize(Engine::GetPoolSize());
}
if (type == VEH_TRAIN) {
_gted[e->index].railtypelabel = GetRailTypeInfo(e->u.rail.railtype)->label;
@@ -1869,10 +1865,10 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons
}
/* Allocate station specs if necessary */
if (_cur.grffile->stations == nullptr) _cur.grffile->stations = CallocT<StationSpec*>(NUM_STATIONS_PER_GRF);
if (_cur.grffile->stations.size() < stid + numinfo) _cur.grffile->stations.resize(stid + numinfo);
for (int i = 0; i < numinfo; i++) {
StationSpec *statspec = _cur.grffile->stations[stid + i];
StationSpec *statspec = _cur.grffile->stations[stid + i].get();
/* Check that the station we are modifying is defined. */
if (statspec == nullptr && prop != 0x08) {
@@ -1882,14 +1878,15 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons
switch (prop) {
case 0x08: { // Class ID
StationSpec **spec = &_cur.grffile->stations[stid + i];
/* Property 0x08 is special; it is where the station is allocated */
if (*spec == nullptr) *spec = new StationSpec();
if (statspec == nullptr) {
_cur.grffile->stations[stid + i] = std::make_unique<StationSpec>();
statspec = _cur.grffile->stations[stid + i].get();
}
/* Swap classid because we read it in BE meaning WAYP or DFLT */
uint32 classid = buf->ReadDWord();
(*spec)->cls_id = StationClass::Allocate(BSWAP32(classid));
statspec->cls_id = StationClass::Allocate(BSWAP32(classid));
break;
}
@@ -1945,7 +1942,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons
case 0x0A: { // Copy sprite layout
byte srcid = buf->ReadByte();
const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid];
const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get();
if (srcstatspec == nullptr) {
grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy sprite layout to %u.", srcid, stid + i);
@@ -1999,7 +1996,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons
case 0x0F: { // Copy custom layout
byte srcid = buf->ReadByte();
const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid];
const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get();
if (srcstatspec == nullptr) {
grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy tile layout to %u.", srcid, stid + i);
@@ -2358,12 +2355,10 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
}
/* Allocate house specs if they haven't been allocated already. */
if (_cur.grffile->housespec == nullptr) {
_cur.grffile->housespec = CallocT<HouseSpec*>(NUM_HOUSES_PER_GRF);
}
if (_cur.grffile->housespec.size() < hid + numinfo) _cur.grffile->housespec.resize(hid + numinfo);
for (int i = 0; i < numinfo; i++) {
HouseSpec *housespec = _cur.grffile->housespec[hid + i];
HouseSpec *housespec = _cur.grffile->housespec[hid + i].get();
if (prop != 0x08 && housespec == nullptr) {
/* If the house property 08 is not yet set, ignore this property */
@@ -2374,13 +2369,11 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
switch (prop) {
case 0x08: { // Substitute building type, and definition of a new house
HouseSpec **house = &_cur.grffile->housespec[hid + i];
byte subs_id = buf->ReadByte();
if (subs_id == 0xFF) {
/* Instead of defining a new house, a substitute house id
* of 0xFF disables the old house with the current id. */
HouseSpec::Get(hid + i)->enabled = false;
if (hid + i < NEW_HOUSE_OFFSET) HouseSpec::Get(hid + i)->enabled = false;
continue;
} else if (subs_id >= NEW_HOUSE_OFFSET) {
/* The substitute id must be one of the original houses. */
@@ -2389,11 +2382,10 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con
}
/* Allocate space for this house. */
if (*house == nullptr) *house = CallocT<HouseSpec>(1);
housespec = *house;
MemCpyT(housespec, HouseSpec::Get(subs_id));
if (housespec == nullptr) {
_cur.grffile->housespec[hid + i] = std::make_unique<HouseSpec>(*HouseSpec::Get(subs_id));
housespec = _cur.grffile->housespec[hid + i].get();
}
housespec->enabled = true;
housespec->grf_prop.local_id = hid + i;
@@ -3240,12 +3232,10 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
}
/* Allocate industry tile specs if they haven't been allocated already. */
if (_cur.grffile->indtspec == nullptr) {
_cur.grffile->indtspec = CallocT<IndustryTileSpec*>(NUM_INDUSTRYTILES_PER_GRF);
}
if (_cur.grffile->indtspec.size() < indtid + numinfo) _cur.grffile->indtspec.resize(indtid + numinfo);
for (int i = 0; i < numinfo; i++) {
IndustryTileSpec *tsp = _cur.grffile->indtspec[indtid + i];
IndustryTileSpec *tsp = _cur.grffile->indtspec[indtid + i].get();
if (prop != 0x08 && tsp == nullptr) {
ChangeInfoResult cir = IgnoreIndustryTileProperty(prop, buf);
@@ -3255,9 +3245,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
switch (prop) {
case 0x08: { // Substitute industry tile type
IndustryTileSpec **tilespec = &_cur.grffile->indtspec[indtid + i];
byte subs_id = buf->ReadByte();
if (subs_id >= NEW_INDUSTRYTILEOFFSET) {
/* The substitute id must be one of the original industry tile. */
grfmsg(2, "IndustryTilesChangeInfo: Attempt to use new industry tile %u as substitute industry tile for %u. Ignoring.", subs_id, indtid + i);
@@ -3265,11 +3253,10 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr
}
/* Allocate space for this industry. */
if (*tilespec == nullptr) {
*tilespec = CallocT<IndustryTileSpec>(1);
tsp = *tilespec;
if (tsp == nullptr) {
_cur.grffile->indtspec[indtid + i] = std::make_unique<IndustryTileSpec>(_industry_tile_specs[subs_id]);
tsp = _cur.grffile->indtspec[indtid + i].get();
memcpy(tsp, &_industry_tile_specs[subs_id], sizeof(_industry_tile_specs[subs_id]));
tsp->enabled = true;
/* A copied tile should not have the animation infos copied too.
@@ -3501,12 +3488,10 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
}
/* Allocate industry specs if they haven't been allocated already. */
if (_cur.grffile->industryspec == nullptr) {
_cur.grffile->industryspec = CallocT<IndustrySpec*>(NUM_INDUSTRYTYPES_PER_GRF);
}
if (_cur.grffile->industryspec.size() < indid + numinfo) _cur.grffile->industryspec.resize(indid + numinfo);
for (int i = 0; i < numinfo; i++) {
IndustrySpec *indsp = _cur.grffile->industryspec[indid + i];
IndustrySpec *indsp = _cur.grffile->industryspec[indid + i].get();
if (prop != 0x08 && indsp == nullptr) {
ChangeInfoResult cir = IgnoreIndustryProperty(prop, buf);
@@ -3516,9 +3501,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
switch (prop) {
case 0x08: { // Substitute industry type
IndustrySpec **indspec = &_cur.grffile->industryspec[indid + i];
byte subs_id = buf->ReadByte();
if (subs_id == 0xFF) {
/* Instead of defining a new industry, a substitute industry id
* of 0xFF disables the old industry with the current id. */
@@ -3533,11 +3516,10 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
/* Allocate space for this industry.
* Only need to do it once. If ever it is called again, it should not
* do anything */
if (*indspec == nullptr) {
*indspec = new IndustrySpec;
indsp = *indspec;
if (indsp == nullptr) {
_cur.grffile->industryspec[indid + i] = std::make_unique<IndustrySpec>(_origin_industry_specs[subs_id]);
indsp = _cur.grffile->industryspec[indid + i].get();
*indsp = _origin_industry_specs[subs_id];
indsp->enabled = true;
indsp->grf_prop.local_id = indid + i;
indsp->grf_prop.subst_id = subs_id;
@@ -3913,12 +3895,10 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c
}
/* Allocate industry specs if they haven't been allocated already. */
if (_cur.grffile->airportspec == nullptr) {
_cur.grffile->airportspec = CallocT<AirportSpec*>(NUM_AIRPORTS_PER_GRF);
}
if (_cur.grffile->airportspec.size() < airport + numinfo) _cur.grffile->airportspec.resize(airport + numinfo);
for (int i = 0; i < numinfo; i++) {
AirportSpec *as = _cur.grffile->airportspec[airport + i];
AirportSpec *as = _cur.grffile->airportspec[airport + i].get();
if (as == nullptr && prop != 0x08 && prop != 0x09) {
grfmsg(2, "AirportChangeInfo: Attempt to modify undefined airport %u, ignoring", airport + i);
@@ -3928,7 +3908,6 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c
switch (prop) {
case 0x08: { // Modify original airport
byte subs_id = buf->ReadByte();
if (subs_id == 0xFF) {
/* Instead of defining a new airport, an airport id
* of 0xFF disables the old airport with the current id. */
@@ -3940,15 +3919,13 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c
continue;
}
AirportSpec **spec = &_cur.grffile->airportspec[airport + i];
/* Allocate space for this airport.
* Only need to do it once. If ever it is called again, it should not
* do anything */
if (*spec == nullptr) {
*spec = MallocT<AirportSpec>(1);
as = *spec;
if (as == nullptr) {
_cur.grffile->airportspec[airport + i] = std::make_unique<AirportSpec>(*AirportSpec::GetWithoutOverride(subs_id));
as = _cur.grffile->airportspec[airport + i].get();
memcpy(as, AirportSpec::GetWithoutOverride(subs_id), sizeof(*as));
as->enabled = true;
as->grf_prop.local_id = airport + i;
as->grf_prop.subst_id = subs_id;
@@ -4304,7 +4281,7 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G
}
for (int i = 0; i < numinfo; i++) {
ObjectSpec *spec = _cur.grffile->objectspec[id + i];
ObjectSpec *spec = _cur.grffile->objectspec[id + i].get();
if (prop != 0x08 && spec == nullptr) {
/* If the object property 08 is not yet set, ignore this property */
@@ -4315,18 +4292,17 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G
switch (prop) {
case 0x08: { // Class ID
ObjectSpec **ospec = &_cur.grffile->objectspec[id + i];
/* Allocate space for this object. */
if (*ospec == nullptr) {
*ospec = CallocT<ObjectSpec>(1);
(*ospec)->views = 1; // Default for NewGRFs that don't set it.
(*ospec)->size = OBJECT_SIZE_1X1; // Default for NewGRFs that manage to not set it (1x1)
if (spec == nullptr) {
_cur.grffile->objectspec[id + i] = std::make_unique<ObjectSpec>();
spec = _cur.grffile->objectspec[id + i].get();
spec->views = 1; // Default for NewGRFs that don't set it.
spec->size = OBJECT_SIZE_1X1; // Default for NewGRFs that manage to not set it (1x1)
}
/* Swap classid because we read it in BE. */
uint32 classid = buf->ReadDWord();
(*ospec)->cls_id = ObjectClass::Allocate(BSWAP32(classid));
spec->cls_id = ObjectClass::Allocate(BSWAP32(classid));
break;
}
@@ -4954,12 +4930,10 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro
}
/* Allocate airport tile specs if they haven't been allocated already. */
if (_cur.grffile->airtspec == nullptr) {
_cur.grffile->airtspec = CallocT<AirportTileSpec*>(NUM_AIRPORTTILES_PER_GRF);
}
if (_cur.grffile->airtspec.size() < airtid + numinfo) _cur.grffile->airtspec.resize(airtid + numinfo);
for (int i = 0; i < numinfo; i++) {
AirportTileSpec *tsp = _cur.grffile->airtspec[airtid + i];
AirportTileSpec *tsp = _cur.grffile->airtspec[airtid + i].get();
if (prop != 0x08 && tsp == nullptr) {
grfmsg(2, "AirportTileChangeInfo: Attempt to modify undefined airport tile %u. Ignoring.", airtid + i);
@@ -4968,9 +4942,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro
switch (prop) {
case 0x08: { // Substitute airport tile type
AirportTileSpec **tilespec = &_cur.grffile->airtspec[airtid + i];
byte subs_id = buf->ReadByte();
if (subs_id >= NEW_AIRPORTTILE_OFFSET) {
/* The substitute id must be one of the original airport tiles. */
grfmsg(2, "AirportTileChangeInfo: Attempt to use new airport tile %u as substitute airport tile for %u. Ignoring.", subs_id, airtid + i);
@@ -4978,11 +4950,10 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro
}
/* Allocate space for this airport tile. */
if (*tilespec == nullptr) {
*tilespec = CallocT<AirportTileSpec>(1);
tsp = *tilespec;
if (tsp == nullptr) {
_cur.grffile->airtspec[airtid + i] = std::make_unique<AirportTileSpec>(*AirportTileSpec::Get(subs_id));
tsp = _cur.grffile->airtspec[airtid + i].get();
memcpy(tsp, AirportTileSpec::Get(subs_id), sizeof(AirportTileSpec));
tsp->enabled = true;
tsp->animation.status = ANIM_STATUS_NO_ANIMATION;
@@ -5088,7 +5059,7 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const
}
for (int i = 0; i < numinfo; i++) {
RoadStopSpec *rs = _cur.grffile->roadstops[id + i];
RoadStopSpec *rs = _cur.grffile->roadstops[id + i].get();
if (rs == nullptr && prop != 0x08 && prop != A0RPI_ROADSTOP_CLASS_ID) {
grfmsg(1, "RoadStopChangeInfo: Attempt to modify undefined road stop %u, ignoring", id + i);
@@ -5102,16 +5073,14 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const
if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break;
FALLTHROUGH;
case 0x08: { // Road Stop Class ID
RoadStopSpec **spec = &_cur.grffile->roadstops[id + i];
if (*spec == nullptr) {
*spec = CallocT<RoadStopSpec>(1);
new (*spec) RoadStopSpec();
if (rs == nullptr) {
_cur.grffile->roadstops[id + i] = std::make_unique<RoadStopSpec>();
rs = _cur.grffile->roadstops[id + i].get();
}
uint32 classid = buf->ReadDWord();
(*spec)->cls_id = RoadStopClass::Allocate(BSWAP32(classid));
(*spec)->spec_id = id + i;
rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid));
rs->spec_id = id + i;
break;
}
@@ -6485,7 +6454,7 @@ static void CanalMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->stations == nullptr) {
if (_cur.grffile->stations.empty()) {
grfmsg(1, "StationMapSpriteGroup: No stations defined, skipping");
return;
}
@@ -6505,7 +6474,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (ctype == CT_INVALID) continue;
for (uint i = 0; i < idcount; i++) {
StationSpec *statspec = stations[i] >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[stations[i]];
StationSpec *statspec = stations[i] >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[stations[i]].get();
if (statspec == nullptr) {
grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
@@ -6520,7 +6489,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
StationSpec *statspec = stations[i] >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[stations[i]];
StationSpec *statspec = stations[i] >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[stations[i]].get();
if (statspec == nullptr) {
grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
@@ -6542,7 +6511,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->housespec == nullptr) {
if (_cur.grffile->housespec.empty()) {
grfmsg(1, "TownHouseMapSpriteGroup: No houses defined, skipping");
return;
}
@@ -6560,7 +6529,7 @@ static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "TownHouseMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
HouseSpec *hs = houses[i] >= NUM_HOUSES_PER_GRF ? nullptr : _cur.grffile->housespec[houses[i]];
HouseSpec *hs = houses[i] >= _cur.grffile->housespec.size() ? nullptr : _cur.grffile->housespec[houses[i]].get();
if (hs == nullptr) {
grfmsg(1, "TownHouseMapSpriteGroup: House %d undefined, skipping.", houses[i]);
@@ -6573,7 +6542,7 @@ static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->industryspec == nullptr) {
if (_cur.grffile->industryspec.empty()) {
grfmsg(1, "IndustryMapSpriteGroup: No industries defined, skipping");
return;
}
@@ -6591,7 +6560,7 @@ static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "IndustryMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
IndustrySpec *indsp = industries[i] >= NUM_INDUSTRYTYPES_PER_GRF ? nullptr : _cur.grffile->industryspec[industries[i]];
IndustrySpec *indsp = industries[i] >= _cur.grffile->industryspec.size() ? nullptr : _cur.grffile->industryspec[industries[i]].get();
if (indsp == nullptr) {
grfmsg(1, "IndustryMapSpriteGroup: Industry %d undefined, skipping", industries[i]);
@@ -6604,7 +6573,7 @@ static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void IndustrytileMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->indtspec == nullptr) {
if (_cur.grffile->indtspec.empty()) {
grfmsg(1, "IndustrytileMapSpriteGroup: No industry tiles defined, skipping");
return;
}
@@ -6622,7 +6591,7 @@ static void IndustrytileMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "IndustrytileMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
IndustryTileSpec *indtsp = indtiles[i] >= NUM_INDUSTRYTILES_PER_GRF ? nullptr : _cur.grffile->indtspec[indtiles[i]];
IndustryTileSpec *indtsp = indtiles[i] >= _cur.grffile->indtspec.size() ? nullptr : _cur.grffile->indtspec[indtiles[i]].get();
if (indtsp == nullptr) {
grfmsg(1, "IndustrytileMapSpriteGroup: Industry tile %d undefined, skipping", indtiles[i]);
@@ -6716,7 +6685,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (ctype == CT_INVALID) continue;
for (uint i = 0; i < idcount; i++) {
ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]];
ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]].get();
if (spec == nullptr) {
grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]);
@@ -6731,7 +6700,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "ObjectMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]];
ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]].get();
if (spec == nullptr) {
grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]);
@@ -6815,7 +6784,7 @@ static void RoadTypeMapSpriteGroup(ByteReader *buf, uint8 idcount, RoadTramType
static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->airportspec == nullptr) {
if (_cur.grffile->airportspec.empty()) {
grfmsg(1, "AirportMapSpriteGroup: No airports defined, skipping");
return;
}
@@ -6833,7 +6802,7 @@ static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "AirportMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
AirportSpec *as = airports[i] >= NUM_AIRPORTS_PER_GRF ? nullptr : _cur.grffile->airportspec[airports[i]];
AirportSpec *as = airports[i] >= _cur.grffile->airportspec.size() ? nullptr : _cur.grffile->airportspec[airports[i]].get();
if (as == nullptr) {
grfmsg(1, "AirportMapSpriteGroup: Airport %d undefined, skipping", airports[i]);
@@ -6846,7 +6815,7 @@ static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount)
static void AirportTileMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
if (_cur.grffile->airtspec == nullptr) {
if (_cur.grffile->airtspec.empty()) {
grfmsg(1, "AirportTileMapSpriteGroup: No airport tiles defined, skipping");
return;
}
@@ -6864,7 +6833,7 @@ static void AirportTileMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (!IsValidGroupID(groupid, "AirportTileMapSpriteGroup")) return;
for (uint i = 0; i < idcount; i++) {
AirportTileSpec *airtsp = airptiles[i] >= NUM_AIRPORTTILES_PER_GRF ? nullptr : _cur.grffile->airtspec[airptiles[i]];
AirportTileSpec *airtsp = airptiles[i] >= _cur.grffile->airtspec.size() ? nullptr : _cur.grffile->airtspec[airptiles[i]].get();
if (airtsp == nullptr) {
grfmsg(1, "AirportTileMapSpriteGroup: Airport tile %d undefined, skipping", airptiles[i]);
@@ -6892,7 +6861,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8 idcount)
if (ctype == CT_INVALID) continue;
for (uint i = 0; i < idcount; i++) {
RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]];
RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]].get();
if (roadstopspec == nullptr) {
grfmsg(1, "RoadStopMapSpriteGroup: Road stop with ID 0x%02X does not exist, skipping", roadstops[i]);
@@ -6912,7 +6881,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8 idcount)
}
for (uint i = 0; i < idcount; i++) {
RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]];
RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]].get();
if (roadstopspec == nullptr) {
grfmsg(1, "RoadStopMapSpriteGroup: Road stop with ID 0x%02X does not exist, skipping.", roadstops[i]);
@@ -7156,7 +7125,7 @@ static void FeatureNewName(ByteReader *buf)
switch (GB(id, 8, 8)) {
case 0xC4: // Station class name
if (GB(id, 0, 8) >= NUM_STATIONS_PER_GRF || _cur.grffile->stations == nullptr || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) {
if (GB(id, 0, 8) >= _cur.grffile->stations.size() || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) {
grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
} else {
StationClassID cls_id = _cur.grffile->stations[GB(id, 0, 8)]->cls_id;
@@ -7165,7 +7134,7 @@ static void FeatureNewName(ByteReader *buf)
break;
case 0xC5: // Station name
if (GB(id, 0, 8) >= NUM_STATIONS_PER_GRF || _cur.grffile->stations == nullptr || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) {
if (GB(id, 0, 8) >= _cur.grffile->stations.size() || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) {
grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8));
} else {
_cur.grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED);
@@ -7173,7 +7142,7 @@ static void FeatureNewName(ByteReader *buf)
break;
case 0xC7: // Airporttile name
if (GB(id, 0, 8) >= NUM_AIRPORTTILES_PER_GRF || _cur.grffile->airtspec == nullptr || _cur.grffile->airtspec[GB(id, 0, 8)] == nullptr) {
if (GB(id, 0, 8) >= _cur.grffile->airtspec.size() || _cur.grffile->airtspec[GB(id, 0, 8)] == nullptr) {
grfmsg(1, "FeatureNewName: Attempt to name undefined airport tile 0x%X, ignoring", GB(id, 0, 8));
} else {
_cur.grffile->airtspec[GB(id, 0, 8)]->name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED);
@@ -7181,7 +7150,7 @@ static void FeatureNewName(ByteReader *buf)
break;
case 0xC9: // House name
if (GB(id, 0, 8) >= NUM_HOUSES_PER_GRF || _cur.grffile->housespec == nullptr || _cur.grffile->housespec[GB(id, 0, 8)] == nullptr) {
if (GB(id, 0, 8) >= _cur.grffile->housespec.size() || _cur.grffile->housespec[GB(id, 0, 8)] == nullptr) {
grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8));
} else {
_cur.grffile->housespec[GB(id, 0, 8)]->building_name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED);
@@ -8648,8 +8617,8 @@ static void FeatureTownName(ByteReader *buf)
bool new_scheme = _cur.grffile->grf_version >= 7;
byte lang = buf->ReadByte();
StringID style = STR_UNDEFINED;
byte nb_gen = townname->nb_gen;
do {
ClrBit(lang, 7);
@@ -8658,53 +8627,48 @@ static void FeatureTownName(ByteReader *buf)
std::string lang_name = TranslateTTDPatchCodes(grfid, lang, false, name);
grfmsg(6, "FeatureTownName: lang 0x%X -> '%s'", lang, lang_name.c_str());
townname->name[nb_gen] = AddGRFString(grfid, id, lang, new_scheme, false, name, STR_UNDEFINED);
style = AddGRFString(grfid, id, lang, new_scheme, false, name, STR_UNDEFINED);
lang = buf->ReadByte();
} while (lang != 0);
townname->id[nb_gen] = id;
townname->nb_gen++;
townname->styles.emplace_back(style, id);
}
byte nb = buf->ReadByte();
grfmsg(6, "FeatureTownName: %u parts", nb);
uint8 parts = buf->ReadByte();
grfmsg(6, "FeatureTownName: %u parts", parts);
townname->nbparts[id] = nb;
townname->partlist[id] = CallocT<NamePartList>(nb);
townname->partlists[id].reserve(parts);
for (uint partnum = 0; partnum < parts; partnum++) {
NamePartList &partlist = townname->partlists[id].emplace_back();
uint8 texts = buf->ReadByte();
partlist.bitstart = buf->ReadByte();
partlist.bitcount = buf->ReadByte();
partlist.maxprob = 0;
grfmsg(6, "FeatureTownName: part %u contains %u texts and will use GB(seed, %u, %u)", partnum, texts, partlist.bitstart, partlist.bitcount);
for (int i = 0; i < nb; i++) {
byte nbtext = buf->ReadByte();
townname->partlist[id][i].bitstart = buf->ReadByte();
townname->partlist[id][i].bitcount = buf->ReadByte();
townname->partlist[id][i].maxprob = 0;
townname->partlist[id][i].partcount = nbtext;
townname->partlist[id][i].parts = CallocT<NamePart>(nbtext);
grfmsg(6, "FeatureTownName: part %d contains %d texts and will use GB(seed, %d, %d)", i, nbtext, townname->partlist[id][i].bitstart, townname->partlist[id][i].bitcount);
partlist.parts.reserve(texts);
for (uint textnum = 0; textnum < texts; textnum++) {
NamePart &part = partlist.parts.emplace_back();
part.prob = buf->ReadByte();
for (int j = 0; j < nbtext; j++) {
byte prob = buf->ReadByte();
if (HasBit(prob, 7)) {
if (HasBit(part.prob, 7)) {
byte ref_id = buf->ReadByte();
if (townname->nbparts[ref_id] == 0) {
if (ref_id >= GRFTownName::MAX_LISTS || townname->partlists[ref_id].empty()) {
grfmsg(0, "FeatureTownName: definition 0x%02X doesn't exist, deactivating", ref_id);
DelGRFTownName(grfid);
DisableGrf(STR_NEWGRF_ERROR_INVALID_ID);
return;
}
grfmsg(6, "FeatureTownName: part %d, text %d, uses intermediate definition 0x%02X (with probability %d)", i, j, ref_id, prob & 0x7F);
townname->partlist[id][i].parts[j].data.id = ref_id;
part.id = ref_id;
grfmsg(6, "FeatureTownName: part %u, text %u, uses intermediate definition 0x%02X (with probability %u)", partnum, textnum, ref_id, part.prob & 0x7F);
} else {
const char *text = buf->ReadString();
townname->partlist[id][i].parts[j].data.text = stredup(TranslateTTDPatchCodes(grfid, 0, false, text).c_str());
grfmsg(6, "FeatureTownName: part %d, text %d, '%s' (with probability %d)", i, j, townname->partlist[id][i].parts[j].data.text, prob);
part.text = TranslateTTDPatchCodes(grfid, 0, false, text);
grfmsg(6, "FeatureTownName: part %u, text %u, '%s' (with probability %u)", partnum, textnum, part.text.c_str(), part.prob);
}
townname->partlist[id][i].parts[j].prob = prob;
townname->partlist[id][i].maxprob += GB(prob, 0, 7);
partlist.maxprob += GB(part.prob, 0, 7);
}
grfmsg(6, "FeatureTownName: part %d, total probability %d", i, townname->partlist[id][i].maxprob);
grfmsg(6, "FeatureTownName: part %u, total probability %u", partnum, partlist.maxprob);
}
}
@@ -10313,19 +10277,7 @@ bool HasTTDPatchFlagBeenObserved(uint flag)
static void ResetCustomStations()
{
for (GRFFile * const file : _grf_files) {
StationSpec **&stations = file->stations;
if (stations == nullptr) continue;
for (uint i = 0; i < NUM_STATIONS_PER_GRF; i++) {
if (stations[i] == nullptr) continue;
StationSpec *statspec = stations[i];
/* Release this station */
delete statspec;
}
/* Free and reset the station data */
free(stations);
stations = nullptr;
file->stations.clear();
}
}
@@ -10333,14 +10285,7 @@ static void ResetCustomStations()
static void ResetCustomHouses()
{
for (GRFFile * const file : _grf_files) {
HouseSpec **&housespec = file->housespec;
if (housespec == nullptr) continue;
for (uint i = 0; i < NUM_HOUSES_PER_GRF; i++) {
free(housespec[i]);
}
free(housespec);
housespec = nullptr;
file->housespec.clear();
}
}
@@ -10348,36 +10293,20 @@ static void ResetCustomHouses()
static void ResetCustomAirports()
{
for (GRFFile * const file : _grf_files) {
AirportSpec **aslist = file->airportspec;
if (aslist != nullptr) {
for (uint i = 0; i < NUM_AIRPORTS_PER_GRF; i++) {
AirportSpec *as = aslist[i];
if (as != nullptr) {
/* We need to remove the tiles layouts */
for (int j = 0; j < as->num_table; j++) {
/* remove the individual layouts */
free(as->table[j]);
}
free(as->table);
free(as->depot_table);
free(as->rotation);
free(as);
for (auto &as : file->airportspec) {
if (as != nullptr) {
/* We need to remove the tiles layouts */
for (int j = 0; j < as->num_table; j++) {
/* remove the individual layouts */
free(as->table[j]);
}
free(as->table);
free(as->depot_table);
free(as->rotation);
}
free(aslist);
file->airportspec = nullptr;
}
AirportTileSpec **&airporttilespec = file->airtspec;
if (airporttilespec != nullptr) {
for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) {
free(airporttilespec[i]);
}
free(airporttilespec);
airporttilespec = nullptr;
}
file->airportspec.clear();
file->airtspec.clear();
}
}
@@ -10385,28 +10314,8 @@ static void ResetCustomAirports()
static void ResetCustomIndustries()
{
for (GRFFile * const file : _grf_files) {
IndustrySpec **&industryspec = file->industryspec;
IndustryTileSpec **&indtspec = file->indtspec;
/* We are verifiying both tiles and industries specs loaded from the grf file
* First, let's deal with industryspec */
if (industryspec != nullptr) {
for (uint i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) {
IndustrySpec *ind = industryspec[i];
delete ind;
}
free(industryspec);
industryspec = nullptr;
}
if (indtspec == nullptr) continue;
for (uint i = 0; i < NUM_INDUSTRYTILES_PER_GRF; i++) {
free(indtspec[i]);
}
free(indtspec);
indtspec = nullptr;
file->industryspec.clear();
file->indtspec.clear();
}
}
@@ -10414,24 +10323,14 @@ static void ResetCustomIndustries()
static void ResetCustomObjects()
{
for (GRFFile * const file : _grf_files) {
std::vector<ObjectSpec *> &objectspec = file->objectspec;
for (ObjectSpec *spec : objectspec) {
free(spec);
}
objectspec.clear();
file->objectspec.clear();
}
}
static void ResetCustomRoadStops()
{
for (auto file : _grf_files) {
std::vector<RoadStopSpec *> &roadstops = file->roadstops;
for (RoadStopSpec *spec : roadstops) {
free(spec);
}
roadstops.clear();
file->roadstops.clear();
}
}
@@ -10482,7 +10381,7 @@ void ResetNewGRFData()
ResetRoadTypes();
/* Allocate temporary refit/cargo class data */
_gted = CallocT<GRFTempEngineData>(Engine::GetPoolSize());
_gted.resize(Engine::GetPoolSize());
/* Fill rail type label temporary data for default trains */
for (const Engine *e : Engine::IterateType(VEH_TRAIN)) {
@@ -11021,17 +10920,17 @@ static void FinaliseHouseArray()
* minimum introduction date to 0.
*/
for (GRFFile * const file : _grf_files) {
HouseSpec **&housespec = file->housespec;
if (housespec == nullptr) continue;
if (file->housespec.empty()) continue;
for (int i = 0; i < NUM_HOUSES_PER_GRF; i++) {
HouseSpec *hs = housespec[i];
size_t num_houses = file->housespec.size();
for (size_t i = 0; i < num_houses; i++) {
HouseSpec *hs = file->housespec[i].get();
if (hs == nullptr) continue;
const HouseSpec *next1 = (i + 1 < NUM_HOUSES_PER_GRF ? housespec[i + 1] : nullptr);
const HouseSpec *next2 = (i + 2 < NUM_HOUSES_PER_GRF ? housespec[i + 2] : nullptr);
const HouseSpec *next3 = (i + 3 < NUM_HOUSES_PER_GRF ? housespec[i + 3] : nullptr);
const HouseSpec *next1 = (i + 1 < num_houses ? file->housespec[i + 1].get() : nullptr);
const HouseSpec *next2 = (i + 2 < num_houses ? file->housespec[i + 2].get() : nullptr);
const HouseSpec *next3 = (i + 3 < num_houses ? file->housespec[i + 3].get() : nullptr);
if (!IsHouseSpecValid(hs, next1, next2, next3, file->filename)) continue;
@@ -11039,7 +10938,7 @@ static void FinaliseHouseArray()
}
}
for (int i = 0; i < NUM_HOUSES; i++) {
for (size_t i = 0; i < NUM_HOUSES; i++) {
HouseSpec *hs = HouseSpec::Get(i);
const HouseSpec *next1 = (i + 1 < NUM_HOUSES ? HouseSpec::Get(i + 1) : nullptr);
const HouseSpec *next2 = (i + 2 < NUM_HOUSES ? HouseSpec::Get(i + 2) : nullptr);
@@ -11083,50 +10982,41 @@ static void FinaliseHouseArray()
static void FinaliseIndustriesArray()
{
for (GRFFile * const file : _grf_files) {
IndustrySpec **&industryspec = file->industryspec;
IndustryTileSpec **&indtspec = file->indtspec;
if (industryspec != nullptr) {
for (int i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) {
IndustrySpec *indsp = industryspec[i];
for (const auto &indsp : file->industryspec) {
if (indsp == nullptr || !indsp->enabled) continue;
if (indsp != nullptr && indsp->enabled) {
StringID strid;
/* process the conversion of text at the end, so to be sure everything will be fine
* and available. Check if it does not return undefind marker, which is a very good sign of a
* substitute industry who has not changed the string been examined, thus using it as such */
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->name);
if (strid != STR_UNDEFINED) indsp->name = strid;
StringID strid;
/* process the conversion of text at the end, so to be sure everything will be fine
* and available. Check if it does not return undefind marker, which is a very good sign of a
* substitute industry who has not changed the string been examined, thus using it as such */
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->name);
if (strid != STR_UNDEFINED) indsp->name = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->closure_text);
if (strid != STR_UNDEFINED) indsp->closure_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->closure_text);
if (strid != STR_UNDEFINED) indsp->closure_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_up_text);
if (strid != STR_UNDEFINED) indsp->production_up_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_up_text);
if (strid != STR_UNDEFINED) indsp->production_up_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_down_text);
if (strid != STR_UNDEFINED) indsp->production_down_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_down_text);
if (strid != STR_UNDEFINED) indsp->production_down_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->new_industry_text);
if (strid != STR_UNDEFINED) indsp->new_industry_text = strid;
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->new_industry_text);
if (strid != STR_UNDEFINED) indsp->new_industry_text = strid;
if (indsp->station_name != STR_NULL) {
/* STR_NULL (0) can be set by grf. It has a meaning regarding assignation of the
* station's name. Don't want to lose the value, therefore, do not process. */
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->station_name);
if (strid != STR_UNDEFINED) indsp->station_name = strid;
}
_industry_mngr.SetEntitySpec(indsp);
}
if (indsp->station_name != STR_NULL) {
/* STR_NULL (0) can be set by grf. It has a meaning regarding assignation of the
* station's name. Don't want to lose the value, therefore, do not process. */
strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->station_name);
if (strid != STR_UNDEFINED) indsp->station_name = strid;
}
_industry_mngr.SetEntitySpec(indsp.get());
}
if (indtspec != nullptr) {
for (int i = 0; i < NUM_INDUSTRYTILES_PER_GRF; i++) {
IndustryTileSpec *indtsp = indtspec[i];
if (indtsp != nullptr) {
_industile_mngr.SetEntitySpec(indtsp);
}
for (const auto &indtsp : file->indtspec) {
if (indtsp != nullptr) {
_industile_mngr.SetEntitySpec(indtsp.get());
}
}
}
@@ -11152,9 +11042,9 @@ static void FinaliseIndustriesArray()
static void FinaliseObjectsArray()
{
for (GRFFile * const file : _grf_files) {
for (ObjectSpec *spec : file->objectspec) {
if (spec != nullptr && spec->grf_prop.grffile != nullptr && spec->IsEnabled()) {
_object_mngr.SetEntitySpec(spec);
for (auto &objectspec : file->objectspec) {
if (objectspec != nullptr && objectspec->grf_prop.grffile != nullptr && objectspec->IsEnabled()) {
_object_mngr.SetEntitySpec(objectspec.get());
}
}
}
@@ -11170,21 +11060,15 @@ static void FinaliseObjectsArray()
static void FinaliseAirportsArray()
{
for (GRFFile * const file : _grf_files) {
AirportSpec **&airportspec = file->airportspec;
if (airportspec != nullptr) {
for (int i = 0; i < NUM_AIRPORTS_PER_GRF; i++) {
if (airportspec[i] != nullptr && airportspec[i]->enabled) {
_airport_mngr.SetEntitySpec(airportspec[i]);
}
for (auto &as : file->airportspec) {
if (as != nullptr && as->enabled) {
_airport_mngr.SetEntitySpec(as.get());
}
}
AirportTileSpec **&airporttilespec = file->airtspec;
if (airporttilespec != nullptr) {
for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) {
if (airporttilespec[i] != nullptr && airporttilespec[i]->enabled) {
_airporttile_mngr.SetEntitySpec(airporttilespec[i]);
}
for (auto &ats : file->airtspec) {
if (ats != nullptr && ats->enabled) {
_airporttile_mngr.SetEntitySpec(ats.get());
}
}
}
@@ -11692,7 +11576,7 @@ static void AfterLoadGRFs()
FinalisePriceBaseMultipliers();
/* Deallocate temporary loading data */
free(_gted);
_gted.clear();
_grm_sprites.clear();
}