mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r14158) -Codechange: Initialization of rail type data from static source, so data can be changed.
This commit is contained in:
parent
ff07598ce2
commit
2f80a277eb
@ -5422,6 +5422,9 @@ static void ResetNewGRFData()
|
|||||||
/* Copy/reset original bridge info data */
|
/* Copy/reset original bridge info data */
|
||||||
ResetBridges();
|
ResetBridges();
|
||||||
|
|
||||||
|
/* Reset rail type information */
|
||||||
|
ResetRailTypes();
|
||||||
|
|
||||||
/* Allocate temporary refit/cargo class data */
|
/* Allocate temporary refit/cargo class data */
|
||||||
_gted = CallocT<GRFTempEngineData>(GetEnginePoolSize());
|
_gted = CallocT<GRFTempEngineData>(GetEnginePoolSize());
|
||||||
|
|
||||||
|
@ -237,4 +237,9 @@ RailType GetBestRailtype(const PlayerID p);
|
|||||||
*/
|
*/
|
||||||
RailTypes GetPlayerRailtypes(const PlayerID p);
|
RailTypes GetPlayerRailtypes(const PlayerID p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset all rail type information to its default values.
|
||||||
|
*/
|
||||||
|
void ResetRailTypes();
|
||||||
|
|
||||||
#endif /* RAIL_H */
|
#endif /* RAIL_H */
|
||||||
|
@ -54,6 +54,19 @@
|
|||||||
#include "table/railtypes.h"
|
#include "table/railtypes.h"
|
||||||
#include "table/track_land.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] = {
|
const byte _track_sloped_sprites[14] = {
|
||||||
14, 15, 22, 13,
|
14, 15, 22, 13,
|
||||||
0, 21, 17, 12,
|
0, 21, 17, 12,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
/** Global Railtype definition
|
/** Global Railtype definition
|
||||||
*/
|
*/
|
||||||
RailtypeInfo _railtypes[] = {
|
static const RailtypeInfo _original_railtypes[] = {
|
||||||
/** Railway */
|
/** Railway */
|
||||||
{ /* Main Sprites */
|
{ /* Main Sprites */
|
||||||
{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_Y, SPR_RAIL_SINGLE_X,
|
{ SPR_RAIL_TRACK_Y, SPR_RAIL_TRACK_N_S, SPR_RAIL_TRACK_BASE, SPR_RAIL_SINGLE_Y, SPR_RAIL_SINGLE_X,
|
||||||
|
Loading…
Reference in New Issue
Block a user