OpenTTD Source: src/industry_cmd.h File Reference

OpenTTD Source 14.0-RC3

Functions
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 IndustryControlFlags byte CommandCost | CmdBuildIndustry (DoCommandFlag flags, TileIndex tile, IndustryType it, uint32_t first_layout, bool fund, uint32_t seed)
| Build/Fund an industry. More...
CommandCost | CmdIndustrySetFlags (DoCommandFlag flags, IndustryID ind_id, IndustryControlFlags ctlflags)
| Set industry control flags. More...
CommandCost | CmdIndustrySetExclusivity (DoCommandFlag flags, IndustryID ind_id, Owner company_id, bool consumer)
| Change exclusive consumer or supplier for the industry. More...
CommandCost | CmdIndustrySetText (DoCommandFlag flags, IndustryID ind_id, const std::string &text)
| Change additional industry text. More...
CommandCost | CmdIndustrySetProduction (DoCommandFlag flags, IndustryID ind_id, byte prod_level, bool show_news, const std::string &text)
| Set industry production. More...
void | CcBuildIndustry (Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t)
| Command callback. More...

## Detailed Description

Command definitions related to industries.

Definition in file industry_cmd.h.

## Function Documentation

## ◆ CcBuildIndustry()

void CcBuildIndustry | ( | Commands | ,
|  | const CommandCost & | result,
|  | TileIndex | tile,
|  | IndustryType | indtype,
|  | uint32_t | ,
|  | bool | ,
|  | uint32_t |
| ) |  |

Command callback.

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

Parameters

  result | Result of the command.
  tile | Tile where the industry is placed.
  indtype | Industry type.

Definition at line 251 of file industry_gui.cpp.

## ◆ CmdBuildIndustry()

enum IndustryControlFlags byte CommandCost CmdBuildIndustry | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | IndustryType | it,
|  | uint32_t | first_layout,
|  | bool | fund,
|  | uint32_t | seed
| ) |  |

Build/Fund an industry.

Parameters

  flags | of operations to conduct
  tile | tile where industry is built
  it | industry type see build_industry.h and see industry.h
  first_layout | first layout to try
  fund | false = prospect, true = fund (only valid if current company is DEITY)
  seed | seed to use for desyncfree randomisations

Returns
  the cost of this operation or an error

Definition at line 2047 of file industry_cmd.cpp.

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

## ◆ CmdIndustrySetExclusivity()

CommandCost CmdIndustrySetExclusivity | ( | DoCommandFlag | flags,
|  | IndustryID | ind_id,
|  | Owner | company_id,
|  | bool | consumer
| ) |  |

Change exclusive consumer or supplier for the industry.

Parameters

  flags | Type of operation.
  ind_id | IndustryID
  company_id | CompanyID to set or INVALID_OWNER (available to everyone) or OWNER_NONE (neutral stations only) or OWNER_DEITY (no one)
  consumer | Set exclusive consumer if true, supplier if false.

Returns
  Empty cost or an error.

Definition at line 2219 of file industry_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Industry::exclusive_consumer, Industry::exclusive_supplier, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), INVALID_OWNER, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, and OWNER_NONE.

## ◆ CmdIndustrySetFlags()

CommandCost CmdIndustrySetFlags | ( | DoCommandFlag | flags,
|  | IndustryID | ind_id,
|  | IndustryControlFlags | ctlflags
| ) |  |

Set industry control flags.

Parameters

  flags | Type of operation.
  ind_id | IndustryID
  ctlflags | IndustryControlFlags

Returns
  Empty cost or an error.

Definition at line 2139 of file industry_cmd.cpp.

References _current_company, CMD_ERROR, Industry::ctlflags, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), INDCTL_MASK, and OWNER_DEITY.

## ◆ CmdIndustrySetProduction()

CommandCost CmdIndustrySetProduction | ( | DoCommandFlag | flags,
|  | IndustryID | ind_id,
|  | byte | prod_level,
|  | bool | show_news,
|  | const std::string & | custom_news
| ) |  |

Set industry production.

Parameters

  flags | Type of operation.
  ind_id | IndustryID
  prod_level | Production level.
  show_news | Show a news message on production change.
  custom_news | Custom news message text.

Returns
  Empty cost or an error.

Definition at line 2160 of file industry_cmd.cpp.

References _current_company, CMD_ERROR, Industry::ctlflags, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), GetIndustrySpec(), INDCTL_EXTERNAL_PROD_LEVEL, NT_INDUSTRY_COMPANY, NT_INDUSTRY_NOBODY, NT_INDUSTRY_OTHER, OWNER_DEITY, Industry::prod_level, PRODLEVEL_MAXIMUM, IndustrySpec::production_down_text, IndustrySpec::production_up_text, Industry::RecomputeProductionMultipliers(), Industry::type, and WhoCanServiceIndustry().

## ◆ CmdIndustrySetText()

CommandCost CmdIndustrySetText | ( | DoCommandFlag | flags,
|  | IndustryID | ind_id,
|  | const std::string & | text
| ) |  |

Change additional industry text.

Parameters

  flags | Type of operation.
  ind_id | IndustryID
  text | - Additional industry text.

Returns
  Empty cost or an error.

Definition at line 2248 of file industry_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), OWNER_DEITY, Industry::text, and WC_INDUSTRY_VIEW.