/** * Get the total amount of cargo transported from an industry last month. * @param industry_id The index of the industry. * @param cargo_id The index of the cargo. * @returns The amount of given cargo transported from this industry last month. */ public static int GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id) { throw null; }
internal void UpdateRoutes() { AILog.Error(" -- UpdateRoutes --"); CargoID passangerCargo = null; var cargoList = new AICargoList(); foreach (var(cargo, _) in cargoList) { if (AICargo.HasCargoClass(cargo, AICargo.CC_PASSENGERS)) { passangerCargo = cargo; } } if (passangerCargo == null) { AILog.Error("No passanger cargo found."); return; } foreach (var edge in this.Graph.Edges) { if (!this.vehicles.ContainsKey(edge)) { continue; } var list = this.vehicles[edge]; var s1 = AIStation.GetStationID(stations[edge.Node1.TownId].tile); var s2 = AIStation.GetStationID(stations[edge.Node2.TownId].tile); var waiting1 = AIStation.GetCargoWaitingVia(s1, s2, passangerCargo); var waiting2 = AIStation.GetCargoWaitingVia(s2, s1, passangerCargo); var waiting = waiting1 + waiting2; AILog.Info($"Route from {edge.Node1.Name} to {edge.Node2.Name} has {waiting} passangers waiting."); var target = (waiting / 31) - 1; // TODO: Capacity AILog.Info($"{list.Count} vehicles operating. Target: {target}"); if (list.Count < target) { if (waiting1 > waiting2) { MakeRoute(edge.Node1, edge.Node2); } else { MakeRoute(edge.Node2, edge.Node1); } } } //var stations = new AIStationList(AIStation.STATION_BUS_STOP); //foreach (var (s1, _) in stations) //{ // AILog.Info(AIStation.GetName(s1) + ":"); // var stations2 = new AIStationList(AIStation.STATION_BUS_STOP); // var totalWaiting = AIStation.GetCargoWaiting(s1, passangerCargo); // foreach (var (s2, _) in stations2) // { // if (s1 != s2) // { // var waiting = AIStation.GetCargoWaitingVia(s1, s2, passangerCargo); // AILog.Info($"- {AIStation.GetName(s2)}: {waiting}"); // totalWaiting -= waiting; // } // } // AILog.Info($"- any: {totalWaiting}"); //} }
/// <param name="cargo_id">The cargo this industry should accept.</param> public AIIndustryList_CargoAccepting(CargoID cargo_id) { throw null; }
/** * Build a NewGRF rail station. This calls callback 18 to let a NewGRF * provide the station class / id to build, so we don't end up with * only the default stations on the map. * When no NewGRF provides a rail station, or an unbuildable rail station is * returned by a NewGRF, this function will fall back to building a default * non-NewGRF station as if AIRail.BuildRailStation was called. * @param tile Place to build the station. * @param direction The direction to build the station. * @param num_platforms The number of platforms to build. * @param platform_length The length of each platform. * @param station_id The station to join, AIStation.STATION_NEW or AIStation.STATION_JOIN_ADJACENT. * @param cargo_id The CargoID of the cargo that will be transported from / to this station. * @param source_industry The IndustryType of the industry you'll transport goods from, AIIndustryType.INDUSTRYTYPE_UNKNOWN or AIIndustryType.INDUSTRYTYPE_TOWN. * @param goal_industry The IndustryType of the industry you'll transport goods to, AIIndustryType.INDUSTRYTYPE_UNKNOWN or AIIndustryType.INDUSTRYTYPE_TOWN. * @param distance The manhattan distance you'll transport the cargo over. * @param source_station True if this is the source station, false otherwise. * @exception AIError.ERR_OWNED_BY_ANOTHER_COMPANY * @exception AIError.ERR_AREA_NOT_CLEAR * @exception AIError.ERR_FLAT_LAND_REQUIRED * @exception AIStation.ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION * @exception AIStation.ERR_STATION_TOO_MANY_STATIONS * @exception AIStation.ERR_STATION_TOO_MANY_STATIONS_IN_TOWN * @returns Whether the station has been/can be build or not. */ public static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, int num_platforms, int platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station) { throw null; }
/** * Refits a vehicle to the given cargo type. * @param vehicle_id The vehicle to refit. * @param cargo The cargo to refit to. * @exception AIVehicle.ERR_VEHICLE_CANNOT_REFIT * @exception AIVehicle.ERR_VEHICLE_IS_DESTROYED * @exception AIVehicle.ERR_VEHICLE_NOT_IN_DEPOT * @returns True if and only if the refit succeeded. */ public static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo) { throw null; }
/** * Checks whether the given cargo type is valid. * @param cargo_type The cargo to check. * @returns True if and only if the cargo type is valid. */ public static bool IsValidCargo(CargoID cargo_type) { throw null; }
/** * Checks whether the give cargo is a freight or not. * This defines whether the "freight train weight multiplier" will apply to * trains transporting this cargo. * @param cargo_type The cargo to check on. * @returns True if and only if the cargo is freight. */ public static bool IsFreight(CargoID cargo_type) { throw null; }
/** * Creates a list of stations associated with cargo planned to pass the station, selected and * grouped by the chosen criteria. * @param selector Mode of grouping and selecting to be applied. * @param station_id Station to be queried. * @param cargo Cargo type to query for. * @param other_station Other station to restrict the query with. */ public AIStationList_CargoPlanned(AIStationList_Cargo.CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station) : base(CargoMode.CM_PLANNED, selector, station_id, cargo, other_station) { throw null; }
/// <param name="station_id">Station to query for waiting cargo.</param><param name="cargo">Cargo type to query for.</param> public AIStationList_CargoWaitingByFrom(StationID station_id, CargoID cargo) : base(CargoSelector.CS_BY_FROM, station_id, cargo, null) { throw null; }
/** * Creates a list of stations associated with cargo in the specified way, selected and grouped * by the chosen criteria. * @param mode Mode of association, either waiting cargo or planned cargo. * @param selector Mode of grouping and selecting to be applied. * @param station_id Station to be queried. * @param cargo Cargo type to query for. * @param other_station Other station to restrict the query with. */ public AIStationList_Cargo(AIStationList_Cargo.CargoMode mode, AIStationList_Cargo.CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station) { throw null; }
/** * Creates a list of stations associated with waiting cargo, selected and grouped by the chosen * criteria. * @param selector Mode of grouping and selecting to be applied. * @param station_id Station to be queried. * @param cargo Cargo type to query for. * @param other_station Other station to restrict the query with. */ public AIStationList_CargoWaiting(AIStationList_Cargo.CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station) : base(CargoMode.CM_WAITING, selector, station_id, cargo, other_station) { throw null; }
/// <param name="station_id">Station to query for planned flows.</param><param name="cargo">Cargo type to query for.</param><param name="from">Origin station to restrict the query with.</param> public AIStationList_CargoPlannedFromByVia(StationID station_id, CargoID cargo, StationID from) : base(CargoSelector.CS_FROM_BY_VIA, station_id, cargo, from) { throw null; }
/// <param name="station_id">Station to query for planned flows.</param><param name="cargo">Cargo type to query for.</param> public AIStationList_CargoPlannedByVia(StationID station_id, CargoID cargo) : base(CargoSelector.CS_BY_VIA, station_id, cargo, null) { throw null; }
/// <param name="station_id">Station to query for planned flows.</param><param name="cargo">Cargo type to query for.</param><param name="via">Next hop to restrict the query with.</param> public AIStationList_CargoPlannedViaByFrom(StationID station_id, CargoID cargo, StationID via) : base(CargoSelector.CS_VIA_BY_FROM, station_id, cargo, via) { throw null; }
/** * Get the income for transporting a piece of cargo over the * given distance within the specified time. * @param cargo_type The cargo to transport. * @param distance The distance the cargo travels from begin to end. * @param days_in_transit Amount of (game) days the cargo is in transit. The max value of this variable is 637. Any value higher returns the same as 637 would. * @returns The amount of money that would be earned by this trip. */ public static long GetCargoIncome(CargoID cargo_type, int distance, int days_in_transit) { throw null; }
/** * Check how much cargo this tile accepts. * It creates a radius around the tile, and adds up all acceptance of this * cargo. * @param tile The tile to check on. * @param cargo_type The cargo to check the acceptance of. * @param width The width of the station. * @param height The height of the station. * @param radius The radius of the station. * @returns Value below 8 means no acceptance; the more the better. */ public static int GetCargoAcceptance(TileIndex tile, CargoID cargo_type, int width, int height, int radius) { throw null; }
/** * Get the cargo distribution type for a cargo. * @param cargo_type The cargo to check on. * @returns The cargo distribution type for the given cargo. */ public static DistributionType GetDistributionType(CargoID cargo_type) { throw null; }
/** * Checks how many producers in the radius produces this cargo. * It creates a radius around the tile, and counts all producer of this cargo. * @param tile The tile to check on. * @param cargo_type The cargo to check the production of. * @param width The width of the station. * @param height The height of the station. * @param radius The radius of the station. * @returns The number of producers that produce this cargo within radius of the tile. */ public static int GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius) { throw null; }
/** * Gets the string representation of the cargo label. * @param cargo_type The cargo to get the string representation of. * @returns The cargo label. * @note * - The label uniquely identifies a specific cargo. Use this if you want to * detect special cargos from specific industry set (like production booster cargos, supplies, ...). * - For more generic cargo support, rather check cargo properties though. For example: * - Use AICargo.HasCargoClass(..., CC_PASSENGER) to decide bus vs. truck requirements. * - Use AICargo.GetTownEffect(...) paired with AITown.GetCargoGoal(...) to determine * town growth requirements. * - In other Only words use the cargo label, if you know more about the behaviour * of a specific cargo from a specific industry set, than the API methods can tell you. */ public static string GetCargoLabel(CargoID cargo_type) { throw null; }
/** * Get the total last month's production of the given cargo at a town. * @param town_id The index of the town. * @param cargo_id The index of the cargo. * @returns The last month's production of the given cargo for this town. */ public static int GetLastMonthProduction(TownID town_id, CargoID cargo_id) { throw null; }
/** * Check if this cargo is in the requested cargo class. * @param cargo_type The cargo to check on. * @param cargo_class The class to check for. * @returns True if and only if the cargo is in the cargo class. */ public static bool HasCargoClass(CargoID cargo_type, CargoClass cargo_class) { throw null; }
/** * Get the total amount of cargo supplied from a town last month. * @param town_id The index of the town. * @param cargo_id The index of the cargo. * @returns The amount of cargo supplied for transport from this town last month. */ public static int GetLastMonthSupplied(TownID town_id, CargoID cargo_id) { throw null; }
/** * Gets the capacity of the given vehicle when refitted to the given cargo type. * @param vehicle_id The vehicle to refit. * @param cargo The cargo to refit to. * @returns The capacity the vehicle will have when refited. */ public static int GetRefitCapacity(VehicleID vehicle_id, CargoID cargo) { throw null; }
/** * Get the percentage of transported production of the given cargo at a town. * @param town_id The index of the town. * @param cargo_id The index of the cargo. * @returns The percentage of given cargo transported from this town last month. */ public static int GetLastMonthTransportedPercentage(TownID town_id, CargoID cargo_id) { throw null; }
/** * Get the amount of a specific cargo the given vehicle is transporting. * @param vehicle_id The vehicle to get the load amount of. * @param cargo The cargo to get the loaded amount for. * @returns The amount of the given cargo the vehicle is currently transporting. */ public static int GetCargoLoad(VehicleID vehicle_id, CargoID cargo) { throw null; }
/** * Sets the refit cargo type of the given order for the given vehicle. * @param vehicle_id The vehicle to set the refit cargo for. * @param order_position The order to set the refit cargo for. * @param refit_cargo The cargo to refit to. The refit can be cleared by passing CT_NO_REFIT. * @returns Whether the order has been/can be changed. */ public static bool SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoID refit_cargo) { throw null; }
/** * Check if the engine can pull a wagon with the given cargo. * @param engine_id The engine to check. * @param cargo_id The cargo to check. * @returns True if the engine can pull wagons carrying this cargo. * @note This function is not exhaustive; a true here does not mean * that the vehicle can pull the wagons, a false does mean it can't. */ public static bool CanPullCargo(EngineID engine_id, CargoID cargo_id) { throw null; }
/** * Get the effect this cargo has on a town. * @param cargo_type The cargo to check on. * @returns The effect this cargo has on a town, or TE_NONE if it has no effect. */ public static TownEffect GetTownEffect(CargoID cargo_type) { throw null; }
/// <param name="cargo_id">The cargo this industry should produce.</param> public AIIndustryList_CargoProducing(CargoID cargo_id) { throw null; }
/** * Get the total last month's production of the given cargo at an industry. * @param industry_id The index of the industry. * @param cargo_id The index of the cargo. * @returns The last month's production of the given cargo for this industry. */ public static int GetLastMonthProduction(IndustryID industry_id, CargoID cargo_id) { throw null; }