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

Method GetProfitThisYear

src/script/api/script_group.cpp:180–194  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

178}
179
180/* static */ Money ScriptGroup::GetProfitThisYear(GroupID group_id)
181{
182 if (!IsValidGroup(group_id)) return -1;
183
184 Money profit = 0;
185
186 for (const Vehicle *v : Vehicle::Iterate()) {
187 if (v->group_id != group_id) continue;
188 if (!v->IsPrimaryVehicle()) continue;
189
190 profit += v->GetDisplayProfitThisYear();
191 }
192
193 return profit;
194}
195
196/* static */ Money ScriptGroup::GetProfitLastYear(GroupID group_id)
197{

Callers

nothing calls this directly

Calls 2

IsPrimaryVehicleMethod · 0.45

Tested by

no test coverage detected