1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/***************************************************************************
replay.h - description
-------------------
begin : Sun Jan 21 2001
copyright : (C) 2001 by Martin Bickel
email : bickel@asc-hq.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef replayH
#define replayH
#include "events.h"
#include "ascstring.h"
#include "gamemap.h"
#include "basestreaminterface.h"
/*! \file replay.h
\brief Interface for recording and playing replays
*/
class ReplayMapDisplay;
class trunreplay {
ASCString lastErrorMessage;
ReplayMapDisplay* replayMapDisplay;
protected:
int movenum;
void execnextreplaymove ( void );
GameMap* orgmap;
MemoryStream* stream;
void wait ( int t = ticker );
void wait ( MapCoordinate pos, int t = ticker );
void wait ( MapCoordinate pos1, MapCoordinate pos2, int t = ticker );
int actplayer;
void error( const char* message, ... );
void error( const MapCoordinate& pos, const char* message, ... );
void error( const ASCString& message );
void error( const MapCoordinate& pos, const ASCString& message );
void error( const ActionResult& res );
int nextaction;
Context createReplayContext();
void readnextaction ( void );
void displayActionCursor ( int x1, int y1, int x2 = -1, int y2 = -1, int secondWait = 0 );
void removeActionCursor( void );
public:
trunreplay();
int status;
void firstinit();
int run ( int player, int viewingplayer, bool performEndTurnOperations );
~trunreplay();
};
class LockReplayRecording {
GameMap::ReplayInfo& ri;
public:
LockReplayRecording ( GameMap::ReplayInfo& _ri );
~LockReplayRecording();
};
extern trunreplay runreplay;
//! a hack to enable the replay in a game that was started without replays
extern int startreplaylate;
//! checks if there is replay information and -if there is any- runs the replay
extern void checkforreplay ( void );
//! Initialized the replay logging at the beginning of a players or the ai's turn.
extern void initReplayLogging( Player& player );
//! runs the replay for the given player
extern void runSpecificReplay( int player, int viewingplayer, bool performEndTurnOperations = true );
//! runs the replay of the current player. This is used primarily for debugging the replay system
extern void viewOwnReplay( Player& player );
//! initialized the replay system at program startup
extern void hookReplayToSystem();
#endif
|