1
0
Fork 0

(svn r1456) Simplify isWagon(), make it static and give it a canonical name (IsWagon)

release/0.4.5
tron 2005-01-10 08:25:43 +00:00
parent aacb89ed53
commit b9fed3391b
1 changed files with 4 additions and 9 deletions

View File

@ -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) // 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) { return index < NUM_TRAIN_ENGINES && RailVehInfo(index)->flags & RVI_WAGON;
const RailVehicleInfo *rvi = &_rail_vehicle_info[index];
if(rvi->flags & RVI_WAGON)
return true;
}
return false;
} }
static void NewVehicleAvailable(Engine *e) static void NewVehicleAvailable(Engine *e)
@ -765,7 +760,7 @@ static void NewVehicleAvailable(Engine *e)
e->player_avail = (byte)-1; e->player_avail = (byte)-1;
// Do not introduce new rail wagons // Do not introduce new rail wagons
if(isWagon(index)) if (IsWagon(index))
return; return;
// make maglev / monorail available // make maglev / monorail available
@ -805,7 +800,7 @@ void EnginesMonthlyLoop()
e->flags |= ENGINE_INTRODUCING; e->flags |= ENGINE_INTRODUCING;
// Do not introduce new rail wagons // 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. e->preview_player = 1; // Give to the player with the highest rating.
} }
} }