Changeset - r10001:05b97b3a1a5d
[Not reviewed]
master
0 4 0
peter1138 - 16 years ago 2008-08-24 23:00:11
peter1138@openttd.org
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
4 files changed with 22 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -5422,6 +5422,9 @@ static void ResetNewGRFData()
 
	/* Copy/reset original bridge info data */
 
	ResetBridges();
 

	
 
	/* Reset rail type information */
 
	ResetRailTypes();
 

	
 
	/* Allocate temporary refit/cargo class data */
 
	_gted = CallocT<GRFTempEngineData>(GetEnginePoolSize());
 

	
src/rail.h
Show inline comments
 
@@ -237,4 +237,9 @@ RailType GetBestRailtype(const PlayerID 
 
 */
 
RailTypes GetPlayerRailtypes(const PlayerID p);
 

	
 
/**
 
 * Reset all rail type information to its default values.
 
 */
 
void ResetRailTypes();
 

	
 
#endif /* RAIL_H */
src/rail_cmd.cpp
Show inline comments
 
@@ -54,6 +54,19 @@
 
#include "table/railtypes.h"
 
#include "table/track_land.h"
 

	
 
RailtypeInfo _railtypes[RAILTYPE_END];
 

	
 
assert_compile(sizeof(_original_railtypes) <= sizeof(_railtypes));
 

	
 
/**
 
 * Initialize rail type information.
 
 */
 
void ResetRailTypes()
 
{
 
	memset(_railtypes, 0, sizeof(_railtypes));
 
	memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes));
 
}
 

	
 
const byte _track_sloped_sprites[14] = {
 
	14, 15, 22, 13,
 
	 0, 21, 17, 12,
src/table/railtypes.h
Show inline comments
 
@@ -9,7 +9,7 @@
 

	
 
/** Global Railtype definition
 
 */
 
RailtypeInfo _railtypes[] = {
 
static const RailtypeInfo _original_railtypes[] = {
 
	/** Railway */
 
	{ /* Main Sprites */
 
		{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_Y, SPR_RAIL_SINGLE_X,
0 comments (0 inline, 0 general)