| 745 | |
| 746 | template<typename TAction, typename... TArgs> |
| 747 | static 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 | |
| 766 | static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& argv) |
| 767 | { |
nothing calls this directly
no test coverage detected