Back to index

supertuxkart  0.5+dfsg1
replay_base.hpp
Go to the documentation of this file.
00001 //  $Id$
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2007 Maik Semder <ikework@gmx.de>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_REPLAYBASE_H
00021 #define HEADER_REPLAYBASE_H
00022 
00023 #ifdef HAVE_GHOST_REPLAY
00024 
00025 
00026 #include <string>
00027 #include <plib/sg.h>
00028 
00029 #include "replay_buffers.hpp"
00030 
00031 
00032 // the data stored for each kart in each frame
00033 struct ReplayKartState
00034 {
00035     sgCoord position;
00036 };
00037 // the data stored for each frame
00038 struct ReplayFrame
00039 {
00040     // absolute time of frame
00041     float           time;
00042     // for each kart in frame, points to continious block 
00043     // in Buffers::m_pp_blocks_kart_states with m_number_karts items
00044     ReplayKartState *p_kart_states;
00045 };
00046 
00047 
00048 class ReplayBase
00049 {
00050 public:
00051     static const std::string REPLAY_FOLDER;
00052     static const std::string REPLAY_FILE_EXTENSION_HUMAN_READABLE;
00053     static const std::string REPLAY_FILE_EXTENSION_BINARY;
00054 
00055 public:
00056 
00057     ReplayBase();
00058     virtual ~ReplayBase();
00059 
00060     virtual void    destroy();
00061 
00062     bool            saveReplayHumanReadable( FILE *fd ) const { return m_ReplayBuffers.saveReplayHumanReadable( fd ); }
00063 
00064 private:
00065 
00066 protected:
00067     ReplayBuffers   m_ReplayBuffers;
00068 };
00069 
00070 
00071 
00072 
00073 
00074 #endif // HAVE_GHOST_REPLAY
00075 
00076 #endif // HEADER_REPLAYBASE_H
00077