Changeset - r15330:4bbcc5af5e21
[Not reviewed]
master
0 4 0
frosch - 14 years ago 2010-06-13 14:15:58
frosch@openttd.org
(svn r19981) -Add: Read NewGRF configuration during SL_LOAD_CHECK.
4 files changed with 26 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/fios.h
Show inline comments
 
@@ -20,6 +20,7 @@
 
#include "date_type.h"
 
#include "settings_type.h"
 
#include "company_base.h"
 
#include "newgrf_config.h"
 

	
 

	
 
typedef SmallMap<uint, CompanyProperties *> CompanyPropertiesMap;
 
@@ -39,7 +40,10 @@ struct LoadCheckData {
 

	
 
	CompanyPropertiesMap companies;               ///< Company information.
 

	
 
	LoadCheckData() : error_data(NULL)
 
	GRFConfig *grfconfig;                         ///< NewGrf configuration from save.
 
	GRFListCompatibility grf_compatibility;       ///< Summary state of NewGrfs, whether missing files or only compatible found.
 

	
 
	LoadCheckData() : error_data(NULL), grfconfig(NULL)
 
	{
 
		this->Clear();
 
	}
src/fios_gui.cpp
Show inline comments
 
@@ -54,6 +54,8 @@ void LoadCheckData::Clear()
 
		delete it->second;
 
	}
 
	companies.Clear();
 

	
 
	ClearGRFConfigList(&this->grfconfig);
 
}
 

	
 

	
src/saveload/newgrf_sl.cpp
Show inline comments
 
@@ -14,6 +14,7 @@
 
#include "../core/bitmath_func.hpp"
 
#include "../core/alloc_func.hpp"
 
#include "../gfx_func.h"
 
#include "../fios.h"
 

	
 
#include "saveload.h"
 

	
 
@@ -40,20 +41,30 @@ static void Save_NGRF()
 
}
 

	
 

	
 
static void Load_NGRF()
 
static void Load_NGRF_common(GRFConfig *&grfconfig)
 
{
 
	ClearGRFConfigList(&_grfconfig);
 
	ClearGRFConfigList(&grfconfig);
 
	while (SlIterateArray() != -1) {
 
		GRFConfig *c = new GRFConfig();
 
		SlObject(c, _grfconfig_desc);
 
		if (CheckSavegameVersion(101)) c->windows_paletted = (_use_palette == PAL_WINDOWS);
 
		AppendToGRFConfigList(&_grfconfig, c);
 
		AppendToGRFConfigList(&grfconfig, c);
 
	}
 
}
 

	
 
static void Load_NGRF()
 
{
 
	Load_NGRF_common(_grfconfig);
 

	
 
	/* Append static NewGRF configuration */
 
	AppendStaticGRFConfigs(&_grfconfig);
 
}
 

	
 
static void Check_NGRF()
 
{
 
	Load_NGRF_common(_load_check_data.grfconfig);
 
}
 

	
 
extern const ChunkHandler _newgrf_chunk_handlers[] = {
 
	{ 'NGRF', Save_NGRF, Load_NGRF, NULL, NULL, CH_ARRAY | CH_LAST }
 
	{ 'NGRF', Save_NGRF, Load_NGRF, NULL, Check_NGRF, CH_ARRAY | CH_LAST }
 
};
src/saveload/saveload.cpp
Show inline comments
 
@@ -2123,7 +2123,10 @@ SaveOrLoadResult SaveOrLoad(const char *
 

	
 
			_savegame_type = SGT_OTTD;
 

	
 
			if (mode != SL_LOAD_CHECK) {
 
			if (mode == SL_LOAD_CHECK) {
 
				/* The only part from AfterLoadGame() we need */
 
				_load_check_data.grf_compatibility = IsGoodGRFConfigList(_load_check_data.grfconfig);
 
			} else {
 
				GamelogStartAction(GLAT_LOAD);
 

	
 
				/* After loading fix up savegame for any internal changes that
0 comments (0 inline, 0 general)