OpenTTD Source: src/signs_cmd.h File Reference

OpenTTD Source 14.0-beta1

Functions
signs_cmd.h File Reference
`#include "command_type.h"`
`#include "signs_type.h"`

Go to the source code of this file.

## Functions
std::tuple< CommandCost, SignID > | CmdPlaceSign (DoCommandFlag flags, TileIndex tile, const std::string &text)
| Place a sign at the given coordinates. More...
CommandCost | CmdRenameSign (DoCommandFlag flags, SignID sign_id, const std::string &text)
| Rename a sign. More...
void | CcPlaceSign (Commands cmd, const CommandCost &result, SignID new_sign)
| Callback function that is called after a sign is placed. More...

## Detailed Description

Command definitions related to signs.

Definition in file signs_cmd.h.

## Function Documentation

## ◆ CcPlaceSign()

void CcPlaceSign | ( | Commands | ,
|  | const CommandCost & | result,
|  | SignID | new_sign
| ) |  |

Callback function that is called after a sign is placed.

Parameters

  result | of the operation
  new_sign | ID of the placed sign.

Definition at line 108 of file signs_cmd.cpp.

Referenced by PlaceProc_Sign().

## ◆ CmdPlaceSign()

std::tuple<CommandCost, SignID> CmdPlaceSign | ( | DoCommandFlag | flags,
|  | TileIndex | tile,
|  | const std::string & | text
| ) |  |

Place a sign at the given coordinates.

Ownership of sign has no effect whatsoever except for the colour the sign gets for easy recognition, but everybody is able to rename/remove it.

Parameters

  tile | tile to place sign at
  flags | type of operation
  text | contents of the sign

Returns
  the cost of this operation + the ID of the new sign or an error

Definition at line 35 of file signs_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::CanAllocateItem(), CMD_ERROR, DC_EXEC, INVALID_SIGN, MAX_LENGTH_SIGN_NAME_CHARS, and Utf8StringLength().

## ◆ CmdRenameSign()

CommandCost CmdRenameSign | ( | DoCommandFlag | flags,
|  | SignID | sign_id,
|  | const std::string & | text
| ) |  |

Rename a sign.

If the new name of the sign is empty, we assume the user wanted to delete it. So delete it. Ownership of signs has no meaning/effect whatsoever except for eyecandy

Parameters

  flags | type of operation
  sign_id | index of the sign to be renamed/removed
  text | the new name or an empty string when resetting to the default

Returns
  the cost of this operation or an error

Definition at line 72 of file signs_cmd.cpp.

References CMD_ERROR, CompanyCanRenameSign(), DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::GetIfValid(), MAX_LENGTH_SIGN_NAME_CHARS, and Utf8StringLength().