summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-10 08:25:43 +0000
committertron <tron@openttd.org>2005-01-10 08:25:43 +0000
commitb9fed3391b42d7b7355b60e708ecf703f7685bb9 (patch)
tree6f5d5dea13087a8b7c0821443f7dd787972f3f5b
parentaacb89ed53e99c233c0394fd9a1e61ee466c107c (diff)
downloadopenttd-b9fed3391b42d7b7355b60e708ecf703f7685bb9.tar.xz
(svn r1456) Simplify isWagon(), make it static and give it a canonical name (IsWagon)
-rw-r--r--engine.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/engine.c b/engine.c
index 749bb9b4a..652aa7a78 100644
--- a/engine.c
+++ b/engine.c
@@ -717,14 +717,9 @@ int32 CmdWantEnginePreview(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
// Determine if an engine type is a wagon (and not a loco)
-bool isWagon(byte index)
+static bool IsWagon(byte index)
{
- if (index < NUM_TRAIN_ENGINES) {
- const RailVehicleInfo *rvi = &_rail_vehicle_info[index];
- if(rvi->flags & RVI_WAGON)
- return true;
- }
- return false;
+ return index < NUM_TRAIN_ENGINES && RailVehInfo(index)->flags & RVI_WAGON;
}
static void NewVehicleAvailable(Engine *e)
@@ -765,7 +760,7 @@ static void NewVehicleAvailable(Engine *e)
e->player_avail = (byte)-1;
// Do not introduce new rail wagons
- if(isWagon(index))
+ if (IsWagon(index))
return;
// make maglev / monorail available
@@ -805,7 +800,7 @@ void EnginesMonthlyLoop()
e->flags |= ENGINE_INTRODUCING;
// Do not introduce new rail wagons
- if(!isWagon(e - _engines))
+ if (!IsWagon(e - _engines))
e->preview_player = 1; // Give to the player with the highest rating.
}
}