MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ConsoleSetVariableAction

Function ConsoleSetVariableAction

src/openrct2/interface/InteractiveConsole.cpp:747–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745
746template<typename TAction, typename... TArgs>
747static void ConsoleSetVariableAction(InteractiveConsole& console, std::string var, TArgs&&... args)
748{
749 auto action = TAction(std::forward<TArgs>(args)...);
750 action.SetCallback([&console, var](const GameActions::GameAction*, const GameActions::Result* res) {
751 if (res->error != GameActions::Status::ok)
752 console.WriteLineError(
753 String::stdFormat(
754 "set %s command failed: %s - %s.", var.c_str(), res->getErrorTitle().c_str(),
755 res->getErrorMessage().c_str()));
756 else
757 console.Execute(String::stdFormat("get %s", var.c_str()));
758 console.EndAsyncExecution();
759 });
760 console.BeginAsyncExecution();
761
762 auto& gameState = getGameState();
763 GameActions::Execute(&action, gameState);
764}
765
766static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& argv)
767{

Callers

nothing calls this directly

Calls 9

stdFormatFunction · 0.85
SetCallbackMethod · 0.80
WriteLineErrorMethod · 0.80
getErrorTitleMethod · 0.80
getErrorMessageMethod · 0.80
EndAsyncExecutionMethod · 0.80
BeginAsyncExecutionMethod · 0.80
ExecuteFunction · 0.50
ExecuteMethod · 0.45

Tested by

no test coverage detected