* Move a sign to the given coordinates. Ownership of signs * has no meaning/effect whatsoever except for eyecandy. * @param flags type of operation * @param sign_id index of the sign to be moved * @param tile tile to place the sign at * @return the cost of this operation or an error */
| 104 | * @return the cost of this operation or an error |
| 105 | */ |
| 106 | CommandCost CmdMoveSign(DoCommandFlags flags, SignID sign_id, TileIndex tile) |
| 107 | { |
| 108 | Sign *si = Sign::GetIfValid(sign_id); |
| 109 | if (si == nullptr) return CMD_ERROR; |
| 110 | if (!CompanyCanEditSign(si)) return CMD_ERROR; |
| 111 | |
| 112 | /* Move the sign */ |
| 113 | if (flags.Test(DoCommandFlag::Execute)) { |
| 114 | int x = TileX(tile) * TILE_SIZE; |
| 115 | int y = TileY(tile) * TILE_SIZE; |
| 116 | |
| 117 | si->x = x; |
| 118 | si->y = y; |
| 119 | si->z = GetSlopePixelZ(x, y); |
| 120 | if (_game_mode != GM_EDITOR) si->owner = _current_company; |
| 121 | |
| 122 | si->UpdateVirtCoord(); |
| 123 | } |
| 124 | |
| 125 | return CommandCost(); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Callback function that is called after a sign is placed |
nothing calls this directly
no test coverage detected