Merge branch 'development' into feature/no_multiplayer_grf_limit
[openttd-joker.git] / src / signs.cpp
bloba4f8162f43ae2f0fd43c9fcb7cbc24ce7b28f01a
1 /* $Id: signs.cpp 23319 2011-11-24 17:37:20Z peter1138 $ */
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 #include "safeguards.h"
23 /** Initialize the sign-pool */
24 SignPool _sign_pool("Sign");
25 INSTANTIATE_POOL_METHODS(Sign)
27 /**
28 * Creates a new sign
30 Sign::Sign(Owner owner)
32 this->owner = owner;
35 /** Destroy the sign */
36 Sign::~Sign()
38 free(this->name);
40 if (CleaningPool()) return;
42 DeleteRenameSignWindow(this->index);
45 /**
46 * Update the coordinate of one sign
48 void Sign::UpdateVirtCoord()
50 Point pt = RemapCoords(this->x, this->y, this->z);
51 SetDParam(0, this->index);
52 this->sign.UpdatePosition(pt.x, pt.y - 6 * ZOOM_LVL_BASE, STR_WHITE_SIGN);
55 /** Update the coordinates of all signs */
56 void UpdateAllSignVirtCoords()
58 Sign *si;
60 FOR_ALL_SIGNS(si) {
61 si->UpdateVirtCoord();