diff --git a/src/replay_base.cpp b/src/replay_base.cpp index 1f634be31..aceaa74f2 100644 --- a/src/replay_base.cpp +++ b/src/replay_base.cpp @@ -1,7 +1,7 @@ -// $Id: replay_base.cpp ikework $ +// $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006 SuperTuxKart-Team +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -17,32 +17,32 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef HAVE_GHOST_REPLAY - -#include "replay_base.hpp" - - -const std::string ReplayBase::REPLAY_FOLDER = "replay"; -const std::string ReplayBase::REPLAY_FILE_EXTENSION_HUMAN_READABLE = "rph"; -const std::string ReplayBase::REPLAY_FILE_EXTENSION_BINARY = "rpb"; - - -ReplayBase::ReplayBase() -: m_ReplayBuffers() -{ -} - -ReplayBase::~ReplayBase() -{ - destroy(); -} - -void ReplayBase::destroy() -{ - m_ReplayBuffers.destroy(); -} - - - - -#endif // HAVE_GHOST_REPLAY +#ifdef HAVE_GHOST_REPLAY + +#include "replay_base.hpp" + + +const std::string ReplayBase::REPLAY_FOLDER = "replay"; +const std::string ReplayBase::REPLAY_FILE_EXTENSION_HUMAN_READABLE = "rph"; +const std::string ReplayBase::REPLAY_FILE_EXTENSION_BINARY = "rpb"; + + +ReplayBase::ReplayBase() +: m_ReplayBuffers() +{ +} + +ReplayBase::~ReplayBase() +{ + destroy(); +} + +void ReplayBase::destroy() +{ + m_ReplayBuffers.destroy(); +} + + + + +#endif // HAVE_GHOST_REPLAY diff --git a/src/replay_base.hpp b/src/replay_base.hpp index d9ad70b4f..765762004 100644 --- a/src/replay_base.hpp +++ b/src/replay_base.hpp @@ -1,7 +1,7 @@ // $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2007 Damien Morel +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/replay_buffer_tpl.hpp b/src/replay_buffer_tpl.hpp index d8be375f2..74782d6b5 100644 --- a/src/replay_buffer_tpl.hpp +++ b/src/replay_buffer_tpl.hpp @@ -1,7 +1,7 @@ // $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2007 Damien Morel +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -42,20 +42,20 @@ #endif -template class BufferArray; +template class ReplayBufferArray; template -class Buffer +class ReplayBuffer { - friend class BufferArray; + friend class ReplayBufferArray; public: - Buffer() : m_pp_blocks(NULL),m_number_blocks(0),m_block_size(0),m_number_objects_used(0),m_healthy(true) {} - ~Buffer() { destroy(); } + ReplayBuffer() : m_pp_blocks(NULL),m_number_blocks(0),m_block_size(0),m_number_objects_used(0),m_healthy(true) {} + ~ReplayBuffer() { destroy(); } private: - Buffer( Buffer const &c ); - Buffer const &operator=( Buffer const &c ); + ReplayBuffer( ReplayBuffer const &c ); + ReplayBuffer const &operator=( ReplayBuffer const &c ); public: bool init( size_t number_preallocated_objects ); @@ -103,14 +103,14 @@ private: }; -// does the same as Buffer, but it returns an array of objects, rather than just one +// does the same as ReplayBuffer, but it returns an array of objects, rather than just one // object .. template -class BufferArray +class ReplayBufferArray { public: - BufferArray() : m_Buffer(), m_array_size(0) {} - ~BufferArray() { destroy(); } + ReplayBufferArray() : m_Buffer(), m_array_size(0) {} + ~ReplayBufferArray() { destroy(); } void destroy(); bool init( size_t number_preallocated_arrays, size_t array_size ); @@ -125,15 +125,15 @@ public: bool isHealthy() const { return m_Buffer.isHealthy(); } private: - Buffer m_Buffer; - size_t m_array_size; + ReplayBuffer m_Buffer; + size_t m_array_size; }; template -bool Buffer::init( size_t number_preallocated_objects ) +bool ReplayBuffer::init( size_t number_preallocated_objects ) { // make sure *clean* usage assert( !m_pp_blocks ); @@ -146,7 +146,7 @@ bool Buffer::init( size_t number_preallocated_objects ) } template -void Buffer::destroy() +void ReplayBuffer::destroy() { size_t tmp; if( m_pp_blocks ) @@ -163,7 +163,7 @@ void Buffer::destroy() // returns a new *free* frame to be used to store the current frame-data into it // used to *record* the replay template -T* Buffer::getNewObject() +T* ReplayBuffer::getNewObject() { // make sure initialization was called properly assert( m_pp_blocks ); @@ -191,7 +191,7 @@ T* Buffer::getNewObject() // returs frame at given position from replay data // used to *show* the replay template -T const* Buffer::getObjectAt( size_t index ) const +T const* ReplayBuffer::getObjectAt( size_t index ) const { // make sure initialization was called properly assert( m_pp_blocks ); @@ -204,7 +204,7 @@ T const* Buffer::getObjectAt( size_t index ) const } template -T* Buffer::getObjectAt( size_t index ) +T* ReplayBuffer::getObjectAt( size_t index ) { // make sure initialization was called properly assert( m_pp_blocks ); @@ -218,7 +218,7 @@ T* Buffer::getObjectAt( size_t index ) // adds a new block of objects to m_pp_blocks with a size of m_block_size template -bool Buffer::addNewBlock() +bool ReplayBuffer::addNewBlock() { assert( m_block_size ); @@ -261,14 +261,14 @@ bool Buffer::addNewBlock() template -void BufferArray::destroy() +void ReplayBufferArray::destroy() { m_Buffer.destroy(); m_array_size = 0; } template -bool BufferArray::init( size_t number_preallocated_arrays, size_t array_size ) +bool ReplayBufferArray::init( size_t number_preallocated_arrays, size_t array_size ) { assert( number_preallocated_arrays ); assert( array_size ); @@ -278,7 +278,7 @@ bool BufferArray::init( size_t number_preallocated_arrays, size_t array_size // returns a new *free* array of objects template -T* BufferArray::getNewArray() +T* ReplayBufferArray::getNewArray() { if( !isHealthy() ) return NULL; diff --git a/src/replay_buffers.cpp b/src/replay_buffers.cpp index 788e83f8b..d5d17e3f9 100644 --- a/src/replay_buffers.cpp +++ b/src/replay_buffers.cpp @@ -1,7 +1,7 @@ -// $Id: replay_buffers.cpp ikework $ +// $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006 SuperTuxKart-Team +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/replay_buffers.hpp b/src/replay_buffers.hpp index 6fddecd44..2ce1b4046 100644 --- a/src/replay_buffers.hpp +++ b/src/replay_buffers.hpp @@ -1,7 +1,7 @@ // $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2007 Damien Morel +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -63,8 +63,8 @@ private: bool isHealthy() const { return m_BufferFrame.isHealthy() && m_BufferKartState.isHealthy(); } private: - typedef Buffer BufferFrame; - typedef BufferArray BufferKartState; + typedef ReplayBuffer BufferFrame; + typedef ReplayBufferArray BufferKartState; unsigned int m_number_karts; BufferFrame m_BufferFrame; diff --git a/src/replay_player.cpp b/src/replay_player.cpp index ac8fdf7de..94e505df2 100644 --- a/src/replay_player.cpp +++ b/src/replay_player.cpp @@ -1,7 +1,7 @@ -// $Id: replay_player.cpp ikework $ +// $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006 SuperTuxKart-Team +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/replay_player.hpp b/src/replay_player.hpp index 1586ec728..5964c5389 100644 --- a/src/replay_player.hpp +++ b/src/replay_player.hpp @@ -1,7 +1,7 @@ -// $Id: $ +// $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2007 Damien Morel +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/replay_recorder.cpp b/src/replay_recorder.cpp index 438955885..cb48c1bad 100644 --- a/src/replay_recorder.cpp +++ b/src/replay_recorder.cpp @@ -1,7 +1,7 @@ -// $Id: replay_recorder.cpp ikework $ +// $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2006 SuperTuxKart-Team +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -17,41 +17,41 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifdef HAVE_GHOST_REPLAY - -#include - -#include "replay_recorder.hpp" -#include "world.hpp" - -const float ReplayRecorder::REPLAY_TIME_STEP_MIN = 1.0f / (float)ReplayRecorder::REPLAY_FREQUENCY_MAX; - -ReplayRecorder::ReplayRecorder() -: ReplayBase() -{ -} - -ReplayRecorder::~ReplayRecorder() -{ - destroy(); -} - -void ReplayRecorder::destroy() -{ - ReplayBase::destroy(); -} - -bool ReplayRecorder::initRecorder( unsigned int number_karts, size_t number_preallocated_frames ) -{ - assert( number_karts ); - - destroy(); - - if( !m_ReplayBuffers.init( number_karts, number_preallocated_frames ) ) return false; - - return true; -} - +#ifdef HAVE_GHOST_REPLAY + +#include + +#include "replay_recorder.hpp" +#include "world.hpp" + +const float ReplayRecorder::REPLAY_TIME_STEP_MIN = 1.0f / (float)ReplayRecorder::REPLAY_FREQUENCY_MAX; + +ReplayRecorder::ReplayRecorder() +: ReplayBase() +{ +} + +ReplayRecorder::~ReplayRecorder() +{ + destroy(); +} + +void ReplayRecorder::destroy() +{ + ReplayBase::destroy(); +} + +bool ReplayRecorder::initRecorder( unsigned int number_karts, size_t number_preallocated_frames ) +{ + assert( number_karts ); + + destroy(); + + if( !m_ReplayBuffers.init( number_karts, number_preallocated_frames ) ) return false; + + return true; +} + bool ReplayRecorder::pushFrame() { // we dont record the startphase .. @@ -80,6 +80,6 @@ bool ReplayRecorder::pushFrame() return true; } - - -#endif // HAVE_GHOST_REPLAY + + +#endif // HAVE_GHOST_REPLAY diff --git a/src/replay_recorder.hpp b/src/replay_recorder.hpp index 36c59b6be..11fcd45f3 100644 --- a/src/replay_recorder.hpp +++ b/src/replay_recorder.hpp @@ -1,7 +1,7 @@ // $Id$ // // SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2007 Damien Morel +// Copyright (C) 2007 Maik Semder // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License