* Delete the subsidies associated with a given cargo source type and id. * @param source The source to look for. */
| 117 | * @param source The source to look for. |
| 118 | */ |
| 119 | void DeleteSubsidyWith(Source source) |
| 120 | { |
| 121 | bool dirty = false; |
| 122 | |
| 123 | for (Subsidy *s : Subsidy::Iterate()) { |
| 124 | if (s->src == source || s->dst == source) { |
| 125 | delete s; |
| 126 | dirty = true; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | if (dirty) { |
| 131 | InvalidateWindowData(WC_SUBSIDIES_LIST, 0); |
| 132 | RebuildSubsidisedSourceAndDestinationCache(); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Check whether a specific subsidy already exists. |
no test coverage detected