mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix export
This commit is contained in:
parent
81d7c3f02b
commit
c9777535d6
|
@ -1248,7 +1248,7 @@ static int32_t cc_remove_park_fences(InteractiveConsole& console, [[maybe_unused
|
|||
static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||
{
|
||||
const auto& tileElements = GetTileElements();
|
||||
int32_t tileElementCount = tileElements.size();
|
||||
const auto tileElementCount = tileElements.size();
|
||||
|
||||
int32_t rideCount = ride_get_count();
|
||||
int32_t spriteCount = 0;
|
||||
|
@ -1270,7 +1270,7 @@ static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] cons
|
|||
}
|
||||
|
||||
console.WriteFormatLine("Sprites: %d/%d", spriteCount, MAX_ENTITIES);
|
||||
console.WriteFormatLine("Map Elements: %d/%d", tileElementCount, MAX_TILE_ELEMENTS);
|
||||
console.WriteFormatLine("Map Elements: %zu/%d", tileElementCount, MAX_TILE_ELEMENTS);
|
||||
console.WriteFormatLine("Banners: %d/%zu", bannerCount, MAX_BANNERS);
|
||||
console.WriteFormatLine("Rides: %d/%d", rideCount, MAX_RIDES);
|
||||
console.WriteFormatLine("Staff: %d/%d", staffCount, STAFF_MAX_COUNT);
|
||||
|
|
|
@ -194,8 +194,7 @@ void S6Exporter::Export()
|
|||
_s6.scenario_srand_0 = state.s0;
|
||||
_s6.scenario_srand_1 = state.s1;
|
||||
|
||||
// Map elements must be reorganised prior to saving otherwise save may be invalid
|
||||
map_reorganise_elements();
|
||||
ReorganiseTileElements();
|
||||
ExportTileElements();
|
||||
ExportEntities();
|
||||
ExportParkName();
|
||||
|
@ -419,8 +418,8 @@ void S6Exporter::Export()
|
|||
|
||||
// pad_13CE730
|
||||
// rct1_scenario_flags
|
||||
_s6.wide_path_tile_loop_x = gWidePathTileLoopX;
|
||||
_s6.wide_path_tile_loop_y = gWidePathTileLoopY;
|
||||
_s6.wide_path_tile_loop_x = gWidePathTileLoopPosition.x;
|
||||
_s6.wide_path_tile_loop_y = gWidePathTileLoopPosition.y;
|
||||
// pad_13CE778
|
||||
|
||||
String::Set(_s6.scenario_filename, sizeof(_s6.scenario_filename), gScenarioFileName);
|
||||
|
@ -1580,10 +1579,16 @@ void S6Exporter::ExportMapAnimations()
|
|||
|
||||
void S6Exporter::ExportTileElements()
|
||||
{
|
||||
const auto& tileElements = GetTileElements();
|
||||
for (uint32_t index = 0; index < RCT2_MAX_TILE_ELEMENTS; index++)
|
||||
{
|
||||
auto src = &gTileElements[index];
|
||||
auto dst = &_s6.tile_elements[index];
|
||||
if (index >= tileElements.size())
|
||||
{
|
||||
dst = {};
|
||||
continue;
|
||||
}
|
||||
auto src = &tileElements[index];
|
||||
if (src->base_height == MAX_ELEMENT_HEIGHT)
|
||||
{
|
||||
std::memcpy(dst, src, sizeof(*dst));
|
||||
|
@ -1598,10 +1603,10 @@ void S6Exporter::ExportTileElements()
|
|||
ExportTileElement(dst, src);
|
||||
}
|
||||
}
|
||||
_s6.next_free_tile_element_pointer_index = gNextFreeTileElementPointerIndex;
|
||||
_s6.next_free_tile_element_pointer_index = static_cast<uint32_t>(tileElements.size());
|
||||
}
|
||||
|
||||
void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
void S6Exporter::ExportTileElement(RCT12TileElement* dst, const TileElement* src)
|
||||
{
|
||||
// Todo: allow for changing definition of OpenRCT2 tile element types - replace with a map
|
||||
uint8_t tileElementType = src->GetType();
|
||||
|
@ -1852,7 +1857,6 @@ int32_t scenario_save(const utf8* path, int32_t flags)
|
|||
window_close_construction_windows();
|
||||
}
|
||||
|
||||
map_reorganise_elements();
|
||||
viewport_set_saved_view();
|
||||
|
||||
bool result = false;
|
||||
|
|
|
@ -73,7 +73,7 @@ private:
|
|||
void ExportMapAnimations();
|
||||
|
||||
void ExportTileElements();
|
||||
void ExportTileElement(RCT12TileElement* dst, TileElement* src);
|
||||
void ExportTileElement(RCT12TileElement* dst, const TileElement* src);
|
||||
|
||||
std::optional<uint16_t> AllocateUserString(std::string_view value);
|
||||
void ExportUserStrings();
|
||||
|
|
|
@ -1004,7 +1004,7 @@ void tile_element_remove(TileElement* tileElement)
|
|||
(tileElement - 1)->SetLastForTile(true);
|
||||
tileElement->base_height = MAX_ELEMENT_HEIGHT;
|
||||
|
||||
if ((tileElement + 1) == &_tileElements[_tileElements.size()])
|
||||
if (tileElement == &_tileElements.back())
|
||||
{
|
||||
_tileElements.pop_back();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue