Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Get the number of vehicles in a given group.
- * @param group_id The group to get the number of engines in.
- * @param vehicle_type The type of vehicle of the group.
- * @pre IsValidGroup(group_id) || group_id == GROUP_ALL || group_id == GROUP_DEFAULT.
- * @pre IsValidGroup(group_id) || vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL ||
- * vehicle_type == ScriptVehicle::VT_WATER || vehicle_type == ScriptVehicle::VT_AIR
- * @return The number of vehicles in the group with id group_id.
- * @note If the group is valid (neither GROUP_ALL nor GROUP_DEFAULT), the value of
- * vehicle_type is retrieved from the group itself and not from the input value.
- * But if the group is invalid, either GROUP_ALL or GROUP_DEFAULT, then a
- * vehicle type must be specified.
- */
- static int32 GetNumVehicles(GroupID group_id, ScriptVehicle::VehicleType vehicle_type);
- /* static */ int32 ScriptGroup::GetNumVehicles(GroupID group_id, ScriptVehicle::VehicleType vehicle_type)
- {
- bool valid_group = IsValidGroup(group_id);
- if (!valid_group && group_id != GROUP_DEFAULT && group_id != GROUP_ALL) return -1;
- if (!valid_group && (vehicle_type < ScriptVehicle::VT_RAIL || vehicle_type > ScriptVehicle::VT_AIR)) return -1;
- return GetGroupNumVehicle(ScriptObject::GetCompany(), group_id, valid_group ? ::Group::Get(group_id)->vehicle_type : (::VehicleType)vehicle_type);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement