mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 00:04:43 +01:00
Make error message on console set command more descriptive
Previously when using `set variable something` you would always get the non-helpful message: "set variable command failed, likely due to permissions." Since all of these are going through game actions, we can use the GameActionResult to return something more meaningful. For example, trying to do `set game_speed 5`: Before:  After: 
This commit is contained in:
@@ -741,7 +741,8 @@ static void ConsoleSetVariableAction(InteractiveConsole& console, std::string va
|
||||
auto action = TAction(std::forward<TArgs>(args)...);
|
||||
action.SetCallback([&console, var](const GameAction*, const GameActions::Result* res) {
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
console.WriteLineError(String::stdFormat("set %s command failed, likely due to permissions.", var.c_str()));
|
||||
console.WriteLineError(String::stdFormat(
|
||||
"set %s command failed: %s - %s.", var.c_str(), res->GetErrorTitle().c_str(), res->GetErrorMessage().c_str()));
|
||||
else
|
||||
console.Execute(String::stdFormat("get %s", var.c_str()));
|
||||
console.EndAsyncExecution();
|
||||
|
||||
Reference in New Issue
Block a user