MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CheckSubsidyDuplicate

Function CheckSubsidyDuplicate

src/subsidy.cpp:143–151  ·  view source on GitHub ↗

* Check whether a specific subsidy already exists. * @param cargo Cargo type. * @param src The source. * @param dst The destination. * @return \c true if the subsidy already exists, \c false if not. */

Source from the content-addressed store, hash-verified

141 * @return \c true if the subsidy already exists, \c false if not.
142 */
143static bool CheckSubsidyDuplicate(CargoType cargo, Source src, Source dst)
144{
145 for (const Subsidy *s : Subsidy::Iterate()) {
146 if (s->cargo_type == cargo && s->src == src && s->dst == dst) {
147 return true;
148 }
149 }
150 return false;
151}
152
153/**
154 * Checks if the source and destination of a subsidy are inside the distance limit.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected