MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ImportTileElement

Method ImportTileElement

src/openrct2/rct2/S6Importer.cpp:1318–1599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1316 }
1317
1318 void ImportTileElement(TileElement* dst, const RCT12TileElement* src, bool invisible)
1319 {
1320 const auto rct12Type = src->getType();
1321 dst->ClearAs(ToOpenRCT2TileElementType(rct12Type));
1322 dst->setDirection(src->getDirection());
1323 dst->setBaseZ(src->baseHeight * kCoordsZStep);
1324 dst->setClearanceZ(src->clearanceHeight * kCoordsZStep);
1325
1326 // All saved in "flags"
1327 dst->setOccupiedQuadrants(src->getOccupiedQuadrants());
1328 dst->setGhost(src->isGhost());
1329 dst->setLastForTile(src->isLastForTile());
1330 dst->setInvisible(invisible);
1331
1332 switch (rct12Type)
1333 {
1334 case RCT12TileElementType::surface:
1335 {
1336 auto dst2 = dst->asSurface();
1337 auto src2 = src->asSurface();
1338
1339 dst2->SetSlope(src2->GetSlope());
1340
1341 dst2->SetSurfaceObjectIndex(src2->GetSurfaceStyle());
1342 dst2->SetEdgeObjectIndex(src2->GetEdgeStyle());
1343
1344 dst2->SetGrassLength(src2->GetGrassLength());
1345 dst2->SetOwnership(src2->GetOwnership());
1346 dst2->SetParkFences(src2->GetParkFences());
1347 dst2->SetWaterHeight(src2->GetWaterHeight());
1348 dst2->SetHasTrackThatNeedsWater(src2->HasTrackThatNeedsWater());
1349
1350 break;
1351 }
1352 case RCT12TileElementType::path:
1353 {
1354 auto dst2 = dst->asPath();
1355 auto src2 = src->asPath();
1356
1357 auto pathEntryIndex = src2->GetEntryIndex();
1358 auto surfaceEntry = src2->IsQueue() ? _pathToQueueSurfaceMap[pathEntryIndex]
1359 : _pathToSurfaceMap[pathEntryIndex];
1360 if (surfaceEntry == kObjectEntryIndexNull)
1361 {
1362 // Legacy footpath object
1363 dst2->SetLegacyPathEntryIndex(pathEntryIndex);
1364 }
1365 else
1366 {
1367 // Surface / railing
1368 dst2->SetSurfaceEntryIndex(surfaceEntry);
1369 dst2->SetRailingsEntryIndex(_pathToRailingMap[pathEntryIndex]);
1370 }
1371
1372 dst2->SetQueueBannerDirection(src2->GetQueueBannerDirection());
1373 dst2->SetSloped(src2->IsSloped());
1374 dst2->SetSlopeDirection(src2->GetSlopeDirection());
1375 dst2->SetRideIndex(RCT12RideIdToOpenRCT2RideId(src2->GetRideIndex()));

Callers

nothing calls this directly

Calls 15

RCT2TrackTypeToOpenRCT2Function · 0.85
GetOrCreateBannerFunction · 0.85
ClearAsMethod · 0.80
setDirectionMethod · 0.80
setBaseZMethod · 0.80
setClearanceZMethod · 0.80
setOccupiedQuadrantsMethod · 0.80
setGhostMethod · 0.80
setLastForTileMethod · 0.80

Tested by

no test coverage detected