File diff r18218:2a27481f55c8 → r18219:9a85d923ce33
src/saveload/gamelog_sl.cpp
Show inline comments
 
@@ -11,6 +11,7 @@
 

	
 
#include "../stdafx.h"
 
#include "../gamelog_internal.h"
 
#include "../fios.h"
 

	
 
#include "saveload.h"
 

	
 
@@ -101,15 +102,15 @@ static const SaveLoad * const _glog_desc
 

	
 
assert_compile(lengthof(_glog_desc) == GLCT_END);
 

	
 
static void Load_GLOG()
 
static void Load_GLOG_common(LoggedAction *&gamelog_action, uint &gamelog_actions)
 
{
 
	assert(_gamelog_action == NULL);
 
	assert(_gamelog_actions == 0);
 
	assert(gamelog_action == NULL);
 
	assert(gamelog_actions == 0);
 

	
 
	GamelogActionType at;
 
	while ((at = (GamelogActionType)SlReadByte()) != GLAT_NONE) {
 
		_gamelog_action = ReallocT(_gamelog_action, _gamelog_actions + 1);
 
		LoggedAction *la = &_gamelog_action[_gamelog_actions++];
 
		gamelog_action = ReallocT(gamelog_action, gamelog_actions + 1);
 
		LoggedAction *la = &gamelog_action[gamelog_actions++];
 

	
 
		la->at = at;
 

	
 
@@ -165,7 +166,16 @@ static void Save_GLOG()
 
	SlWriteByte(GLAT_NONE);
 
}
 

	
 
static void Load_GLOG()
 
{
 
	Load_GLOG_common(_gamelog_action, _gamelog_actions);
 
}
 

	
 
static void Check_GLOG()
 
{
 
	Load_GLOG_common(_load_check_data.gamelog_action, _load_check_data.gamelog_actions);
 
}
 

	
 
extern const ChunkHandler _gamelog_chunk_handlers[] = {
 
	{ 'GLOG', Save_GLOG, Load_GLOG, NULL, NULL, CH_RIFF | CH_LAST }
 
	{ 'GLOG', Save_GLOG, Load_GLOG, NULL, Check_GLOG, CH_RIFF | CH_LAST }
 
};