From b8c9194b7c65495765f94ae7643c4592f5652427 Mon Sep 17 00:00:00 2001 From: ludde Date: Fri, 29 Jul 2005 22:13:04 +0000 Subject: (svn r2756) Renamed railtypes into _railtypes Renamed railtypes.c into railtypes.h, all other tables are in .h files. (It should be in the tables dir but I couldn't figure out how to get it there without deleting it first). Added const and extern. --- Makefile | 1 - rail.h | 6 +++--- rail_cmd.c | 1 + railtypes.c | 61 ------------------------------------------------------------- railtypes.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 65 deletions(-) delete mode 100644 railtypes.c create mode 100644 railtypes.h diff --git a/Makefile b/Makefile index bc11b0de2..018278c31 100644 --- a/Makefile +++ b/Makefile @@ -670,7 +670,6 @@ C_SOURCES += queue.c C_SOURCES += rail.c C_SOURCES += rail_cmd.c C_SOURCES += rail_gui.c -C_SOURCES += railtypes.c C_SOURCES += rev.c C_SOURCES += road_cmd.c C_SOURCES += road_gui.c diff --git a/rail.h b/rail.h index 387fc3fb4..631d35e4b 100644 --- a/rail.h +++ b/rail.h @@ -161,7 +161,7 @@ typedef struct RailtypeInfo { byte compatible_railtypes; } RailtypeInfo; -RailtypeInfo railtypes[RAILTYPE_END]; +extern const RailtypeInfo _railtypes[RAILTYPE_END]; // these are the maximums used for updating signal blocks, and checking if a depot is in a pbs block enum { @@ -528,10 +528,10 @@ static inline TransportType GetCrossingTransportType(TileIndex tile, Track track * @param railtype the rail type which the information is requested for * @return The pointer to the RailtypeInfo */ -static inline RailtypeInfo *GetRailTypeInfo(RailType railtype) +static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype) { assert(railtype < RAILTYPE_END); - return &railtypes[railtype]; + return &_railtypes[railtype]; } /** diff --git a/rail_cmd.c b/rail_cmd.c index ca854fa5e..05367a8b2 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -22,6 +22,7 @@ #include "waypoint.h" #include "npf.h" #include "rail.h" +#include "railtypes.h" // include table for railtypes extern uint16 _custom_sprites_base; diff --git a/railtypes.c b/railtypes.c deleted file mode 100644 index 9305a58eb..000000000 --- a/railtypes.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $Id: */ - -#include "stdafx.h" -#include "openttd.h" -#include "rail.h" -#include "table/sprites.h" - -/** @file railtypes.c - * All the railtype-specific information is stored here. - */ - -/** Global Railtype definition - */ -RailtypeInfo railtypes[RAILTYPE_END] = { - { - { - SPR_RAIL_TRACK_Y, - SPR_RAIL_TRACK_N_S, - SPR_RAIL_TRACK_BASE, - SPR_RAIL_SINGLE_Y, - SPR_RAIL_SINGLE_X, - SPR_RAIL_SINGLE_NORTH, - SPR_RAIL_SINGLE_SOUTH, - SPR_RAIL_SINGLE_EAST, - SPR_RAIL_SINGLE_WEST - }, - SPR_RAIL_SNOW_OFFSET, - (1 << RAILTYPE_RAIL), - }, - { - { - SPR_MONO_TRACK_Y, - SPR_MONO_TRACK_N_S, - SPR_MONO_TRACK_BASE, - SPR_MONO_SINGLE_Y, - SPR_MONO_SINGLE_X, - SPR_MONO_SINGLE_NORTH, - SPR_MONO_SINGLE_SOUTH, - SPR_MONO_SINGLE_EAST, - SPR_MONO_SINGLE_WEST - }, - SPR_MONO_SNOW_OFFSET, - (1 << RAILTYPE_MONO), - }, - { - { - SPR_MGLV_TRACK_Y, - SPR_MGLV_TRACK_N_S, - SPR_MGLV_TRACK_BASE, - SPR_MGLV_SINGLE_Y, - SPR_MGLV_SINGLE_X, - SPR_MGLV_SINGLE_NORTH, - SPR_MGLV_SINGLE_SOUTH, - SPR_MGLV_SINGLE_EAST, - SPR_MGLV_SINGLE_WEST - }, - SPR_MGLV_SNOW_OFFSET, - (1 << RAILTYPE_MAGLEV), - }, -}; - diff --git a/railtypes.h b/railtypes.h new file mode 100644 index 000000000..d89832bc5 --- /dev/null +++ b/railtypes.h @@ -0,0 +1,56 @@ +/* $Id: */ + +/** @file railtypes.h + * All the railtype-specific information is stored here. + */ + +/** Global Railtype definition + */ +const RailtypeInfo _railtypes[RAILTYPE_END] = { + { + { + SPR_RAIL_TRACK_Y, + SPR_RAIL_TRACK_N_S, + SPR_RAIL_TRACK_BASE, + SPR_RAIL_SINGLE_Y, + SPR_RAIL_SINGLE_X, + SPR_RAIL_SINGLE_NORTH, + SPR_RAIL_SINGLE_SOUTH, + SPR_RAIL_SINGLE_EAST, + SPR_RAIL_SINGLE_WEST + }, + SPR_RAIL_SNOW_OFFSET, + (1 << RAILTYPE_RAIL), + }, + { + { + SPR_MONO_TRACK_Y, + SPR_MONO_TRACK_N_S, + SPR_MONO_TRACK_BASE, + SPR_MONO_SINGLE_Y, + SPR_MONO_SINGLE_X, + SPR_MONO_SINGLE_NORTH, + SPR_MONO_SINGLE_SOUTH, + SPR_MONO_SINGLE_EAST, + SPR_MONO_SINGLE_WEST + }, + SPR_MONO_SNOW_OFFSET, + (1 << RAILTYPE_MONO), + }, + { + { + SPR_MGLV_TRACK_Y, + SPR_MGLV_TRACK_N_S, + SPR_MGLV_TRACK_BASE, + SPR_MGLV_SINGLE_Y, + SPR_MGLV_SINGLE_X, + SPR_MGLV_SINGLE_NORTH, + SPR_MGLV_SINGLE_SOUTH, + SPR_MGLV_SINGLE_EAST, + SPR_MGLV_SINGLE_WEST + }, + SPR_MGLV_SNOW_OFFSET, + (1 << RAILTYPE_MAGLEV), + }, +}; + -- cgit v1.2.3-70-g09d2