summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-08 18:16:26 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-08 18:16:26 +0000
commit814f47a3cc63934c2f111ec87a3d84bc2b4524c4 (patch)
tree8988827c54087526a11977da8d855a0af9208193
parent352f13dad15d2786d8aacaf814f1bfb2b8ea7d15 (diff)
downloadopenttd-814f47a3cc63934c2f111ec87a3d84bc2b4524c4.tar.xz
(svn r11783) -Codechange: compare engine type with its type property, not by its index
-rw-r--r--src/engine.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 8920bc4b5..856c2c25c 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -329,15 +329,14 @@ static void NewVehicleAvailable(Engine *e)
/* Do not introduce new rail wagons */
if (IsWagon(index)) return;
- if (index < NUM_TRAIN_ENGINES) {
+ if (e->type == VEH_TRAIN) {
/* maybe make another rail type available */
RailType railtype = RailVehInfo(index)->railtype;
assert(railtype < RAILTYPE_END);
FOR_ALL_PLAYERS(p) {
if (p->is_active) SetBit(p->avail_railtypes, railtype);
}
- }
- if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
+ } else if (e->type == VEH_ROAD) {
/* maybe make another road type available */
FOR_ALL_PLAYERS(p) {
if (p->is_active) SetBit(p->avail_roadtypes, HasBit(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);