forked from rosebudai/OpenRCT2-Web
Implement strings for GameAction errors
This commit is contained in:
1 parent
2ad37db817
commit
83fe0cf5c5
18 files changed
+135
-41
No files matched your search
@@ -732,10 +732,10 @@ std::unique_ptr<GameActionResult> ScriptEngine::QueryOrExecuteCustomGameAction(
|
||||
std::unique_ptr<GameActionResult> ScriptEngine::DukToGameActionResult(const DukValue& d)
|
||||
{
|
||||
auto result = std::make_unique<GameActionResult>();
|
||||
result->Error = d["error"].type() == DukValue::Type::NUMBER ? static_cast<GA_ERROR>(d["error"].as_int()) : GA_ERROR::OK;
|
||||
auto errorTitle = d["errorTitle"].type() == DukValue::Type::STRING ? d["errorTitle"].as_string() : std::string();
|
||||
auto errorMessage = d["errorMessage"].type() == DukValue::Type::STRING ? d["errorMessage"].as_string() : std::string();
|
||||
result->Cost = d["cost"].type() == DukValue::Type::NUMBER ? d["cost"].as_int() : 0;
|
||||
result->Error = static_cast<GA_ERROR>(AsOrDefault<int32_t>(d["error"]));
|
||||
result->ErrorTitle = AsOrDefault<std::string>(d["errorTitle"]);
|
||||
result->ErrorMessage = AsOrDefault<std::string>(d["errorMessage"]);
|
||||
result->Cost = AsOrDefault<int32_t>(d["cost"]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user