|
|
|
@ -25,6 +25,9 @@
|
|
|
|
|
static byte _old_last_vehicle_type;
|
|
|
|
|
static uint8 _num_specs;
|
|
|
|
|
static uint8 _num_roadstop_specs;
|
|
|
|
|
static uint32 _num_roadstop_custom_tiles;
|
|
|
|
|
static std::vector<TileIndex> _custom_road_stop_tiles;
|
|
|
|
|
static std::vector<uint16> _custom_road_stop_data;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the buoy orders to be waypoint orders.
|
|
|
|
@ -414,8 +417,9 @@ static const SaveLoad _base_station_desc[] = {
|
|
|
|
|
SLE_VAR(BaseStation, waiting_triggers, SLE_UINT8),
|
|
|
|
|
SLEG_VAR(_num_specs, SLE_UINT8),
|
|
|
|
|
SLEG_CONDVAR_X(_num_roadstop_specs, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS)),
|
|
|
|
|
SLE_CONDVARVEC_X(BaseStation, custom_road_stop_tiles, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS)),
|
|
|
|
|
SLE_CONDVARVEC_X(BaseStation, custom_road_stop_data, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS)),
|
|
|
|
|
SLEG_CONDVARVEC_X(_custom_road_stop_tiles, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS, 1, 1)),
|
|
|
|
|
SLEG_CONDVARVEC_X(_custom_road_stop_data, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS, 1, 1)),
|
|
|
|
|
SLEG_CONDVAR_X(_num_roadstop_custom_tiles, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GRF_ROADSTOPS, 2)),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static OldPersistentStorage _old_st_persistent_storage;
|
|
|
|
@ -481,6 +485,12 @@ static const SaveLoad _waypoint_desc[] = {
|
|
|
|
|
SLE_CONDVAR_X(Waypoint, road_waypoint_area.h, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_ROAD_WAYPOINTS)),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const SaveLoad _custom_roadstop_tile_data_desc[] = {
|
|
|
|
|
SLE_VAR(RoadStopTileData, tile, SLE_UINT32),
|
|
|
|
|
SLE_VAR(RoadStopTileData, random_bits, SLE_UINT8),
|
|
|
|
|
SLE_VAR(RoadStopTileData, animation_frame, SLE_UINT8),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the base station description to be used for SL_ST_INCLUDE
|
|
|
|
|
* @return the base station description.
|
|
|
|
@ -515,6 +525,7 @@ static void RealSave_STNN(BaseStation *bst)
|
|
|
|
|
{
|
|
|
|
|
_num_specs = (uint8)bst->speclist.size();
|
|
|
|
|
_num_roadstop_specs = (uint8)bst->roadstop_speclist.size();
|
|
|
|
|
_num_roadstop_custom_tiles = (uint32)bst->custom_roadstop_tile_data.size();
|
|
|
|
|
|
|
|
|
|
bool waypoint = (bst->facilities & FACIL_WAYPOINT) != 0;
|
|
|
|
|
SlObjectSaveFiltered(bst, waypoint ? SaveLoadTable(_filtered_waypoint_desc) : SaveLoadTable(_filtered_station_desc));
|
|
|
|
@ -575,6 +586,10 @@ static void RealSave_STNN(BaseStation *bst)
|
|
|
|
|
for (uint i = 0; i < bst->roadstop_speclist.size(); i++) {
|
|
|
|
|
SlObjectSaveFiltered(&bst->roadstop_speclist[i], _filtered_station_speclist_desc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < bst->custom_roadstop_tile_data.size(); i++) {
|
|
|
|
|
SlObjectSaveFiltered(&bst->custom_roadstop_tile_data[i], _custom_roadstop_tile_data_desc); // _custom_roadstop_tile_data_desc has no conditionals
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Save_STNN()
|
|
|
|
@ -595,6 +610,7 @@ static void Load_STNN()
|
|
|
|
|
_num_flows = 0;
|
|
|
|
|
_num_specs = 0;
|
|
|
|
|
_num_roadstop_specs = 0;
|
|
|
|
|
_num_roadstop_custom_tiles = 0;
|
|
|
|
|
|
|
|
|
|
const uint num_cargo = IsSavegameVersionBefore(SLV_EXTEND_CARGOTYPES) ? 32 : NUM_CARGO;
|
|
|
|
|
ReadBuffer *buffer = ReadBuffer::GetCurrent();
|
|
|
|
@ -714,6 +730,22 @@ static void Load_STNN()
|
|
|
|
|
SlObjectLoadFiltered(&bst->roadstop_speclist[i], _filtered_station_speclist_desc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_num_roadstop_custom_tiles != 0) {
|
|
|
|
|
/* Allocate custom road stop tile data memory when loading a game */
|
|
|
|
|
bst->custom_roadstop_tile_data.resize(_num_roadstop_custom_tiles);
|
|
|
|
|
for (uint i = 0; i < bst->custom_roadstop_tile_data.size(); i++) {
|
|
|
|
|
SlObjectLoadFiltered(&bst->custom_roadstop_tile_data[i], _custom_roadstop_tile_data_desc); // _custom_roadstop_tile_data_desc has no conditionals
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SlXvIsFeaturePresent(XSLFI_GRF_ROADSTOPS, 1, 1)) {
|
|
|
|
|
for (size_t i = 0; i < _custom_road_stop_tiles.size(); i++) {
|
|
|
|
|
bst->custom_roadstop_tile_data.push_back({ _custom_road_stop_tiles[i], (uint8)GB(_custom_road_stop_data[i], 0, 8), (uint8)GB(_custom_road_stop_data[i], 8, 8) });
|
|
|
|
|
}
|
|
|
|
|
_custom_road_stop_tiles.clear();
|
|
|
|
|
_custom_road_stop_data.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|