|
@@ -26,48 +26,52 @@ public:
|
|
|
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.
|
|
|
*/
|
|
|
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,
|
|
|
/**
|
|
|
* Indicates that the production level of the industry is controlled by a game script.
|
|
|
*/
|
|
|
INDCTL_EXTERNAL_PROD_LEVEL = ::INDCTL_EXTERNAL_PROD_LEVEL,
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Gets the number of industries.
|
|
|
* @return The number of industries.
|
|
|
* @note The maximum valid IndustryID can be higher than the value returned.
|
|
|
*/
|
|
|
static SQInteger GetIndustryCount();
|
|
|
|
|
|
/**
|
|
|
* Checks whether the given industry index is valid.
|
|
|
* @param industry_id The index to check.
|
|
|
* @return True if and only if the industry is valid.
|
|
|
*/
|
|
|
static bool IsValidIndustry(IndustryID industry_id);
|
|
|
|
|
|
/**
|
|
|
* Get the IndustryID of a tile, if there is an industry.
|
|
|
* @param tile The tile to find the IndustryID of.
|
|
|
* @return IndustryID of the industry.
|
|
|
* @post Use IsValidIndustry() to see if the industry is valid.
|
|
|
* @note GetIndustryID will return an invalid IndustryID for the
|
|
|
* station tile of industries with a dock/heliport.
|
|
|
*/
|
|
@@ -302,27 +306,48 @@ public:
|
|
|
*/
|
|
|
static bool SetExclusiveSupplier(IndustryID industry_id, ScriptCompany::CompanyID company_id);
|
|
|
|
|
|
/**
|
|
|
* Find out which company currently has the exclusive rights to take cargo from the industry.
|
|
|
* @param industry_id The index of the industry.
|
|
|
* @pre IsValidIndustry(industry_id).
|
|
|
* @return The company that has the exclusive rights. The value
|
|
|
* ScriptCompany::COMPANY_SPECTATOR means that there are currently no
|
|
|
* exclusive rights given out to anyone.
|
|
|
*/
|
|
|
static ScriptCompany::CompanyID GetExclusiveConsumer(IndustryID industry_id);
|
|
|
|
|
|
/**
|
|
|
* Sets or resets the company that has exclusive right to take cargo from the industry.
|
|
|
* @param industry_id The index of the industry.
|
|
|
* @param company_id The company to set (ScriptCompany::COMPANY_INVALID to reset).
|
|
|
* @pre IsValidIndustry(industry_id).
|
|
|
* @pre ScriptCompanyMode::IsDeity().
|
|
|
* @return True if the action succeeded.
|
|
|
* @api -ai
|
|
|
*/
|
|
|
static bool SetExclusiveConsumer(IndustryID industry_id, ScriptCompany::CompanyID company_id);
|
|
|
|
|
|
/**
|
|
|
* Gets the current production level of an industry.
|
|
|
* @param industry_id The index of the industry.
|
|
|
* @api -ai
|
|
|
*/
|
|
|
static SQInteger GetProductionLevel(IndustryID industry_id);
|
|
|
|
|
|
/**
|
|
|
* Sets the current production level of an industry.
|
|
|
* @note Setting the production level automatically sets the control flag INDCTL_EXTERNAL_PROD_LEVEL if it wasn't already set.
|
|
|
* Normal production behaviour can be restored by clearing the control flag.
|
|
|
* @param industry_id The index of the industry.
|
|
|
* @param prod_level The production level to set.
|
|
|
* @param show_news If set to true and the production changed, generate a production change news message. If set to false, no news message is shown.
|
|
|
* @pre IsValidIndustry(industry_id).
|
|
|
* @pre ScriptCompanyMode::IsDeity().
|
|
|
* @pre prod_level >= 4 && prod_level <= 128.
|
|
|
* @return True if the action succeeded.
|
|
|
* @api -ai
|
|
|
*/
|
|
|
static bool SetProductionLevel(IndustryID industry_id, SQInteger prod_level, bool show_news);
|
|
|
};
|
|
|
|
|
|
#endif /* SCRIPT_INDUSTRY_HPP */
|