#include <cController.h>
Public Types | |
enum | Opcodes { WAIT, ATTACK, FOLLOW, GOTO, REPEAT, OPCODE_MAX } |
Available opcodes of stack-machine. More... | |
Public Member Functions | |
cController (cObject *entity, bool enabled=true) | |
Initialises a en-/disabled controller for the given entity-> | |
virtual | ~cController () |
Destructor. | |
void | process (float spf=1.0f) |
Do a single Instruction step as the top frame on the stack says. | |
void | drawHUD () |
Currently there is no hud. | |
void | printState () |
Print out State and Stackinformation. | |
void | pushWaitEvent (long mseconds=-1, bool patrol=true) |
Wait until a Timeout occures or the selected event occures (patrol==true => Enemy Contact). | |
void | waitEvent () |
Execute wait command. | |
void | pushAttackEnemy (OID entity) |
Attack that entity. | |
void | attackEnemy () |
Execute attack command. | |
void | pushFollowLeader (OID entity, bool patrol=true) |
Follow the given entity and patrol (watchout) if required. | |
void | followLeader () |
Execute follow command. | |
void | pushGotoDestination (float *v, bool patrol=true) |
Go to the given location and patrol (watchout) if required. | |
void | gotoDestination () |
Execute goto command. | |
void | pushRepeatInstructions (int n) |
Repeat the n commands below this one (copies/pushes n frames onto stack). | |
void | repeatInstructions () |
Execute repeat command. | |
Public Attributes | |
bool | controllerEnabled |
Whether control is enabled (autopilot/ai enabled/disabled). | |
cObject * | controlledDevice |
The controlled entity cObject. | |
std::vector< OID > | commandStack |
The command stack: n Values may form a command frame (command+arguments). | |
Protected Member Functions | |
std::string | getFrameName () |
Get the name of the current stack/command frame. | |
unsigned int | getFrameSizeOf (int opcode) |
Get the stack frame size of the opcode (command+arguments). | |
unsigned int | getFrameSize () |
Get the stack frame size of the current command. | |
void | setParameter (int offset, OID value) |
Set Parameter value at top of the stack minus offset. | |
OID | getParameter (int offset) |
Get Parameter value from top of the stack minus offset. | |
void | push (OID value) |
Push a single value onto the stack. | |
void | pop () |
Remove whole instruction/frame from stack. |
Autopilot/AI object controller, controlls usualy Mechs. Implements an stack-automaton for object behavior control and plan execution.
enum cController::Opcodes |