Feature: Influence industry production changes from GS (#7912)
This commit is contained in:

committed by
GitHub

parent
547e5fdb65
commit
b7751c483e
@@ -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.
|
||||
@@ -25,6 +27,27 @@ public:
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
@@ -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 */
|
||||
|
Reference in New Issue
Block a user