equal
deleted
inserted
replaced
1 /* $Id$ */ |
1 /* $Id$ */ |
2 |
2 |
3 /** @file rail.cpp */ |
3 /** @file rail.cpp Implementation of rail specific functions. */ |
4 |
4 |
5 #include "stdafx.h" |
5 #include "stdafx.h" |
6 #include "openttd.h" |
6 #include "openttd.h" |
7 #include "bridge_map.h" |
7 #include "bridge_map.h" |
8 #include "rail.h" |
8 #include "rail.h" |
12 #include "settings_type.h" |
12 #include "settings_type.h" |
13 #include "date_func.h" |
13 #include "date_func.h" |
14 #include "player_func.h" |
14 #include "player_func.h" |
15 #include "player_base.h" |
15 #include "player_base.h" |
16 #include "engine_func.h" |
16 #include "engine_func.h" |
|
17 #include "engine_base.h" |
17 |
18 |
18 |
19 |
19 /* XXX: Below 3 tables store duplicate data. Maybe remove some? */ |
20 /* XXX: Below 3 tables store duplicate data. Maybe remove some? */ |
20 /* Maps a trackdir to the bit that stores its status in the map arrays, in the |
21 /* Maps a trackdir to the bit that stores its status in the map arrays, in the |
21 * direction along with the trackdir */ |
22 * direction along with the trackdir */ |
200 |
201 |
201 RailTypes GetPlayerRailtypes(PlayerID p) |
202 RailTypes GetPlayerRailtypes(PlayerID p) |
202 { |
203 { |
203 RailTypes rt = RAILTYPES_NONE; |
204 RailTypes rt = RAILTYPES_NONE; |
204 |
205 |
205 EngineID i; |
206 Engine *e; |
206 FOR_ALL_ENGINEIDS_OF_TYPE(i, VEH_TRAIN) { |
207 FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) { |
207 const Engine* e = GetEngine(i); |
208 const EngineInfo *ei = &e->info; |
208 const EngineInfo *ei = EngInfo(i); |
|
209 |
209 |
210 if (HasBit(ei->climates, _opt.landscape) && |
210 if (HasBit(ei->climates, _opt.landscape) && |
211 (HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) { |
211 (HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) { |
212 const RailVehicleInfo *rvi = RailVehInfo(i); |
212 const RailVehicleInfo *rvi = &e->u.rail; |
213 |
213 |
214 if (rvi->railveh_type != RAILVEH_WAGON) { |
214 if (rvi->railveh_type != RAILVEH_WAGON) { |
215 assert(rvi->railtype < RAILTYPE_END); |
215 assert(rvi->railtype < RAILTYPE_END); |
216 SetBit(rt, rvi->railtype); |
216 SetBit(rt, rvi->railtype); |
217 } |
217 } |