mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge remote-tracking branch 'upstream/develop' into new-save-format
This commit is contained in:
commit
8f97730a5e
|
@ -223,6 +223,7 @@ GameActions::Result::Ptr RideSetSettingAction::Execute() const
|
||||||
break;
|
break;
|
||||||
case RideSetSetting::RideType:
|
case RideSetSetting::RideType:
|
||||||
ride->type = _value;
|
ride->type = _value;
|
||||||
|
ride->UpdateRideTypeForAllPieces();
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5740,6 +5740,32 @@ void Ride::IncreaseNumShelteredSections()
|
||||||
num_sheltered_sections |= newNumShelteredSections;
|
num_sheltered_sections |= newNumShelteredSections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ride::UpdateRideTypeForAllPieces()
|
||||||
|
{
|
||||||
|
for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
|
||||||
|
{
|
||||||
|
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
|
||||||
|
{
|
||||||
|
auto* tileElement = map_get_first_element_at(TileCoordsXY(x, y));
|
||||||
|
if (tileElement == nullptr)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
auto* trackElement = tileElement->AsTrack();
|
||||||
|
if (trackElement->GetRideIndex() != id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
trackElement->SetRideType(type);
|
||||||
|
|
||||||
|
} while (!(tileElement++)->IsLastForTile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<ride_id_t> GetTracklessRides()
|
std::vector<ride_id_t> GetTracklessRides()
|
||||||
{
|
{
|
||||||
// Iterate map and build list of seen ride IDs
|
// Iterate map and build list of seen ride IDs
|
||||||
|
|
|
@ -469,6 +469,11 @@ public:
|
||||||
void IncreaseNumShelteredSections();
|
void IncreaseNumShelteredSections();
|
||||||
|
|
||||||
void RemoveVehicles();
|
void RemoveVehicles();
|
||||||
|
/**
|
||||||
|
* Updates all pieces of the ride to match the internal ride type. (Track pieces can have different ride types from the ride
|
||||||
|
* they belong to, to enable “merging”.)
|
||||||
|
*/
|
||||||
|
void UpdateRideTypeForAllPieces();
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
Loading…
Reference in New Issue