1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Return more useful error messages.

Fix clearance checks always being on for underground placement
This commit is contained in:
duncanspumpkin
2019-04-05 19:34:03 +01:00
parent d63919c0cc
commit 00cbd75641
2 changed files with 7 additions and 9 deletions

View File

@@ -1889,14 +1889,14 @@ static void window_top_toolbar_scenery_tool_down(int16_t x, int16_t y, rct_windo
CoordsXYZD loc = { gridX, gridY, gSceneryPlaceZ, (parameter_1 & 0xFF00) >> 8 };
auto sceneryPlaceAction = LargeSceneryPlaceAction(loc, largeSceneryType, primaryColour, secondaryColour);
sceneryPlaceAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
sceneryPlaceAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
if (result->Error == GA_ERROR::OK)
{
audio_play_sound_at_location(SOUND_PLACE_ITEM, result->Position.x, result->Position.y, result->Position.z);
}
else
{
audio_play_sound_at_location(SOUND_ERROR, result->Position.x, result->Position.y, result->Position.z);
audio_play_sound_at_location(SOUND_ERROR, loc.x, loc.y, gSceneryPlaceZ);
}
});
auto res = GameActions::Execute(&sceneryPlaceAction);

View File

@@ -129,15 +129,14 @@ public:
GA_ERROR::NO_CLEARANCE, STR_CANT_POSITION_THIS_HERE, gGameCommandErrorText, gCommonFormatArgs);
}
if ((gMapGroundFlags & ELEMENT_IS_UNDERWATER) || (gMapGroundFlags & ELEMENT_IS_UNDERGROUND))
{
log_error("Can't place object underwater / underground.");
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE);
}
int32_t tempSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
if (!gCheatsDisableClearanceChecks)
{
if ((gMapGroundFlags & ELEMENT_IS_UNDERWATER) || (gMapGroundFlags & ELEMENT_IS_UNDERGROUND))
{
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
}
if (gSceneryGroundFlags && !(gSceneryGroundFlags & tempSceneryGroundFlags))
{
return MakeResult(
@@ -154,8 +153,7 @@ public:
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned(curTile.x, curTile.y, zLow * 8)
&& !gCheatsSandboxMode)
{
log_error("Location not owned.");
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE);
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
}