Quick and light command line processer. More...
#include <ConsoleInput.hh>
Classes | |
| struct | InputCommand |
| struct | InputSubCommand |
Public Member Functions | |
| ConsoleInput (CmdLineInterface *i, Api *gc, bool use_readline) | |
| bool | process (bool test_mode) |
| ! | |
| void | processCommand (const std::string &s) |
| ! | |
| void | wantExit () |
| ! | |
| bool | isRunning () |
| ! | |
| void | stopWaiting () |
| ! | |
Static Public Attributes | |
| static InputCommand | main_cmd_ [] |
| static InputSubCommand | print_cmd_ [] |
| static InputSubCommand | move_cmd_ [] |
| static InputSubCommand | choose_cmd_ [] |
| static InputSubCommand | place_cmd_ [] |
| static InputSubCommand | block_cmd_ [] |
| static InputSubCommand | skill_cmd_ [] |
| static InputSubCommand | action_cmd_ [] |
Quick and light command line processer.
| bool ConsoleInput::isRunning | ( | ) |
!
Return true if the application is running, or false if it wanting to exit.
| bool ConsoleInput::process | ( | bool | test_mode | ) |
!
Main loop, check input, process commands... call it frequently.
| test_mode | Set it true when running rules check. Change the behavior of who blocks and when. |
References Api::canMakeRequest(), BaseApi< T >::isBusy(), Api::mustMakeChoice(), and processCommand().
| void ConsoleInput::processCommand | ( | const std::string & | s | ) |
| void ConsoleInput::stopWaiting | ( | ) |
| void ConsoleInput::wantExit | ( | ) |
!
Wants to exit.
ConsoleInput::InputSubCommand ConsoleInput::action_cmd_ [static] |
{
{"move", &ConsoleInput::cmdActionMove, "<p>|Begin a move action for player <p>."},
{"block", &ConsoleInput::cmdActionBlock, "<p>|Begin a block action for player <p>."},
{"blitz", &ConsoleInput::cmdActionBlitz, "<p>|Begin a blitz action for player <p>."},
{"foul", &ConsoleInput::cmdActionFoul, "<p>|Begin a foul action for player <p>."},
{"pass", &ConsoleInput::cmdActionPass, "<p>|Begin a pass action for player <p>."},
{"transmit", &ConsoleInput::cmdActionTransmit, "<p>|Begin a transmit action for player <p>."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::block_cmd_ [static] |
{
{"", &ConsoleInput::cmdBlockBlock, "<att> <def>|Block <def> with player <att>."},
{"dice", &ConsoleInput::cmdBlockDice, "<n>|Choose a block dice."},
{"follow", &ConsoleInput::cmdBlockFollow, "Follow after a block."},
{"stay", &ConsoleInput::cmdBlockStay, "Stay after a block."},
{"push", &ConsoleInput::cmdBlockPush, "<n>|Choose a square to push the player in."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::choose_cmd_ [static] |
{
{"kickoff", &ConsoleInput::cmdChooseKickoff, "Choose to kick off the ball first."},
{"receive", &ConsoleInput::cmdChooseReceive, "Choose to receive the ball first."},
{NULL, NULL, NULL}
}
ConsoleInput::InputCommand ConsoleInput::main_cmd_ [static] |
{
{"quit", &ConsoleInput::cmdQuit, "Exit the game, CU."},
{"help", &ConsoleInput::cmdHelp, "Print this help."},
{"print", &ConsoleInput::cmdPrint, "<subcmd>|Print some informations. ('help print')"},
{"say", &ConsoleInput::cmdSay, "<s>|Chat with others."},
{"choose", &ConsoleInput::cmdChoose, "<subcmd>|Choose to kick off or receive. ('help choose')"},
{"place", &ConsoleInput::cmdPlace, "<subcmd>|Set up team placement. ('help place')"},
{"kickoff", &ConsoleInput::cmdKickOff, "<r> <c>|Kick off the ball to [<r> <c>]."},
{"giveBall", &ConsoleInput::cmdGiveBall, "<p>|Give the ball to the player <p>."},
{"illegal", &ConsoleInput::cmdIllegal, "Ask for an illegal procedure, absolutely useless."},
{"reroll", &ConsoleInput::cmdReroll, "Reroll the dice(s) using a team reroll."},
{"skill", &ConsoleInput::cmdSkill, "<subcmd>|Skill usage. ('help skill')"},
{"accept", &ConsoleInput::cmdAccept, "Accept result of the dice(s)."},
{"end", &ConsoleInput::cmdEnd, "End turn."},
{"action", &ConsoleInput::cmdAction, "<subcmd>|Begin an action. ('help action')"},
{"move", &ConsoleInput::cmdMove, "<subcmd>|Move something. ('help move')"},
{"standup", &ConsoleInput::cmdStandUp, "<p>|Stand up the player <p>."},
{"block", &ConsoleInput::cmdBlock, "<subcmd>|Block effort. ('help block')"},
{"foul", &ConsoleInput::cmdFoul, "<p> <r> <c>|Foul player at [<r> <c>] with player <p>."},
{"handoff", &ConsoleInput::cmdHandOff, "<p> <r> <c>|Hand ball off at [<r> <c>] with player <p>."},
{"pass", &ConsoleInput::cmdPass, "<p> <r> <c>|Pass the ball from player <p> to [<r> <c>]."},
{"cheat", &ConsoleInput::cmdCheat, "<n> <...>|Force next dice rolls to give these results (cheat)."},
{"debug", &ConsoleInput::cmdDebug, "Request both server and clients to print a debug trace."},
{"wait", &ConsoleInput::cmdWait, "<n>|Do not process input until <n> events happened."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::move_cmd_ [static] |
{
{"turnmarker", &ConsoleInput::cmdMoveTurnMarker, "Move the turn marker, absolutely useless."},
{"", &ConsoleInput::cmdMovePlayer, "<p> <r> <c>|Move player <p> to [<r> <c>]."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::place_cmd_ [static] |
{
{"", &ConsoleInput::cmdPlaceField, "<p> <r> <c>|Place the player <p> at [<r> <c>]."},
{"reserve", &ConsoleInput::cmdPlaceReserve, "<p>|Place the player <p> in the reserve."},
{"team", &ConsoleInput::cmdPlaceReserve, "<f>|Place the team according to formation no. <f>."},
{"end", &ConsoleInput::cmdEndPlacement, "End team placement."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::print_cmd_ [static] |
{
{"global", &ConsoleInput::cmdPrintGlobal, "Print game globals."},
{"field", &ConsoleInput::cmdPrintField, "Print field in ascii art."},
{"history", &ConsoleInput::cmdPrintHistory, "Print events history."},
{"players", &ConsoleInput::cmdPrintPlayers, "Print players list."},
{"us", &ConsoleInput::cmdPrintUs, "<p>|Print info for our team player <p>."},
{"them", &ConsoleInput::cmdPrintThem, "<p>|Print info for other team player <p>."},
{"", &ConsoleInput::cmdPrintString, "<s>|Simply display the string <s>."},
{NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::skill_cmd_ [static] |
{
{"use", &ConsoleInput::cmdUseSkill, "<s>|Use the skill <s>."},
{"ignore", &ConsoleInput::cmdIgnoreSkill, "<s>|Ignore the skill <s>."},
{NULL, NULL, NULL}
}
1.6.3