Header clean up

This commit is contained in:
Benau 2018-09-15 11:18:30 +08:00
parent f547753aaa
commit 01b95d873e
16 changed files with 37 additions and 48 deletions

View File

@ -32,6 +32,7 @@
#include "karts/kart_properties.hpp"
#include "karts/max_speed.hpp"
#include "modes/world.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "tracks/quad.hpp"
#include "utils/constants.hpp"

View File

@ -36,6 +36,7 @@
#include "karts/explosion_animation.hpp"
#include "karts/kart_properties.hpp"
#include "modes/world.hpp"
#include "network/network_string.hpp"
#include "network/rewind_manager.hpp"
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"

View File

@ -29,6 +29,7 @@
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"
#include "network/network_string.hpp"
#include "physics/physical_object.hpp"
#include "physics/physics.hpp"
#include "tracks/track.hpp"

View File

@ -33,6 +33,7 @@
#include "karts/kart_properties.hpp"
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/network_string.hpp"
#include "network/rewind_manager.hpp"
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"

View File

@ -27,6 +27,8 @@
#include "items/projectile_manager.hpp"
#include "karts/abstract_kart.hpp"
#include "modes/linear_world.hpp"
#include "network/network_string.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "physics/btKart.hpp"
#include "physics/triangle_mesh.hpp"

View File

@ -40,6 +40,7 @@
#include "karts/kart_properties.hpp"
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#define SWAT_POS_OFFSET core::vector3df(0.0, 0.2f, -0.4f)

View File

@ -25,6 +25,7 @@
#include "karts/skidding.hpp"
#include "modes/world.hpp"
#include "network/network_config.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "physics/physics.hpp"

View File

@ -17,35 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "karts/controller/kart_control.hpp"
#include "network/protocols/game_protocol.hpp"
#include "network/rewind_manager.hpp"
// ------------------------------------------------------------------------
/** Called when going back in time during a rewind. Nothing to do here
* in this case.
*/
void KartControl::undo(BareNetworkString *buffer)
{
} // undo
// ------------------------------------------------------------------------
/** Replay an event for a KartControl object from the buffer.
* \param buffer BareNetworkString with saved event into.
*/
void KartControl::rewind(BareNetworkString *buffer)
{
if(buffer->getTotalSize()>1)
{
// Full state including accel and steering was saved
rewindTo(buffer);
}
else // only a button event was stored
{
setButtonsCompressed(buffer->getUInt8());
}
} // rewind
#include "network/network_string.hpp"
// ------------------------------------------------------------------------
/** Sets the current steering value. */
@ -102,3 +74,20 @@ void KartControl::setLookBack(bool b)
{
m_look_back = b;
} // setLookBack
// ----------------------------------------------------------------------------
/** Copies the important data from this objects into a memory buffer. */
void KartControl::saveState(BareNetworkString *buffer) const
{
buffer->add(m_steer);
buffer->add(m_accel);
buffer->addChar(getButtonsCompressed());
} // saveState
// ----------------------------------------------------------------------------
/** Restores this object from a previously saved memory buffer. */
void KartControl::rewindTo(BareNetworkString *buffer)
{
m_steer = buffer->getFloat();
m_accel = buffer->getFloat();
setButtonsCompressed(buffer->getUInt8());
} // setFromMemory

View File

@ -19,13 +19,12 @@
#ifndef HEADER_KART_CONTROL_HPP
#define HEADER_KART_CONTROL_HPP
#include "network/network_string.hpp"
#include "network/rewind_info.hpp"
class BareNetworkString;
/**
* \ingroup controller
*/
class KartControl : public EventRewinder
class KartControl
{
public:
/** The skidding control state: SC_NONE: not pressed;
@ -51,8 +50,6 @@ private:
/** True if the kart looks (and shoots) backwards. */
bool m_look_back;
public:
virtual void undo(BareNetworkString *buffer);
virtual void rewind(BareNetworkString *buffer);
void setSteer(float f);
void setAccel(float f);
void setBrake(bool b);
@ -100,22 +97,10 @@ public:
static int getLength() { return 9; }
// ------------------------------------------------------------------------
/** Copies the important data from this objects into a memory buffer. */
void saveState(BareNetworkString *buffer) const
{
buffer->add(m_steer);
buffer->add(m_accel);
buffer->addChar(getButtonsCompressed());
} // saveState
void saveState(BareNetworkString *buffer) const;
// ------------------------------------------------------------------------
/** Restores this object from a previously saved memory buffer. */
void rewindTo(BareNetworkString *buffer)
{
m_steer = buffer->getFloat();
m_accel = buffer->getFloat();
setButtonsCompressed(buffer->getUInt8());
} // setFromMemory
void rewindTo(BareNetworkString *buffer);
// ------------------------------------------------------------------------
/** Compresses all buttons into a single byte. */
char getButtonsCompressed() const

View File

@ -33,6 +33,7 @@
#include "network/rewind_manager.hpp"
#include "network/network_config.hpp"
#include "network/network_player_profile.hpp"
#include "network/network_string.hpp"
#include "network/protocols/lobby_protocol.hpp"
#include "race/history.hpp"
#include "states_screens/race_gui_base.hpp"

View File

@ -68,6 +68,7 @@
#include "modes/soccer_world.hpp"
#include "network/network_config.hpp"
#include "network/race_event_manager.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "physics/btKart.hpp"
#include "physics/btKartRaycast.hpp"

View File

@ -30,6 +30,7 @@
#include "items/powerup_manager.hpp" // For PowerupType
#include "karts/abstract_kart.hpp"
#include "utils/cpp2011.hpp"
#include "utils/no_copy.hpp"
#include <SColor.h>

View File

@ -21,6 +21,7 @@
#include "config/stk_config.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "network/network_string.hpp"
#include "physics/btKart.hpp"
#include <algorithm>

View File

@ -22,6 +22,7 @@
#include "karts/controller/kart_control.hpp"
#include "utils/leak_check.hpp"
#include "utils/no_copy.hpp"
#include "utils/types.hpp"
class BareNetworkString;
class Kart;

View File

@ -33,6 +33,7 @@
#include "network/network_config.hpp"
#include "network/network_string.hpp"
#include "network/protocols/game_events_protocol.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "network/stk_host.hpp"
#include "physics/physics.hpp"

View File

@ -28,6 +28,7 @@
#include "network/network_config.hpp"
#include "network/network_string.hpp"
#include "network/protocol_manager.hpp"
#include "network/rewind_info.hpp"
#include "network/rewind_manager.hpp"
#include "network/stk_host.hpp"
#include "network/stk_peer.hpp"