diff --git a/engine.c b/engine.c --- a/engine.c +++ b/engine.c @@ -401,12 +401,13 @@ int32 CmdRenameEngine(TileIndex tile, ui /* * returns true if an engine is valid, of the specified type, and buildable by - * the current player, false otherwise + * the given player, false otherwise * * engine = index of the engine to check * type = the type the engine should be of (VEH_xxx) + * player = index of the player */ -bool IsEngineBuildable(uint engine, byte type) +bool IsEngineBuildable(EngineID engine, byte type, PlayerID player) { const Engine *e; @@ -419,7 +420,7 @@ bool IsEngineBuildable(uint engine, byte if (e->type != type) return false; // check if it's available - if (!HASBIT(e->player_avail, _current_player)) return false; + if (!HASBIT(e->player_avail, player)) return false; return true; }