pass by const&
This commit is contained in:
parent
f0257a1292
commit
7dc9d41aa7
2 changed files with 3 additions and 9 deletions
|
@ -88,6 +88,6 @@ namespace Hanabi {
|
||||||
/**
|
/**
|
||||||
* @brief Execute parsed parameters.
|
* @brief Execute parsed parameters.
|
||||||
*/
|
*/
|
||||||
int run_cli(CLIParms parms);
|
int run_cli(CLIParms const & parms);
|
||||||
}
|
}
|
||||||
#endif //DYNAMIC_PROGRAM_COMMAND_LINE_INTERFACE_H
|
#endif //DYNAMIC_PROGRAM_COMMAND_LINE_INTERFACE_H
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Hanabi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int run_cli(CLIParms parms)
|
int run_cli(CLIParms const & parms)
|
||||||
{
|
{
|
||||||
// We want to do this sanity check here again,
|
// We want to do this sanity check here again,
|
||||||
// so that the run_cli method itself can ensure that arguments are fully valid
|
// so that the run_cli method itself can ensure that arguments are fully valid
|
||||||
|
@ -49,12 +49,6 @@ namespace Hanabi {
|
||||||
std::ostream & quiet_os = quiet_ostream(parms.quiet);
|
std::ostream & quiet_os = quiet_ostream(parms.quiet);
|
||||||
quiet_os.precision(10);
|
quiet_os.precision(10);
|
||||||
|
|
||||||
// Convert unset option to useful default, depending on some other options
|
|
||||||
if (not parms.interactive.has_value())
|
|
||||||
{
|
|
||||||
parms.interactive = !(parms.quiet or parms.recursive);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load game, either from file or from hanab.live
|
// Load game, either from file or from hanab.live
|
||||||
Game game = Download::get_game(parms.game, convert_optional(parms.score_goal));
|
Game game = Download::get_game(parms.game, convert_optional(parms.score_goal));
|
||||||
if (not game.holds_state())
|
if (not game.holds_state())
|
||||||
|
@ -176,7 +170,7 @@ namespace Hanabi {
|
||||||
quiet_os << "Enumerated " << game.state->position_tablebase().size() << " unique game states. " << std::endl;
|
quiet_os << "Enumerated " << game.state->position_tablebase().size() << " unique game states. " << std::endl;
|
||||||
|
|
||||||
// If specified, we can now launch the interactive shell
|
// If specified, we can now launch the interactive shell
|
||||||
if (parms.interactive)
|
if (parms.interactive.value_or(!parms.quiet))
|
||||||
{
|
{
|
||||||
quiet_os << "\nDropping into interactive command line to explore result (type 'help'):" << std::endl;
|
quiet_os << "\nDropping into interactive command line to explore result (type 'help'):" << std::endl;
|
||||||
auto game_shared = std::shared_ptr<HanabiStateIF>(game.state.release());
|
auto game_shared = std::shared_ptr<HanabiStateIF>(game.state.release());
|
||||||
|
|
Loading…
Reference in a new issue