SuperTuxKart
network_player_controller.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2015 Joerg Henrichs
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 3
6 // of the License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 
17 #ifndef HEADER_NETWORK_PLAYER_CONTROLLER_HPP
18 #define HEADER_NETWORK_PLAYER_CONTROLLER_HPP
19 
20 #include "karts/controller/player_controller.hpp"
22 
23 class AbstractKart;
24 class Player;
25 
27 {
28 public:
30  {
31  Log::info("NetworkPlayerController",
32  "New network player controller.");
33  } // NetworkPlayerController
34  // ------------------------------------------------------------------------
35  virtual ~NetworkPlayerController()
36  {
37  } // ~NetworkPlayerController
38  // ------------------------------------------------------------------------
39  virtual bool canGetAchievements() const OVERRIDE { return false; }
40  // ------------------------------------------------------------------------
43  virtual bool isLocalPlayerController() const OVERRIDE
44  {
45  return false;
46  } // isLocal
47  // ------------------------------------------------------------------------
54  virtual void update(int ticks) OVERRIDE
55  {
57  if (NetworkConfig::get()->isClient())
58  {
60  * stk_config->m_network_steering_reduction);
61  }
62  } // update
63 
64  // ------------------------------------------------------------------------
65 }; // NetworkPlayerController
66 
67 #endif // NETWORK_PLAYER_CONTROLLER_HPP
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
KartControl * m_controls
A pointer to the main controller, from which the kart takes it commands.
Definition: controller.hpp:55
void setSteer(float f)
Sets the current steering value.
Definition: kart_control.cpp:27
float getSteer() const
Returns the current steering value in [-1, 1].
Definition: kart_control.hpp:128
static NetworkConfig * get()
Singleton get, which creates this object if necessary.
Definition: network_config.hpp:139
Definition: network_player_controller.hpp:27
virtual bool canGetAchievements() const OVERRIDE
Only local players can get achievements.
Definition: network_player_controller.hpp:39
virtual void update(int ticks) OVERRIDE
Update for network controller.
Definition: network_player_controller.hpp:54
virtual bool isLocalPlayerController() const OVERRIDE
This player is not a local player.
Definition: network_player_controller.hpp:43
Definition: player_controller.hpp:28
virtual void update(int ticks) OVERRIDE
Updates the player kart, called once each timestep.
Definition: player_controller.cpp:327
float m_network_steering_reduction
In case of a network race, remote karts will get their steering somewhat reduced each frame.
Definition: stk_config.hpp:104
Defines network configuration for server and client.