Fix #8248: Invalid tile element in footpath_element_insert (#8249)

* Fix #8248: Invalid tile element in footpath_element_insert

* Update Footpath.cpp
This commit is contained in:
Michał Janiszewski authored and GitHub committed 2018-11-11 19:17:08 +01:00
1 parent 6deb5daf86
commit 7582afe0b4
1 file changed
+5
+5
View File
@@ -247,6 +247,11 @@ static money32 footpath_element_insert(
tileElement = map_get_surface_element_at({ x, y });
if (tileElement == nullptr)
{
return MONEY32_UNDEFINED;
}
int32_t supportHeight = z - tileElement->base_height;
gFootpathPrice += supportHeight < 0 ? MONEY(20, 00) : (supportHeight / 2) * MONEY(5, 00);