Rearrange storage of reserved tracks for railway tiles
[openttd/fttd.git] / src / signs.cpp
blob53465fc8a1cbf53e8b6de04a6427d4cd5c72aaa0
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file signs.cpp Handling of signs. */
12 #include "stdafx.h"
13 #include "landscape.h"
14 #include "signs_base.h"
15 #include "signs_func.h"
16 #include "strings_func.h"
17 #include "core/pool_func.hpp"
19 #include "table/strings.h"
21 /** Initialize the sign-pool */
22 SignPool _sign_pool("Sign");
23 INSTANTIATE_POOL_METHODS(Sign)
25 /**
26 * Creates a new sign
28 Sign::Sign(Owner owner)
30 this->owner = owner;
33 /** Destroy the sign */
34 Sign::~Sign()
36 free(this->name);
38 if (CleaningPool()) return;
40 DeleteRenameSignWindow(this->index);
43 /**
44 * Update the coordinate of one sign
46 void Sign::UpdateVirtCoord()
48 Point pt = RemapCoords(this->x, this->y, this->z);
49 SetDParam(0, this->index);
50 this->sign.UpdatePosition(pt.x, pt.y - 6 * ZOOM_LVL_BASE, STR_WHITE_SIGN);
53 /** Update the coordinates of all signs */
54 void UpdateAllSignVirtCoords()
56 Sign *si;
58 FOR_ALL_SIGNS(si) {
59 si->UpdateVirtCoord();