mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #5904: Empty errors on tile inspector base height change
This commit is contained in:
parent
0981b49e99
commit
e4d72cefaa
|
@ -3642,6 +3642,9 @@ STR_6383 :Open download page
|
|||
STR_6384 :Snow
|
||||
STR_6385 :Heavy Snow
|
||||
STR_6386 :Blizzard
|
||||
STR_6387 :Can't lower element here...
|
||||
STR_6388 :Can't raise element here...
|
||||
STR_6389 :No clearance
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- Feature: [#12999] .sea (RCT Classic) scenarios are now listed in the “New Scenario” dialog.
|
||||
- Feature: [#13000] objective_options command for console.
|
||||
- Fix: [#3200] Close Construction window upon selecting vehicle page.
|
||||
- Fix: [#5904] Empty errors on tile inspector base height change.
|
||||
- Fix: [#8015] RCT2 files are not found when put into the OpenRCT2 folder.
|
||||
- Fix: [#8957] Error title missing when building with insufficient funds
|
||||
- Fix: [#13021] Mowed grass and weeds don't show up in extra zoom levels.
|
||||
|
|
|
@ -3887,6 +3887,10 @@ enum
|
|||
STR_HEAVY_SNOW = 6385,
|
||||
STR_BLIZZARD = 6386,
|
||||
|
||||
STR_CANT_LOWER_ELEMENT_HERE = 6387,
|
||||
STR_CANT_RAISE_ELEMENT_HERE = 6388,
|
||||
STR_NO_CLEARANCE = 6389,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
||||
};
|
||||
|
|
|
@ -474,6 +474,29 @@ GameActionResult::Ptr tile_inspector_sort_elements_at(const CoordsXY& loc, bool
|
|||
return std::make_unique<GameActionResult>();
|
||||
}
|
||||
|
||||
static GameActionResult::Ptr ValidateTileHeight(TileElement* const tileElement, int8_t heightOffset)
|
||||
{
|
||||
int16_t newBaseHeight = static_cast<int16_t>(tileElement->base_height + heightOffset);
|
||||
int16_t newClearanceHeight = static_cast<int16_t>(tileElement->clearance_height + heightOffset);
|
||||
if (newBaseHeight < 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::TOO_LOW, STR_CANT_LOWER_ELEMENT_HERE, STR_TOO_LOW);
|
||||
}
|
||||
else if (newBaseHeight > MAX_ELEMENT_HEIGHT)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::TOO_HIGH, STR_CANT_RAISE_ELEMENT_HERE, STR_TOO_HIGH);
|
||||
}
|
||||
else if (newClearanceHeight < 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NO_CLEARANCE, STR_CANT_LOWER_ELEMENT_HERE, STR_NO_CLEARANCE);
|
||||
}
|
||||
else if (newClearanceHeight > MAX_ELEMENT_HEIGHT)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::NO_CLEARANCE, STR_CANT_RAISE_ELEMENT_HERE, STR_NO_CLEARANCE);
|
||||
}
|
||||
return std::make_unique<GameActionResult>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
||||
const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting)
|
||||
{
|
||||
|
@ -481,13 +504,9 @@ GameActionResult::Ptr tile_inspector_any_base_height_offset(
|
|||
if (tileElement == nullptr)
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
|
||||
int16_t newBaseHeight = static_cast<int16_t>(tileElement->base_height + heightOffset);
|
||||
int16_t newClearanceHeight = static_cast<int16_t>(tileElement->clearance_height + heightOffset);
|
||||
if (newBaseHeight < 0 || newBaseHeight > MAX_ELEMENT_HEIGHT || newClearanceHeight < 0
|
||||
|| newClearanceHeight > MAX_ELEMENT_HEIGHT)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
}
|
||||
auto heightValidationResult = ValidateTileHeight(tileElement, heightOffset);
|
||||
if (heightValidationResult->Error != GA_ERROR::OK)
|
||||
return heightValidationResult;
|
||||
|
||||
if (isExecuting)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue