OpenTTD Source  13.2.1
industry_cmd.h File Reference
#include "command_type.h"
#include "company_type.h"
#include "industry_type.h"

Go to the source code of this file.

Functions

enum IndustryAction byte enum IndustryControlFlags byte CommandCost CmdBuildIndustry (DoCommandFlag flags, TileIndex tile, IndustryType it, uint32 first_layout, bool fund, uint32 seed)
 Build/Fund an industry. More...
 
CommandCost CmdIndustryCtrl (DoCommandFlag flags, IndustryID ind_id, IndustryAction action, IndustryControlFlags ctlflags, Owner company_id, const std::string &text)
 Change industry properties. More...
 
void CcBuildIndustry (Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32, bool, uint32)
 Command callback. More...
 

Detailed Description

Command definitions related to industries.

Definition in file industry_cmd.h.

Function Documentation

◆ CcBuildIndustry()

void CcBuildIndustry ( Commands  cmd,
const CommandCost result,
TileIndex  tile,
IndustryType  indtype,
uint32  ,
bool  ,
uint32   
)

Command callback.

In case of failure to build an industry, show an error message.

Parameters
cmdUnused.
resultResult of the command.
tileTile where the industry is placed.
indtypeIndustry type.

Definition at line 227 of file industry_gui.cpp.

◆ CmdBuildIndustry()

enum IndustryAction byte enum IndustryControlFlags byte CommandCost CmdBuildIndustry ( DoCommandFlag  flags,
TileIndex  tile,
IndustryType  it,
uint32  first_layout,
bool  fund,
uint32  seed 
)
strong

Build/Fund an industry.

Parameters
flagsof operations to conduct
tiletile where industry is built
itindustry type see build_industry.h and see industry.h
first_layoutfirst layout to try
fundfalse = prospect, true = fund (only valid if current company is DEITY)
seedseed to use for desyncfree randomisations
Returns
the cost of this operation or an error

Definition at line 2013 of file industry_cmd.cpp.

References CMD_ERROR, IndustrySpec::enabled, GetIndustrySpec(), IndustrySpec::layouts, and NUM_INDUSTRYTYPES.

◆ CmdIndustryCtrl()

CommandCost CmdIndustryCtrl ( DoCommandFlag  flags,
IndustryID  ind_id,
IndustryAction  action,
IndustryControlFlags  ctlflags,
Owner  company_id,
const std::string &  text 
)

Change industry properties.

Parameters
flagsType of operation.
ind_idIndustryID
actionIndustryAction to perform
ctlflagsIndustryControlFlags (only used with set control flags)
company_idCompanyID to set or INVALID_OWNER (available to everyone) or OWNER_NONE (neutral stations only) or OWNER_DEITY (no one) (only used with set exclusive supplier / consumer)
text- Additional industry text (only used with set text action)
Returns
Empty cost or an error.

Definition at line 2110 of file industry_cmd.cpp.

References _current_company, CMD_ERROR, Industry::ctlflags, DC_EXEC, Industry::exclusive_consumer, Industry::exclusive_supplier, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), INDCTL_MASK, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_OWNER, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, OWNER_NONE, SetControlFlags, SetExclusiveConsumer, SetExclusiveSupplier, SetText, Industry::text, and WC_INDUSTRY_VIEW.