mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Fix crash and address most line notes
This commit is contained in:
@@ -183,18 +183,19 @@ public:
|
||||
|
||||
rct_tile_element* newElement = tile_element_insert(entranceLoc.x / 32, entranceLoc.y / 32, zLow, 0xF);
|
||||
Guard::Assert(newElement != nullptr);
|
||||
newElement->clearance_height = zHigh;
|
||||
newElement->ClearAs(TILE_ELEMENT_TYPE_ENTRANCE);
|
||||
auto entranceElement = newElement->AsEntrance();
|
||||
entranceElement->clearance_height = zHigh;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
newElement->flags |= TILE_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
|
||||
newElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE);
|
||||
newElement->SetDirection(_direction);
|
||||
newElement->AsEntrance()->SetSequenceIndex(index);
|
||||
newElement->AsEntrance()->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
|
||||
newElement->AsEntrance()->SetPathType(gFootpathSelectedId);
|
||||
entranceElement->SetDirection(_direction);
|
||||
entranceElement->SetSequenceIndex(index);
|
||||
entranceElement->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
|
||||
entranceElement->SetPathType(gFootpathSelectedId);
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
|
||||
@@ -80,13 +80,13 @@ static money32 BannerRemove(int16_t x, int16_t y, uint8_t baseHeight, uint8_t di
|
||||
|
||||
// Slight modification to the code so that it now checks height as well
|
||||
// This was causing a bug with banners on two paths stacked.
|
||||
rct_tile_element* tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
|
||||
BannerElement* tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_banner* banner = &gBanners[tileElement->AsBanner()->GetIndex()];
|
||||
rct_banner* banner = &gBanners[tileElement->GetIndex()];
|
||||
rct_scenery_entry* bannerEntry = get_banner_entry(banner->type);
|
||||
money32 refund = 0;
|
||||
if (bannerEntry != nullptr)
|
||||
@@ -105,9 +105,9 @@ static money32 BannerRemove(int16_t x, int16_t y, uint8_t baseHeight, uint8_t di
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
tile_element_remove_banner_entry(tileElement);
|
||||
tile_element_remove_banner_entry((rct_tile_element*)tileElement);
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 32);
|
||||
tile_element_remove(tileElement);
|
||||
tileElement->Remove();
|
||||
}
|
||||
|
||||
if (gParkFlags & PARK_FLAGS_NO_MONEY)
|
||||
@@ -217,8 +217,8 @@ static money32 BannerPlace(
|
||||
}
|
||||
|
||||
uint8_t baseHeight = (pathBaseHeight + 1) * 2;
|
||||
tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
|
||||
if (tileElement != nullptr)
|
||||
BannerElement* bannerElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
|
||||
if (bannerElement != nullptr)
|
||||
{
|
||||
gGameCommandErrorText = STR_BANNER_SIGN_IN_THE_WAY;
|
||||
return MONEY32_UNDEFINED;
|
||||
@@ -247,7 +247,7 @@ static money32 BannerPlace(
|
||||
gBanners[*bannerIndex].colour = colour;
|
||||
gBanners[*bannerIndex].x = x / 32;
|
||||
gBanners[*bannerIndex].y = y / 32;
|
||||
newTileElement->ClearAs(TILE_ELEMENT_TYPE_BANNER);
|
||||
newTileElement->SetType(TILE_ELEMENT_TYPE_BANNER);
|
||||
newTileElement->clearance_height = newTileElement->base_height + 2;
|
||||
newTileElement->AsBanner()->SetPosition(direction);
|
||||
newTileElement->AsBanner()->ResetAllowedEdges();
|
||||
|
||||
@@ -307,7 +307,7 @@ rct_tile_element* map_get_path_element_at(int32_t x, int32_t y, int32_t z)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t position)
|
||||
BannerElement* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t position)
|
||||
{
|
||||
rct_tile_element* tileElement = map_get_first_element_at(x, y);
|
||||
|
||||
@@ -324,7 +324,7 @@ rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uin
|
||||
if (tileElement->AsBanner()->GetPosition() != position)
|
||||
continue;
|
||||
|
||||
return tileElement;
|
||||
return tileElement->AsBanner();
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -135,7 +135,7 @@ rct_tile_element* map_get_first_element_at(int32_t x, int32_t y);
|
||||
rct_tile_element* map_get_nth_element_at(int32_t x, int32_t y, int32_t n);
|
||||
void map_set_tile_elements(int32_t x, int32_t y, rct_tile_element* elements);
|
||||
int32_t map_height_from_slope(int32_t x, int32_t y, int32_t slope);
|
||||
rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t direction);
|
||||
BannerElement* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t direction);
|
||||
rct_tile_element* map_get_surface_element_at(int32_t x, int32_t y);
|
||||
rct_tile_element* map_get_surface_element_at(CoordsXY coords);
|
||||
rct_tile_element* map_get_path_element_at(int32_t x, int32_t y, int32_t z);
|
||||
|
||||
@@ -1029,16 +1029,16 @@ int32_t tile_inspector_scenery_set_quarter_collision(
|
||||
|
||||
int32_t tile_inspector_banner_toggle_blocking_edge(int32_t x, int32_t y, int32_t elementIndex, int32_t edgeIndex, int32_t flags)
|
||||
{
|
||||
BannerElement* const bannerElement = map_get_nth_element_at(x, y, elementIndex)->AsBanner();
|
||||
rct_tile_element* const bannerElement = map_get_nth_element_at(x, y, elementIndex);
|
||||
|
||||
if (bannerElement == nullptr)
|
||||
if (bannerElement == nullptr || bannerElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
uint8_t edges = bannerElement->GetAllowedEdges();
|
||||
uint8_t edges = bannerElement->AsBanner()->GetAllowedEdges();
|
||||
edges ^= (1 << edgeIndex);
|
||||
bannerElement->SetAllowedEdges(edges);
|
||||
bannerElement->AsBanner()->SetAllowedEdges(edges);
|
||||
|
||||
if ((uint32_t)x == windowTileInspectorTileX && (uint32_t)y == windowTileInspectorTileY)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user