From dba55a574210406109408d2069c41cc783f9a519 Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 27 Jan 2005 21:18:03 +0000 Subject: (svn r1701) Style police ^^ --- aircraft_cmd.c | 2 +- engine.c | 15 +++++++-------- engine.h | 2 +- roadveh_cmd.c | 2 +- ship_cmd.c | 2 +- train_cmd.c | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/aircraft_cmd.c b/aircraft_cmd.c index 7525b6a6c..201cc8bf3 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -161,7 +161,7 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) const AircraftVehicleInfo *avi = AircraftVehInfo(p1); Engine *e; - if (!(IsEngineBuildable(p1, VEH_Aircraft))) return CMD_ERROR; + if (!IsEngineBuildable(p1, VEH_Aircraft)) return CMD_ERROR; SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); diff --git a/engine.c b/engine.c index 93cba6351..0656f88f9 100644 --- a/engine.c +++ b/engine.c @@ -906,17 +906,20 @@ const ChunkHandler _engine_chunk_handlers[] = { { 'ENGS', LoadSave_ENGS, LoadSave_ENGS, CH_RIFF | CH_LAST}, }; + /* - * returns true if an engine is valid, and it is of the specified type, and buildable by the current player, false otherwise + * returns true if an engine is valid, of the specified type, and buildable by + * the current player, false otherwise * * engine = index of the engine to check * type = the type the engine should be of (VEH_xxx) */ -bool IsEngineBuildable(int engine, byte type) { - Engine *e; +bool IsEngineBuildable(uint engine, byte type) +{ + const Engine *e; // check if it's an engine that is in the engine array - if (0 > engine || engine >= TOTAL_NUM_ENGINES ) return false; + if (engine >= TOTAL_NUM_ENGINES) return false; e = DEREF_ENGINE(engine); @@ -928,7 +931,3 @@ bool IsEngineBuildable(int engine, byte type) { return true; } - - - - diff --git a/engine.h b/engine.h index 52fa3a583..9976f57c4 100644 --- a/engine.h +++ b/engine.h @@ -133,7 +133,7 @@ void AcceptEnginePreview(Engine *e, int player); void LoadCustomEngineNames(void); void DeleteCustomEngineNames(void); -bool IsEngineBuildable(int engine, byte type); +bool IsEngineBuildable(uint engine, byte type); enum { NUM_NORMAL_RAIL_ENGINES = 54, diff --git a/roadveh_cmd.c b/roadveh_cmd.c index f2a5c88c8..69cb01188 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -115,7 +115,7 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) uint tile = TILE_FROM_XY(x,y); Engine *e; - if (!(IsEngineBuildable(p1, VEH_Road))) return CMD_ERROR; + if (!IsEngineBuildable(p1, VEH_Road)) return CMD_ERROR; SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); diff --git a/ship_cmd.c b/ship_cmd.c index 88519beb8..a0efa79aa 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -816,7 +816,7 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2) uint tile = TILE_FROM_XY(x,y); Engine *e; - if (!(IsEngineBuildable(p1, VEH_Ship))) return CMD_ERROR; + if (!IsEngineBuildable(p1, VEH_Ship)) return CMD_ERROR; SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); diff --git a/train_cmd.c b/train_cmd.c index c987b007b..3c8370f05 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -525,7 +525,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) Engine *e; uint tile; - if (!(IsEngineBuildable(p1, VEH_Train))) return CMD_ERROR; + if (!IsEngineBuildable(p1, VEH_Train)) return CMD_ERROR; _cmd_build_rail_veh_var1 = 0; -- cgit v1.2.3-54-g00ecf