1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix scenery eye dropper checks

This commit is contained in:
Michał Janiszewski
2017-04-24 23:22:59 +02:00
parent 79cbb179c3
commit dcb1b8651b

View File

@@ -1021,7 +1021,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, sint16 widgetIndex)
{
sint32 entryIndex = mapElement->properties.scenery.type;
rct_scenery_entry * sceneryEntry = get_small_scenery_entry(entryIndex);
if (sceneryEntry != NULL || sceneryEntry != (rct_scenery_entry *)-1) {
if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) {
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_SMALL_SCENERY, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
gWindowSceneryRotation = (get_current_rotation() + map_element_get_direction(mapElement)) & 3;
@@ -1036,7 +1036,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, sint16 widgetIndex)
{
sint32 entryIndex = mapElement->properties.wall.type;
rct_scenery_entry * sceneryEntry = get_wall_entry(entryIndex);
if (sceneryEntry != NULL || sceneryEntry != (rct_scenery_entry *)-1) {
if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) {
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
gWindowSceneryPrimaryColour = mapElement->properties.wall.colour_1 & 0x1F;
@@ -1051,7 +1051,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, sint16 widgetIndex)
{
sint32 entryIndex = mapElement->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK;
rct_scenery_entry * sceneryEntry = get_large_scenery_entry(entryIndex);
if (sceneryEntry != NULL || sceneryEntry != (rct_scenery_entry *)-1) {
if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) {
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_LARGE_SCENERY, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
gWindowSceneryRotation = (get_current_rotation() + map_element_get_direction(mapElement)) & 3;
@@ -1067,7 +1067,7 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, sint16 widgetIndex)
sint32 bannerIndex = mapElement->properties.banner.index;
rct_banner *banner = &gBanners[bannerIndex];
rct_scenery_entry * sceneryEntry = get_banner_entry(banner->type);
if (sceneryEntry != NULL || sceneryEntry != (rct_scenery_entry *)-1) {
if (sceneryEntry != NULL && sceneryEntry != (rct_scenery_entry *)-1) {
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_BANNERS, banner->type);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
gWindowSceneryEyedropperEnabled = false;