2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file script_infrastructure.hpp Everything to query a company's infrastructure. */
10 #ifndef SCRIPT_INFRASTRUCTURE_HPP
11 #define SCRIPT_INFRASTRUCTURE_HPP
13 #include "script_road.hpp"
14 #include "script_rail.hpp"
17 * Class that handles all company infrastructure related functions.
20 class ScriptInfrastructure
: public ScriptObject
{
22 /** Infrastructure categories. */
24 INFRASTRUCTURE_RAIL
, ///< Rail infrastructure.
25 INFRASTRUCTURE_SIGNALS
, ///< Signal infrastructure.
26 INFRASTRUCTURE_ROAD
, ///< Road infrastructure.
27 INFRASTRUCTURE_CANAL
, ///< Canal infrastructure.
28 INFRASTRUCTURE_STATION
, ///< Station infrastructure.
29 INFRASTRUCTURE_AIRPORT
, ///< Airport infrastructure.
33 * Return the number of rail pieces of a specific rail type for a company.
34 * @param company The company to get the count for.
35 * @param railtype Rail type to get the count of.
36 * @return Count for the rail type.
38 static SQInteger
GetRailPieceCount(ScriptCompany::CompanyID company
, ScriptRail::RailType railtype
);
41 * Return the number of road pieces of a specific road type for a company.
42 * @param company The company to get the count for.
43 * @param roadtype Road type to get the count of.
44 * @return Count for the road type.
46 static SQInteger
GetRoadPieceCount(ScriptCompany::CompanyID company
, ScriptRoad::RoadType roadtype
);
49 * Return the number of pieces of an infrastructure category for a company.
50 * @param company The company to get the count for.
51 * @param infra_type Infrastructure category to get the cost of.
52 * @return Count for the wanted category.
53 * @note #INFRASTRUCTURE_RAIL and #INFRASTRUCTURE_ROAD return the total count for all rail/road types.
55 static SQInteger
GetInfrastructurePieceCount(ScriptCompany::CompanyID company
, Infrastructure infra_type
);
58 * Return the monthly maintenance costs of a specific rail type for a company.
59 * @param company The company to get the monthly cost for.
60 * @param railtype Rail type to get the cost of.
61 * @return Maintenance cost for the rail type per economy-month.
62 * @see \ref ScriptEconomyTime
64 static Money
GetMonthlyRailCosts(ScriptCompany::CompanyID company
, ScriptRail::RailType railtype
);
67 * Return the monthly maintenance costs of a specific road type for a company.
68 * @param company The company to get the monthly cost for.
69 * @param roadtype Road type to get the cost of.
70 * @return Maintenance cost for the road type per economy-month.
71 * @see \ref ScriptEconomyTime
73 static Money
GetMonthlyRoadCosts(ScriptCompany::CompanyID company
, ScriptRoad::RoadType roadtype
);
76 * Return the monthly maintenance costs of an infrastructure category for a company.
77 * @param company The company to get the monthly cost for.
78 * @param infra_type Infrastructure category to get the cost of.
79 * @return Maintenance cost for the wanted category per economy-month.
80 * @note #INFRASTRUCTURE_RAIL and #INFRASTRUCTURE_ROAD return the total cost for all rail/road types.
81 * @see \ref ScriptEconomyTime
83 static Money
GetMonthlyInfrastructureCosts(ScriptCompany::CompanyID company
, Infrastructure infra_type
);
86 #endif /* SCRIPT_INFRASTRUCTURE_HPP */