static */
| 201 | } |
| 202 | |
| 203 | /* static */ SQInteger ScriptGroup::GetCurrentUsage(GroupID group_id) |
| 204 | { |
| 205 | if (!IsValidGroup(group_id)) return -1; |
| 206 | |
| 207 | uint32_t occupancy = 0; |
| 208 | uint32_t vehicle_count = 0; |
| 209 | |
| 210 | for (const Vehicle *v : Vehicle::Iterate()) { |
| 211 | if (v->group_id != group_id) continue; |
| 212 | if (!v->IsPrimaryVehicle()) continue; |
| 213 | |
| 214 | occupancy += v->trip_occupancy; |
| 215 | vehicle_count++; |
| 216 | } |
| 217 | |
| 218 | if (vehicle_count == 0) return -1; |
| 219 | |
| 220 | return occupancy / vehicle_count; |
| 221 | } |
| 222 | |
| 223 | /* static */ bool ScriptGroup::SetPrimaryColour(GroupID group_id, ScriptCompany::Colours colour) |
| 224 | { |
nothing calls this directly
no test coverage detected