Codechange: Add IsCargoAccepted/Produced() helpers.

This commit is contained in:
2023-05-24 00:52:44 +01:00
committed by PeterN
parent 633f19419d
commit 09408e8e46
9 changed files with 40 additions and 65 deletions

View File

@@ -452,8 +452,7 @@ bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src)
if (dst_ind == nullptr) return false;
/* The industry must accept the cargo */
bool valid = std::find(dst_ind->accepts_cargo, endof(dst_ind->accepts_cargo), cid) != endof(dst_ind->accepts_cargo);
if (!valid) return false;
if (!dst_ind->IsCargoAccepted(cid)) return false;
dst = dst_ind->index;
break;