(svn r1456) Simplify isWagon(), make it static and give it a canonical name (IsWagon)
--- a/engine.c Mon Jan 10 07:26:19 2005 +0000
+++ b/engine.c Mon Jan 10 08:25:43 2005 +0000
@@ -717,14 +717,9 @@
}
// 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 @@
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 @@
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.
}
}