OpenTTD
Functions | Variables
signs_cmd.cpp File Reference

Handling of sign related commands. More...

#include "stdafx.h"
#include "landscape.h"
#include "company_func.h"
#include "signs_base.h"
#include "signs_func.h"
#include "command_func.h"
#include "tilehighlight_func.h"
#include "window_func.h"
#include "string_func.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

CommandCost CmdPlaceSign (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 Place a sign at the given coordinates. More...
 
CommandCost CmdRenameSign (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 Rename a sign. More...
 
void CcPlaceSign (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 Callback function that is called after a sign is placed. More...
 
void PlaceProc_Sign (TileIndex tile)
 PlaceProc function, called when someone pressed the button if the sign-tool is selected. More...
 

Variables

SignID _new_sign_id
 The last built sign. More...
 

Detailed Description

Handling of sign related commands.

Definition in file signs_cmd.cpp.

Function Documentation

◆ CcPlaceSign()

void CcPlaceSign ( const CommandCost result,
TileIndex  tile,
uint32  p1,
uint32  p2 
)

Callback function that is called after a sign is placed.

Parameters
resultof the operation
tileunused
p1unused
p2unused

Definition at line 118 of file signs_cmd.cpp.

References _new_sign_id, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::Get(), ResetObjectToPlace(), and ShowRenameSignWindow().

Referenced by PlaceProc_Sign().

◆ CmdPlaceSign()

CommandCost CmdPlaceSign ( TileIndex  tile,
DoCommandFlag  flags,
uint32  p1,
uint32  p2,
const char *  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
tiletile to place sign at
flagstype of operation
p1unused
p2unused
textunused
Returns
the cost of this operation or an error

Definition at line 40 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, MAX_LENGTH_SIGN_NAME_CHARS, return_cmd_error, StrEmpty(), and Utf8StringLength().

◆ CmdRenameSign()

CommandCost CmdRenameSign ( TileIndex  tile,
DoCommandFlag  flags,
uint32  p1,
uint32  p2,
const char *  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
tileunused
flagstype of operation
p1index of the sign to be renamed/removed
p2unused
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 79 of file signs_cmd.cpp.

References _current_company, CMD_ERROR, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_sign_pool >::GetIfValid(), and OWNER_DEITY.

◆ PlaceProc_Sign()

void PlaceProc_Sign ( TileIndex  tile)

PlaceProc function, called when someone pressed the button if the sign-tool is selected.

Parameters
tileon which to place the sign

Definition at line 132 of file signs_cmd.cpp.

References CcPlaceSign(), CMD_MSG, CMD_PLACE_SIGN, and DoCommandP().

Variable Documentation

◆ _new_sign_id

SignID _new_sign_id

The last built sign.

Definition at line 27 of file signs_cmd.cpp.

Referenced by CcPlaceSign().