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"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. | |
| CommandCost | CmdRenameSign (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Rename a sign. | |
| void | CcPlaceSign (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) |
| Callback function that is called after a sign is placed. | |
| void | PlaceProc_Sign (TileIndex tile) |
| PlaceProc function, called when someone pressed the button if the sign-tool is selected. | |
Variables | |
| SignID | _new_sign_id |
Handling of sign related commands.
Definition in file signs_cmd.cpp.
| void CcPlaceSign | ( | const CommandCost & | result, | |
| TileIndex | tile, | |||
| uint32 | p1, | |||
| uint32 | p2 | |||
| ) |
Callback function that is called after a sign is placed.
| result | of the operation | |
| tile | unused | |
| p1 | unused | |
| p2 | unused |
Definition at line 114 of file signs_cmd.cpp.
References CommandCost::Failed(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_sign_pool >::Get().
Referenced by PlaceProc_Sign().
| 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.
| tile | tile to place sign at | |
| flags | type of operation | |
| p1 | unused | |
| p2 | unused | |
| text | unused |
Definition at line 37 of file signs_cmd.cpp.
References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_sign_pool >::CanAllocateItem(), CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWindowData(), MAX_LENGTH_SIGN_NAME_CHARS, return_cmd_error, StrEmpty(), TILE_SIZE, TileX(), TileY(), Sign::UpdateVirtCoord(), and Utf8StringLength().
| 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
| tile | unused | |
| flags | type of operation | |
| p1 | index of the sign to be renamed/removed | |
| p2 | unused | |
| text | the new name or an empty string when resetting to the default |
Definition at line 76 of file signs_cmd.cpp.
References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_sign_pool >::GetIfValid(), InvalidateWindowData(), ViewportSign::MarkDirty(), MAX_LENGTH_SIGN_NAME_CHARS, StrEmpty(), Sign::UpdateVirtCoord(), and Utf8StringLength().
| void PlaceProc_Sign | ( | TileIndex | tile | ) |
PlaceProc function, called when someone pressed the button if the sign-tool is selected.
| tile | on which to place the sign |
Definition at line 128 of file signs_cmd.cpp.
References CcPlaceSign(), CMD_MSG, CMD_PLACE_SIGN, and DoCommandP().
Referenced by ScenarioEditorToolbarWindow::OnPlaceObject(), MainToolbarWindow::OnPlaceObject(), and TerraformToolbarWindow::OnPlaceObject().
1.7.1