2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file signs.cpp Handling of signs. */
|
2007-04-04 01:35:16 +00:00
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
#include "stdafx.h"
|
2007-04-12 13:07:15 +00:00
|
|
|
#include "landscape.h"
|
2008-03-31 07:25:49 +00:00
|
|
|
#include "signs_base.h"
|
|
|
|
#include "signs_func.h"
|
2007-12-21 19:49:27 +00:00
|
|
|
#include "strings_func.h"
|
2008-01-09 09:57:48 +00:00
|
|
|
#include "viewport_func.h"
|
2007-12-23 10:56:02 +00:00
|
|
|
#include "zoom_func.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "functions.h"
|
2009-05-22 15:13:50 +00:00
|
|
|
#include "core/pool_func.hpp"
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
|
2007-08-02 13:27:45 +00:00
|
|
|
/* Initialize the sign-pool */
|
2009-05-22 15:13:50 +00:00
|
|
|
SignPool _sign_pool("Sign");
|
|
|
|
INSTANTIATE_POOL_METHODS(Sign)
|
2007-08-02 13:27:45 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
Sign::Sign(Owner owner)
|
2005-02-04 14:45:32 +00:00
|
|
|
{
|
2008-01-12 19:58:06 +00:00
|
|
|
this->owner = owner;
|
2007-08-02 13:27:45 +00:00
|
|
|
}
|
2005-02-04 14:45:32 +00:00
|
|
|
|
2007-08-02 13:27:45 +00:00
|
|
|
Sign::~Sign()
|
|
|
|
{
|
2008-01-12 19:58:06 +00:00
|
|
|
free(this->name);
|
2008-09-16 19:05:38 +00:00
|
|
|
|
|
|
|
if (CleaningPool()) return;
|
|
|
|
|
|
|
|
DeleteRenameSignWindow(this->index);
|
2007-08-02 13:27:45 +00:00
|
|
|
}
|
2005-02-04 14:45:32 +00:00
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Update the coordinate of one sign
|
2007-04-04 01:35:16 +00:00
|
|
|
* @param si Pointer to the Sign
|
2005-01-12 11:21:28 +00:00
|
|
|
*
|
|
|
|
*/
|
2009-03-13 20:29:35 +00:00
|
|
|
void UpdateSignVirtCoords(Sign *si)
|
2005-01-12 11:21:28 +00:00
|
|
|
{
|
2006-08-22 16:38:50 +00:00
|
|
|
Point pt = RemapCoords(si->x, si->y, si->z);
|
2007-06-25 10:40:56 +00:00
|
|
|
SetDParam(0, si->index);
|
2009-07-07 16:51:20 +00:00
|
|
|
si->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
|
2005-01-12 11:21:28 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 15:32:25 +00:00
|
|
|
/** Update the coordinates of all signs */
|
2007-03-07 11:47:46 +00:00
|
|
|
void UpdateAllSignVirtCoords()
|
2005-01-12 11:21:28 +00:00
|
|
|
{
|
2006-08-22 16:38:50 +00:00
|
|
|
Sign *si;
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2006-08-22 16:38:50 +00:00
|
|
|
FOR_ALL_SIGNS(si) UpdateSignVirtCoords(si);
|
2005-01-12 11:21:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Initialize the signs
|
|
|
|
*
|
|
|
|
*/
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeSigns()
|
2005-01-12 11:21:28 +00:00
|
|
|
{
|
2009-05-22 15:13:50 +00:00
|
|
|
_sign_pool.CleanPool();
|
2005-01-12 11:21:28 +00:00
|
|
|
}
|