Go to the documentation of this file.
1 /* $Id: signs.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
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 <>.
8  */
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"
24 SignPool _sign_pool("Sign");
30 Sign::Sign(Owner owner)
31 {
32  this->owner = owner;
33 }
37 {
38  free(this->name);
40  if (CleaningPool()) return;
43 }
49 {
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);
53 }
57 {
58  Sign *si;
60  FOR_ALL_SIGNS(si) {
61  si->UpdateVirtCoord();
62  }
63 }
Functions related to OTTD&#39;s strings.
void DeleteRenameSignWindow(SignID sign)
Close the sign window associated with the given sign.
Definition: signs_gui.cpp:580
static Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap...
Definition: landscape.h:83
Tindex index
Index of this pool item.
Definition: pool_type.hpp:147
Functions related to signs.
void UpdatePosition(int center, int top, StringID str, StringID str_small=STR_NULL)
Update the position of the viewport sign.
Definition: viewport.cpp:1314
Some methods of Pool are placed here in order to reduce compilation time and binary size...
Definition of base types and functions in a cross-platform compatible way.
SignPool _sign_pool("Sign")
Initialize the sign-pool.
A number of safeguards to prevent using unsafe methods.
void UpdateAllSignVirtCoords()
Update the coordinates of all signs.
Definition: signs.cpp:56
void UpdateVirtCoord()
Update the coordinate of one sign.
Definition: signs.cpp:48
Base class for all pools.
Definition: pool_type.hpp:83
Force instantiation of pool methods so we don&#39;t get linker errors.
Definition: pool_func.hpp:224
static bool CleaningPool()
Returns current state of pool cleaning - yes or no.
Definition: pool_type.hpp:225
Destroy the sign.
Definition: signs.cpp:36
Functions related to OTTD&#39;s landscape.
Coordinates of a point in 2D.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Definition: depend.cpp:114
Enum for all companies/owners.
Definition: company_type.h:20
Base class for signs.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:201