SuperTuxKart
|
This is the base class for kart controller - that can be a player or a a robot. More...
#include <controller.hpp>
Public Member Functions | |
Controller (AbstractKart *kart) | |
Constructor, saves the kart pointer and a pointer to the KartControl of the kart. | |
virtual void | reset ()=0 |
virtual void | update (int ticks)=0 |
virtual void | handleZipper (bool play_sound)=0 |
virtual void | collectedItem (const ItemState &item, float previous_energy=0)=0 |
virtual void | crashed (const AbstractKart *k)=0 |
virtual void | crashed (const Material *m)=0 |
virtual void | setPosition (int p)=0 |
virtual bool | isLocalPlayerController () const =0 |
This function checks if this is a local player. More... | |
virtual bool | isPlayerController () const =0 |
This function checks if this player is not an AI, i.e. More... | |
virtual bool | disableSlipstreamBonus () const =0 |
virtual bool | saveState (BareNetworkString *buffer) const =0 |
virtual void | rewindTo (BareNetworkString *buffer)=0 |
virtual void | rumble (float strength_low, float strength_high, uint16_t duration) |
virtual void | setControllerName (const std::string &name) |
Sets the controller name for this controller. More... | |
const std::string & | getControllerName () const |
Returns the name of this controller. More... | |
virtual bool | action (PlayerAction action, int value, bool dry_run=false)=0 |
Default: ignore actions. More... | |
virtual void | newLap (int lap)=0 |
Callback whenever a new lap is triggered. More... | |
virtual void | skidBonusTriggered ()=0 |
virtual void | finishedRace (float time)=0 |
Called whan this controller's kart finishes the last lap. More... | |
virtual KartControl * | getControls () |
Get a pointer on the kart controls. More... | |
void | setControls (KartControl *kc) |
virtual bool | canGetAchievements () const |
Only local players can get achievements. More... | |
virtual core::stringw | getName (bool include_handicap_string=true) const |
Display name of the controller. More... | |
AbstractKart * | getKart () const |
Returns the kart controlled by this controller. More... | |
Protected Attributes | |
AbstractKart * | m_kart |
Pointer to the kart that is controlled by this controller. More... | |
KartControl * | m_controls |
A pointer to the main controller, from which the kart takes it commands. More... | |
std::string | m_controller_name |
The name of the controller, mainly used for debugging purposes. More... | |
This is the base class for kart controller - that can be a player or a a robot.
|
pure virtual |
Default: ignore actions.
Only PlayerController get them.
Implemented in AIBaseController, EndController, LocalPlayerController, GhostController, and PlayerController.
|
inlinevirtual |
Only local players can get achievements.
Reimplemented in EndController, LocalPlayerController, and NetworkPlayerController.
|
pure virtual |
Called whan this controller's kart finishes the last lap.
Implemented in AIBaseController, PlayerController, LocalPlayerController, and GhostController.
|
inline |
Returns the name of this controller.
|
inlinevirtual |
Get a pointer on the kart controls.
|
inline |
Returns the kart controlled by this controller.
|
virtual |
Display name of the controller.
Defaults to kart name; overriden by controller classes (such as player controllers) to display username.
Reimplemented in EndController, LocalPlayerController, GhostController, and PlayerController.
|
pure virtual |
This function checks if this is a local player.
A local player will get special graphical effects enabled, has a camera, and sound effects will be played with normal volume.
Implemented in EndController, AIBaseController, LocalPlayerController, GhostController, PlayerController, NetworkPlayerController, and NetworkAIController.
|
pure virtual |
This function checks if this player is not an AI, i.e.
it is either a a local or a remote/networked player. This is tested e.g. by the AI for rubber-banding.
Implemented in EndController, AIBaseController, LocalPlayerController, GhostController, and PlayerController.
|
pure virtual |
Callback whenever a new lap is triggered.
Used by the AI to trigger a recomputation of the way to use.
Implemented in ArenaAI, EndController, PlayerController, GhostController, and AIBaseLapController.
|
inlinevirtual |
Sets the controller name for this controller.
Reimplemented in AIBaseController.
|
protected |
The name of the controller, mainly used for debugging purposes.
|
protected |
A pointer to the main controller, from which the kart takes it commands.
|
protected |
Pointer to the kart that is controlled by this controller.