00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef replayH
00019 #define replayH
00020
00021 #include "events.h"
00022 #include "ascstring.h"
00023 #include "gamemap.h"
00024 #include "basestreaminterface.h"
00025
00031 enum trpl_actions { rpl_attack,
00032 rpl_move,
00033 rpl_changeheight,
00034 rpl_convert,
00035 rpl_remobj,
00036 rpl_buildobj,
00037 rpl_putbuilding,
00038 rpl_removebuilding,
00039 rpl_putmine,
00040 rpl_removemine,
00041 rpl_produceunit,
00042 rpl_removeunit,
00043 rpl_trainunit,
00044 rpl_reactionfire,
00045 rpl_finished,
00046 rpl_shareviewchange,
00047 rpl_alliancechange,
00048 rpl_move2,
00049 rpl_buildtnk,
00050 rpl_refuel,
00051 rpl_bldrefuel,
00052 rpl_move3,
00053 rpl_changeheight2,
00054 rpl_buildtnk2,
00055 rpl_moveUnitUpDown,
00056 rpl_move4,
00057 rpl_productionResourceUsage,
00058 rpl_buildtnk3,
00059 rpl_refuel2,
00060 rpl_buildobj2,
00061 rpl_remobj2,
00062 rpl_repairUnit,
00063 rpl_repairUnit2,
00064 rpl_refuel3,
00065 rpl_produceAmmo,
00066 rpl_buildtnk4,
00067 rpl_buildProdLine,
00068 rpl_removeProdLine,
00069 rpl_setResearch,
00070 rpl_techResearched,
00071 rpl_putbuilding2,
00072 rpl_setGeneratorStatus,
00073 rpl_cutFromGame,
00074 rpl_removebuilding2,
00075 rpl_setResourceProcessingAmount,
00076 rpl_removebuilding3,
00077 rpl_netcontrol,
00078 rpl_move5,
00079 rpl_alliancechange2,
00080 rpl_moveUnitUp,
00081 rpl_jump,
00082 rpl_repairBuilding,
00083 rpl_recycleUnit,
00084 rpl_convert2,
00085 rpl_putmine2,
00086 rpl_repairUnit3,
00087 rpl_transferTribute,
00088 rpl_reactionFireOn,
00089 rpl_reactionFireOff,
00090 rpl_selfdestruct,
00091 rpl_cancelResearch };
00092
00093 extern void logtoreplayinfo ( trpl_actions action, ... );
00094
00095 struct treactionfire_replayinfo;
00096
00097 class trunreplay {
00098 ASCString lastErrorMessage;
00099 protected:
00100 int movenum;
00101 void execnextreplaymove ( void );
00102 GameMap* orgmap;
00103 tmemorystream* stream;
00104 void wait ( int t = ticker );
00105 void wait ( MapCoordinate pos, int t = ticker );
00106 void wait ( MapCoordinate pos1, MapCoordinate pos2, int t = ticker );
00107 int actplayer;
00108
00109 void error( const char* message, ... );
00110 void error( const MapCoordinate& pos, const char* message, ... );
00111 void error( const ASCString& message );
00112 void error( const MapCoordinate& pos, const ASCString& message );
00113
00114 char nextaction;
00115
00116 void readnextaction ( void );
00117 void displayActionCursor ( int x1, int y1, int x2 = -1, int y2 = -1, int secondWait = 0 );
00118 void removeActionCursor( void );
00119
00120 public:
00121
00122 treactionfire_replayinfo* getnextreplayinfo ( void );
00123
00124 trunreplay ( void );
00125 int status;
00126 void firstinit ( void );
00127 int run ( int player, int viewingplayer, bool performEndTurnOperations );
00128 };
00129
00130 class LockReplayRecording {
00131 GameMap::ReplayInfo& ri;
00132 public:
00133 LockReplayRecording ( GameMap::ReplayInfo& _ri );
00134 ~LockReplayRecording();
00135 };
00136
00137 extern trunreplay runreplay;
00138
00140 extern int startreplaylate;
00141
00143 extern void checkforreplay ( void );
00144
00146 extern void initReplayLogging( Player& player );
00147
00149 extern void runSpecificReplay( int player, int viewingplayer, bool performEndTurnOperations = true );
00150
00152 extern void viewOwnReplay( Player& player );
00153
00155 extern void hookReplayToSystem();
00156
00157 #endif