OpenTTD Source 20241224-master-gee860a5c8e
industry_cmd.h File Reference

Command definitions related to industries. More...

#include "command_type.h"
#include "company_type.h"
#include "industry_type.h"

Go to the source code of this file.

Functions

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

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_t  ,
bool  ,
uint32_t   
)

Command callback.

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

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

Definition at line 255 of file industry_gui.cpp.

References IndustrySpec::enabled, CommandCost::GetErrorMessage(), GetIndustrySpec(), IndustrySpec::name, NUM_INDUSTRYTYPES, SetDParam(), ShowErrorMessage(), CommandCost::Succeeded(), TILE_SIZE, TileX(), TileY(), and WL_INFO.

Referenced by BuildIndustryWindow::OnPlaceObject().

◆ CmdBuildIndustry()

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

◆ CmdIndustrySetExclusivity()

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

Change exclusive consumer or supplier for the industry.

Parameters
flagsType of operation.
ind_idIndustryID
company_idCompanyID to set or INVALID_OWNER (available to everyone) or OWNER_NONE (neutral stations only) or OWNER_DEITY (no one)
consumerSet exclusive consumer if true, supplier if false.
Returns
Empty cost or an error.

Definition at line 2218 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
flagsType of operation.
ind_idIndustryID
ctlflagsIndustryControlFlags
Returns
Empty cost or an error.

Definition at line 2140 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,
uint8_t  prod_level,
bool  show_news,
const std::string &  custom_news 
)

◆ CmdIndustrySetText()

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