diff options
author | peter1138 <peter1138@openttd.org> | 2010-01-30 21:49:22 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2010-01-30 21:49:22 +0000 |
commit | 32ef582c37e3fda64c61b36acb398c235f8292a2 (patch) | |
tree | 1ec6619223efc5014137e26228c412d7441af617 /src/rail_cmd.cpp | |
parent | 84c6616ee06884ec06609dc7256738c03a06197c (diff) | |
download | openttd-32ef582c37e3fda64c61b36acb398c235f8292a2.tar.xz |
(svn r18969) -Add: [NewGRF] NewGRF-settable rail type properties.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index fa751e505..22e45c7b8 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -52,6 +52,26 @@ void ResetRailTypes() memcpy(_railtypes, _original_railtypes, sizeof(_original_railtypes)); } +RailType AllocateRailType(RailTypeLabel label) +{ + for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { + RailtypeInfo *rti = &_railtypes[rt]; + + if (rti->label == 0) { + /* Set up new rail type */ + memcpy(rti, &_railtypes[RAILTYPE_RAIL], sizeof(*rti)); + rti->label = label; + + /* Make us compatible with ourself. */ + rti->powered_railtypes = (RailTypes)(1 << rt); + rti->compatible_railtypes = (RailTypes)(1 << rt); + return rt; + } + } + + return INVALID_RAILTYPE; +} + static const byte _track_sloped_sprites[14] = { 14, 15, 22, 13, 0, 21, 17, 12, |