Changeset - r26311:99c3ff8d01cc
[Not reviewed]
master
0 1 0
Patric Stout - 23 months ago 2022-07-09 09:25:17
truebrain@openttd.org
Fix: autoreplace command did not validate the vehicle argument properly (#9946)

It first checked if the vehicle was in the depot, which for some types
is only a valid action for the primary vehicle. Afterwards, it checked
if the vehicle was a primary vehicle.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -725,7 +725,6 @@ CommandCost CmdAutoreplaceVehicle(DoComm
 
	CommandCost ret = CheckOwnership(v->owner);
 
	if (ret.Failed()) return ret;
 

	
 
	if (!v->IsChainInDepot()) return CMD_ERROR;
 
	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
 

	
 
	bool free_wagon = false;
 
@@ -737,6 +736,7 @@ CommandCost CmdAutoreplaceVehicle(DoComm
 
	} else {
 
		if (!v->IsPrimaryVehicle()) return CMD_ERROR;
 
	}
 
	if (!v->IsChainInDepot()) return CMD_ERROR;
 

	
 
	const Company *c = Company::Get(_current_company);
 
	bool wagon_removal = c->settings.renew_keep_length;
0 comments (0 inline, 0 general)