mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix: CmdSetAutoReplace didn't validate group type and engine type match (#9950)
Basically, you could setup an auto-replace in a group for trains to replace a ship with another ship. Most of the code is surprisingly okay with this, it is only the group statistics that doesn't like this.
This commit is contained in:
parent
979704271b
commit
77a85e9b4c
@ -815,6 +815,7 @@ CommandCost CmdSetAutoReplace(DoCommandFlag flags, GroupID id_g, EngineID old_en
|
||||
|
||||
if (Group::IsValidID(id_g) ? Group::Get(id_g)->owner != _current_company : !IsAllGroupID(id_g) && !IsDefaultGroupID(id_g)) return CMD_ERROR;
|
||||
if (!Engine::IsValidID(old_engine_type)) return CMD_ERROR;
|
||||
if (Group::IsValidID(id_g) && Group::Get(id_g)->vehicle_type != Engine::Get(old_engine_type)->type) return CMD_ERROR;
|
||||
|
||||
if (new_engine_type != INVALID_ENGINE) {
|
||||
if (!Engine::IsValidID(new_engine_type)) return CMD_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user