mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 21:33:51 +00:00
64 lines
1003 B
C++
64 lines
1003 B
C++
/* $Id$ */
|
|
|
|
/** @file signs.cpp Handling of signs. */
|
|
|
|
#include "stdafx.h"
|
|
#include "landscape.h"
|
|
#include "signs_base.h"
|
|
#include "signs_func.h"
|
|
#include "strings_func.h"
|
|
#include "viewport_func.h"
|
|
#include "zoom_func.h"
|
|
#include "functions.h"
|
|
#include "core/pool_func.hpp"
|
|
|
|
#include "table/strings.h"
|
|
|
|
/* Initialize the sign-pool */
|
|
SignPool _sign_pool("Sign");
|
|
INSTANTIATE_POOL_METHODS(Sign)
|
|
|
|
Sign::Sign(Owner owner)
|
|
{
|
|
this->owner = owner;
|
|
}
|
|
|
|
Sign::~Sign()
|
|
{
|
|
free(this->name);
|
|
|
|
if (CleaningPool()) return;
|
|
|
|
DeleteRenameSignWindow(this->index);
|
|
}
|
|
|
|
/**
|
|
* Update the coordinate of one sign
|
|
*/
|
|
void Sign::UpdateVirtCoord()
|
|
{
|
|
Point pt = RemapCoords(this->x, this->y, this->z);
|
|
SetDParam(0, this->index);
|
|
this->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
|
|
}
|
|
|
|
/** Update the coordinates of all signs */
|
|
void UpdateAllSignVirtCoords()
|
|
{
|
|
Sign *si;
|
|
|
|
FOR_ALL_SIGNS(si) {
|
|
si->UpdateVirtCoord();
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Initialize the signs
|
|
*
|
|
*/
|
|
void InitializeSigns()
|
|
{
|
|
_sign_pool.CleanPool();
|
|
}
|