Skip to content
Browse files

fixed some compile errors with the previous revision due to removing …

…some actually necessary code

cleaned up some logic with the previous revision

git-svn-id: http://ghostplusplus.googlecode.com/svn/trunk@417 a7494f72-a4b0-11dd-a887-7ffe1a420f8d
  • Loading branch information...
1 parent 0ecfea2 commit 6fcb012ecb7e0699d7f94fac0cdabc910e24c584 hogantp committed Apr 4, 2010
Showing with 8 additions and 40 deletions.
  1. +5 −39 ghost/replay.cpp
  2. +3 −1 ghost/replay.h
View
44 ghost/replay.cpp
@@ -52,7 +52,7 @@ void CReplay :: AddLeaveGame( uint32_t reason, unsigned char PID, uint32_t resul
Block.push_back( PID );
UTIL_AppendByteArray( Block, result, false );
UTIL_AppendByteArray( Block, (uint32_t)1, false );
- m_Blocks.push( Block );
+ m_CompiledBlocks += string( Block.begin( ), Block.end( ) );
}
void CReplay :: AddLeaveGameDuringLoading( uint32_t reason, unsigned char PID, uint32_t result )
@@ -87,7 +87,7 @@ void CReplay :: AddTimeSlot2( queue<CIncomingAction *> actions )
BYTEARRAY LengthBytes = UTIL_CreateByteArray( (uint16_t)( Block.size( ) - 3 ), false );
Block[1] = LengthBytes[0];
Block[2] = LengthBytes[1];
- m_Blocks.push( Block );
+ m_CompiledBlocks += string( Block.begin( ), Block.end( ) );
}
void CReplay :: AddTimeSlot( uint16_t timeIncrement, queue<CIncomingAction *> actions )
@@ -111,11 +111,8 @@ void CReplay :: AddTimeSlot( uint16_t timeIncrement, queue<CIncomingAction *> ac
BYTEARRAY LengthBytes = UTIL_CreateByteArray( (uint16_t)( Block.size( ) - 3 ), false );
Block[1] = LengthBytes[0];
Block[2] = LengthBytes[1];
- m_Blocks.push( Block );
-
- // incrementally build the replay as more blocks are added
-
- BuildMoreBlocks( );
+ m_CompiledBlocks += string( Block.begin( ), Block.end( ) );
+ m_ReplayLength += timeIncrement;
}
void CReplay :: AddChatMessage( unsigned char PID, unsigned char flags, uint32_t chatMode, string message )
@@ -133,39 +130,14 @@ void CReplay :: AddChatMessage( unsigned char PID, unsigned char flags, uint32_t
BYTEARRAY LengthBytes = UTIL_CreateByteArray( (uint16_t)( Block.size( ) - 4 ), false );
Block[2] = LengthBytes[0];
Block[3] = LengthBytes[1];
- m_Blocks.push( Block );
-}
-
-void CReplay :: AddBlock( BYTEARRAY &block )
-{
- m_Blocks.push( block );
+ m_CompiledBlocks += string( Block.begin( ), Block.end( ) );
}
void CReplay :: AddLoadingBlock( BYTEARRAY &loadingBlock )
{
m_LoadingBlocks.push( loadingBlock );
}
-void CReplay :: BuildMoreBlocks( )
-{
- if( m_CompiledBlocks.empty( ) )
- m_ReplayLength = 0;
-
- while( !m_Blocks.empty( ) )
- {
- BYTEARRAY Block = m_Blocks.front( );
- m_Blocks.pop( );
-
- if( Block.size( ) >= 5 && Block[0] == REPLAY_TIMESLOT )
- {
- uint16_t TimeIncrement = UTIL_ByteArrayToUInt16( Block, false, 3 );
- m_ReplayLength += TimeIncrement;
- }
-
- m_CompiledBlocks += string( Block.begin( ), Block.end( ) );
- }
-}
-
void CReplay :: BuildReplay( string gameName, string statString, uint32_t war3Version, uint16_t buildNumber )
{
m_War3Version = war3Version;
@@ -242,12 +214,6 @@ void CReplay :: BuildReplay( string gameName, string statString, uint32_t war3Ve
Replay.push_back( REPLAY_THIRDSTARTBLOCK );
UTIL_AppendByteArray( Replay, (uint32_t)1, false );
- // finalize the replay
- // although we do this every time a timeslot is added it's possible some leavegames or chat messages or etc have been added since the last timeslot
- // therefore it's required
-
- BuildMoreBlocks( );
-
// done
m_Decompressed = string( Replay.begin( ), Replay.end( ) );
View
4 ghost/replay.h
@@ -58,6 +58,7 @@ class CReplay : public CPacked
unsigned char m_StartSpotCount;
queue<BYTEARRAY> m_LoadingBlocks;
queue<BYTEARRAY> m_Blocks;
+ queue<uint32_t> m_CheckSums;
string m_CompiledBlocks;
public:
@@ -77,6 +78,7 @@ class CReplay : public CPacked
unsigned char GetStartSpotCount( ) { return m_StartSpotCount; }
queue<BYTEARRAY> *GetLoadingBlocks( ) { return &m_LoadingBlocks; }
queue<BYTEARRAY> *GetBlocks( ) { return &m_Blocks; }
+ queue<uint32_t> *GetCheckSums( ) { return &m_CheckSums; }
void AddPlayer( unsigned char nPID, string nName ) { m_Players.push_back( PIDPlayer( nPID, nName ) ); }
void SetSlots( vector<CGameSlot> nSlots ) { m_Slots = nSlots; }
@@ -92,9 +94,9 @@ class CReplay : public CPacked
void AddTimeSlot2( queue<CIncomingAction *> actions );
void AddTimeSlot( uint16_t timeIncrement, queue<CIncomingAction *> actions );
void AddChatMessage( unsigned char PID, unsigned char flags, uint32_t chatMode, string message );
+ void AddCheckSum( uint32_t checkSum );
void AddBlock( BYTEARRAY &block );
void AddLoadingBlock( BYTEARRAY &loadingBlock );
- void BuildMoreBlocks( );
void BuildReplay( string gameName, string statString, uint32_t war3Version, uint16_t buildNumber );
void ParseReplay( bool parseBlocks );

0 comments on commit 6fcb012

Please sign in to comment.
Something went wrong with that request. Please try again.