|
@@ -81,25 +81,25 @@ static void MarkSignDirty(Sign *si)
|
|
|
si->sign.top + ScaleByZoom(12, ZOOM_LVL_MAX));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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.
|
|
|
* @param tile tile to place sign at
|
|
|
* @param flags type of operation
|
|
|
* @param p1 unused
|
|
|
* @param p2 unused
|
|
|
*/
|
|
|
CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
/* Try to locate a new sign */
|
|
|
if (!Sign::CanAllocateItem()) return_cmd_error(STR_2808_TOO_MANY_SIGNS);
|
|
|
|
|
|
/* Check sign text length if any */
|
|
|
if (!StrEmpty(text) && strlen(text) >= MAX_LENGTH_SIGN_NAME_BYTES) return CMD_ERROR;
|
|
|
|
|
|
/* When we execute, really make the sign */
|
|
|
if (flags & DC_EXEC) {
|
|
|
Sign *si = new Sign(_current_company);
|
|
|
int x = TileX(tile) * TILE_SIZE;
|
|
|
int y = TileY(tile) * TILE_SIZE;
|
|
@@ -119,25 +119,25 @@ CommandCost CmdPlaceSign(TileIndex tile,
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** 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
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of the sign to be renamed/removed
|
|
|
* @param p2 unused
|
|
|
* @return 0 if succesfull, otherwise CMD_ERROR
|
|
|
*/
|
|
|
CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
if (!IsValidSignID(p1)) return CMD_ERROR;
|
|
|
|
|
|
/* Rename the signs when empty, otherwise remove it */
|
|
|
if (!StrEmpty(text)) {
|
|
|
if (strlen(text) >= MAX_LENGTH_SIGN_NAME_BYTES) return CMD_ERROR;
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
Sign *si = GetSign(p1);
|
|
|
|
|
|
/* Delete the old name */
|
|
|
free(si->name);
|