diff options
Diffstat (limited to 'src/script/api/script_industry.hpp')
-rw-r--r-- | src/script/api/script_industry.hpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/script/api/script_industry.hpp b/src/script/api/script_industry.hpp index 98c7d33ac..2fbd861cc 100644 --- a/src/script/api/script_industry.hpp +++ b/src/script/api/script_industry.hpp @@ -11,6 +11,8 @@ #define SCRIPT_INDUSTRY_HPP #include "script_object.hpp" +#include "script_date.hpp" +#include "../../industry.h" /** * Class that handles all industry related functions. @@ -26,6 +28,27 @@ public: }; /** + * 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. + */ + INDCTL_NO_PRODUCTION_DECREASE = ::INDCTL_NO_PRODUCTION_DECREASE, + /** + * When industry production change is evaluated, rolls to increase are ignored. + */ + INDCTL_NO_PRODUCTION_INCREASE = ::INDCTL_NO_PRODUCTION_INCREASE, + /** + * Industry can not close regardless of production level or time since last delivery. + * This does not prevent a closure already announced. + */ + INDCTL_NO_CLOSURE = ::INDCTL_NO_CLOSURE, + }; + + /** * Gets the number of industries. * @return The number of industries. * @note The maximum valid IndustryID can be higher than the value returned. @@ -196,6 +219,46 @@ public: * @return The IndustryType of the industry. */ static IndustryType GetIndustryType(IndustryID industry_id); + + /** + * Get the last year this industry had any production output. + * @param industry_id The index of the industry. + * @pre IsValidIndustry(industry_id). + * @return Year the industry last had production, 0 if error. + * @api -ai + */ + static int32 GetLastProductionYear(IndustryID industry_id); + + /** + * Get the last date this industry accepted any cargo delivery. + * @param industry_id The index of the industry. + * @param cargo_type The cargo to query, or CT_INVALID to query latest of all accepted cargoes. + * @pre IsValidIndustry(industry_id). + * @pre IsValidCargo(cargo_type) || cargo_type == CT_INVALID. + * @return Date the industry last received cargo from a delivery, or ScriptDate::DATE_INVALID on error. + * @api -ai + */ + static ScriptDate::Date GetCargoLastAcceptedDate(IndustryID industry_id, CargoID cargo_type); + + /** + * Get the current control flags for an industry. + * @param industry_id The index of the industry. + * @pre IsValidIndustry(industry_id). + * @return Bit flags of the IndustryControlFlags enumeration. + * @api -ai + */ + static uint32 GetControlFlags(IndustryID industry_id); + + /** + * Change the control flags for an industry. + * @param industry_id The index of the industry. + * @param control_flags New flags as a combination of IndustryControlFlags values. + * @pre IsValidIndustry(industry_id). + * @pre No ScriptCompanyMode may be in scope. + * @return True if the action succeeded. + * @api -ai + */ + static bool SetControlFlags(IndustryID industry_id, uint32 control_flags); }; #endif /* SCRIPT_INDUSTRY_HPP */ |