uint16 this_month_production[INDUSTRY_NUM_OUTPUTS]; ///< stats of this month's production per cargo
uint16 this_month_transported[INDUSTRY_NUM_OUTPUTS]; ///< stats of this month's transport per cargo
byte last_month_pct_transported[INDUSTRY_NUM_OUTPUTS]; ///< percentage transported per cargo in the last full month
uint16 last_month_production[INDUSTRY_NUM_OUTPUTS]; ///< total units produced per cargo in the last full month
uint16 last_month_transported[INDUSTRY_NUM_OUTPUTS]; ///< total units transported per cargo in the last full month
uint16 counter; ///< used for animation and/or production (if available cargo)
IndustryType type; ///< type of industry.
Owner owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
byte random_colour; ///< randomized colour of the industry, for display purpose
Year last_prod_year; ///< last year of production
byte was_cargo_delivered; ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
IndustryControlFlags ctlflags; ///< flags overriding standard behaviours
PartOfSubsidy part_of_subsidy; ///< NOSAVE: is this industry a source/destination of a subsidy?
StationList stations_near; ///< NOSAVE: List of nearby stations.
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the industry
Owner founder; ///< Founder of the industry
Date construction_date; ///< Date of the construction of the industry
uint8 construction_type; ///< Way the industry was constructed (@see IndustryConstructionType)
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]; ///< Last day each cargo type was accepted by this industry
byte selected_layout; ///< Which tile layout was used when creating the industry
Owner exclusive_supplier; ///< Which company has exclusive rights to deliver cargo (INVALID_OWNER = anyone)
Owner exclusive_consumer; ///< Which company has exclusive rights to take cargo (INVALID_OWNER = anyone)
uint16 random; ///< Random value used for randomisation of all kinds of things
PersistentStorage *psa; ///< Persistent storage for NewGRF industries.
* 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.
* 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.
* 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/>.
*/
/** @file industry_cmd.cpp Handling of industry tiles. */
* 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.
* 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.
* 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/>.
*/
/**
* @file game_changelog.hpp Lists all changes / additions to the API.
*
* Only new / renamed / deleted api functions will be listed here. A list of
* bug fixes can be found in the normal changelog. Note that removed API
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 1.11.0
*
* This version is not yet released. The following changes are not set in stone yet.
*
* API additions:
* \li GSEventStoryPageButtonClick
* \li GSEventStoryPageTileSelect
* \li GSEventStoryPageVehicleSelect
* \li GSIndustry::GetCargoLastAcceptedDate
* \li GSIndustry::GetControlFlags
* \li GSIndustry::GetExclusiveConsumer
* \li GSIndustry::GetExclusiveSupplier
* \li GSIndustry::GetLastProductionYear
* \li GSIndustry::SetControlFlags
* \li GSIndustry::SetExclusiveConsumer
* \li GSIndustry::SetExclusiveSupplier
* \li GSStoryPage::MakePushButtonReference
* \li GSStoryPage::MakeTileButtonReference
* \li GSStoryPage::MakeVehicleButtonReference
* \li GSPriorityQueue
*
* \b 1.10.0
*
* API additions:
* \li GSVehicle::BuildVehicleWithRefit
* \li GSVehicle::GetBuildWithRefitCapacity
* \li GSRoad::GetName
* \li GSRoad::RoadVehCanRunOnRoad
* \li GSRoad::RoadVehHasPowerOnRoad
* \li GSRoad::ConvertRoadType
* \li GSRoad::GetMaxSpeed
* \li GSEngine::EnableForCompany
* \li GSEngine::DisableForCompany
*
* \b 1.9.0
*
* API additions:
* \li GSAirport::GetMonthlyMaintenanceCost
* \li GSClient
* \li GSClientList
src/script/api/script_industry.cpp
➞
Show inline comments
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file script_industry.cpp Implementation of ScriptIndustry. */
return (ScriptDate::Date)std::accumulate(std::begin(i->last_cargo_accepted_at), std::end(i->last_cargo_accepted_at), 0, [](Date a, Date b) { return std::max(a, b); });
* 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.
* 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.
* 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/>.
*/
/** @file script_industry.hpp Everything to query and build industries. */
#ifndef SCRIPT_INDUSTRY_HPP
#define SCRIPT_INDUSTRY_HPP
#include "script_company.hpp"
#include "script_date.hpp"
#include "script_object.hpp"
#include "script_date.hpp"
#include "../../industry.h"
/**
* Class that handles all industry related functions.
* @api ai game
*/
class ScriptIndustry : public ScriptObject {
public:
/** Ways for an industry to accept a cargo. */
enum CargoAcceptState {
CAS_NOT_ACCEPTED, ///< The CargoID is not accepted by this industry.
CAS_ACCEPTED, ///< The industry currently accepts this CargoID.
CAS_TEMP_REFUSED, ///< The industry temporarily refuses to accept this CargoID but may do so again in the future.
};
/**
* Control flags for industry
* @api -ai
*/
enum IndustryControlFlags {
/**
* When industry production change is evaluated, rolls to decrease are ignored.
* This also prevents industry closure due to production dropping to the lowest level.
*/
@@ -238,27 +239,68 @@ public:
* @return Date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error.