From 4eae917c1ce88d30e81a80230f653cfe7761ea99 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 Aug 2008 15:02:21 +0000 Subject: (svn r14037) -Fix (r8610): The autoreplace gui showed vehicle types for replacement which CmdSetAutoReplace() did not accept. --- src/players.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/players.cpp') diff --git a/src/players.cpp b/src/players.cpp index cf1dca355..c3bef5c3c 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -717,21 +717,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 if (!IsValidGroupID(id_g) && !IsAllGroupID(id_g) && !IsDefaultGroupID(id_g)) return CMD_ERROR; if (new_engine_type != INVALID_ENGINE) { - /* First we make sure that it's a valid type the user requested - * check that it's an engine that is in the engine array */ - if (!IsEngineIndex(new_engine_type)) return CMD_ERROR; - - /* check that the new vehicle type is the same as the original one */ - if (GetEngine(old_engine_type)->type != GetEngine(new_engine_type)->type) return CMD_ERROR; - - /* make sure that we do not replace a plane with a helicopter or vise versa */ - if (GetEngine(new_engine_type)->type == VEH_AIRCRAFT && - (AircraftVehInfo(old_engine_type)->subtype & AIR_CTOL) != (AircraftVehInfo(new_engine_type)->subtype & AIR_CTOL)) { - return CMD_ERROR; - } - - /* make sure that the player can actually buy the new engine */ - if (!HasBit(GetEngine(new_engine_type)->player_avail, _current_player)) return CMD_ERROR; + if (!CheckAutoreplaceValidity(old_engine_type, new_engine_type, _current_player)) return CMD_ERROR; cost = AddEngineReplacementForPlayer(p, old_engine_type, new_engine_type, id_g, flags); } else { -- cgit v1.2.3-54-g00ecf