Public Member Functions | List of all members
NetworkPlayerController Class Reference
Inheritance diagram for NetworkPlayerController:
Inheritance graph

Public Member Functions

 NetworkPlayerController (AbstractKart *kart)
virtual bool canGetAchievements () const OVERRIDE
 Only local players can get achievements. More...
virtual bool isLocalPlayerController () const OVERRIDE
 This player is not a local player. More...
virtual void update (int ticks) OVERRIDE
 Update for network controller. More...
- Public Member Functions inherited from PlayerController
 PlayerController (AbstractKart *kart)
virtual ~PlayerController ()
 Destructor for a player kart.
virtual bool action (PlayerAction action, int value, bool dry_run=false) OVERRIDE
 This function interprets a kart action and value, and set the corresponding entries in the kart control data structure. More...
virtual void actionFromNetwork (PlayerAction action, int value, int value_l, int value_r)
virtual void skidBonusTriggered () OVERRIDE
 Callback when the skidding bonus is triggered. More...
virtual void reset () OVERRIDE
 Resets the player kart for a new or restarted race.
virtual void handleZipper (bool play_sound) OVERRIDE
 Called when a kart hits or uses a zipper.
virtual void resetInputState ()
 Resets the state of control keys. More...
virtual bool saveState (BareNetworkString *buffer) const OVERRIDE
virtual void rewindTo (BareNetworkString *buffer) OVERRIDE
virtual void collectedItem (const ItemState &item, float previous_energy=0) OVERRIDE
virtual bool isPlayerController () const OVERRIDE
 This function checks if this player is not an AI, i.e. More...
virtual void setPosition (int p) OVERRIDE
 Called just before the position of the kart is changed. More...
virtual void crashed (const AbstractKart *k) OVERRIDE
virtual void crashed (const Material *m) OVERRIDE
virtual void newLap (int lap) OVERRIDE
 Callback whenever a new lap is triggered. More...
virtual bool disableSlipstreamBonus () const OVERRIDE
 Player will always be able to get a slipstream bonus. More...
virtual void finishedRace (float time) OVERRIDE
 Called when a race is finished. More...
core::stringw getName (bool include_handicap_string=true) const OVERRIDE
 Returns the name of the player profile. More...
virtual void displayPenaltyWarning ()
 Called when this kart started too early and got a start penalty. More...
- Public Member Functions inherited from Controller
 Controller (AbstractKart *kart)
 Constructor, saves the kart pointer and a pointer to the KartControl of the kart.
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 KartControlgetControls ()
 Get a pointer on the kart controls. More...
void setControls (KartControl *kc)
AbstractKartgetKart () const
 Returns the kart controlled by this controller. More...

Additional Inherited Members

- Protected Member Functions inherited from PlayerController
virtual void steer (int ticks, int steer_val)
 Handles steering for a player kart.
- Protected Attributes inherited from PlayerController
int m_steer_val
int m_steer_val_l
int m_steer_val_r
uint16_t m_prev_accel
bool m_prev_brake
bool m_prev_nitro
int m_penalty_ticks
- Protected Attributes inherited from Controller
 Pointer to the kart that is controlled by this controller. More...
 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...

Member Function Documentation

◆ canGetAchievements()

virtual bool NetworkPlayerController::canGetAchievements ( ) const

Only local players can get achievements.

Reimplemented from Controller.

◆ isLocalPlayerController()

virtual bool NetworkPlayerController::isLocalPlayerController ( ) const

This player is not a local player.

This affect e.g. special sfx and camera effects to be triggered.

Reimplemented from PlayerController.

◆ update()

virtual void NetworkPlayerController::update ( int  ticks)

Update for network controller.

For player with a high ping it is useful to reduce shaking by reducing the steering somewhat in each frame: If the player does a quick correction only, because of the high latency the predicted path will curve way too much. By automatically reducing it, this error is reduced. And even if the player steers more the error is hopefully acceptable.

Reimplemented from PlayerController.

The documentation for this class was generated from the following file: