SuperTuxKart
Loading...
Searching...
No Matches
network_ai_controller.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2018 SuperTuxKart-Team
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_NETWORK_AI_CONTROLLER_HPP
20#define HEADER_NETWORK_AI_CONTROLLER_HPP
21
22#include "karts/controller/player_controller.hpp"
23
24class AbstractKart;
26
28{
29private:
30 static int m_ai_frequency;
31 int m_prev_update_ticks;
32 AIBaseController* m_ai_controller;
33 KartControl* m_ai_controls;
34 void convertAIToPlayerActions();
35public:
36 NetworkAIController(AbstractKart *kart, int local_player_id,
38 virtual ~NetworkAIController();
39 virtual void update(int ticks) OVERRIDE;
40 virtual void reset() OVERRIDE;
41 // ------------------------------------------------------------------------
42 virtual bool isLocalPlayerController() const OVERRIDE;
43 // ------------------------------------------------------------------------
44 static void setAIFrequency(int freq) { m_ai_frequency = freq; }
45}; // class NetworkAIController
46
47#endif // HEADER_PLAYER_CONTROLLER_HPP
A base class for all AI karts.
Definition: ai_base_controller.hpp:34
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Definition: kart_control.hpp:30
Definition: network_ai_controller.hpp:28
virtual bool isLocalPlayerController() const OVERRIDE
This function checks if this is a local player.
Definition: network_ai_controller.cpp:55
virtual void update(int ticks) OVERRIDE
Updates the player kart, called once each timestep.
Definition: network_ai_controller.cpp:61
virtual void reset() OVERRIDE
Resets the player kart for a new or restarted race.
Definition: network_ai_controller.cpp:78
Definition: player_controller.hpp:28