Files @ r12234:fd1a494e7620
Branch filter:

Location: cpp/openttd-patchpack/source/src/signs.cpp - annotation

smatz
(svn r16659) -Codechange: rename GetAcceptedCargo() to AddAcceptedCargo() and change its behaviour accordingly
-Codechange: remove dummy GetAcceptedCargo_*() handlers
r5584:545d748cc681
r5584:545d748cc681
r9111:983de9c5a848
r6420:01087f989fd1
r5584:545d748cc681
r6453:b0b56773284a
r8790:550c9960067a
r8790:550c9960067a
r8114:866ed489ed98
r8225:491804378826
r8123:dde0a9a84019
r8131:7a50db7be0ff
r11967:df0600d2c7e7
r5584:545d748cc681
r8264:d493cb51fe8a
r8264:d493cb51fe8a
r7384:aaaa0c017200
r11967:df0600d2c7e7
r11967:df0600d2c7e7
r7384:aaaa0c017200
r10207:a1fc2f2a33db
r5584:545d748cc681
r8258:08100da56269
r5584:545d748cc681
r5584:545d748cc681
r7384:aaaa0c017200
r7384:aaaa0c017200
r8258:08100da56269
r10156:5d97c842d2d7
r10156:5d97c842d2d7
r10156:5d97c842d2d7
r10156:5d97c842d2d7
r7384:aaaa0c017200
r7384:aaaa0c017200
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r6420:01087f989fd1
r5584:545d748cc681
r5584:545d748cc681
r11345:85f52e96797f
r5584:545d748cc681
r5584:545d748cc681
r7056:100d5cd282bd
r11725:57bc99fdc1bc
r5584:545d748cc681
r5584:545d748cc681
r10571:99cb9a95b4cf
r6247:96e840dbefcc
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r7545:2cbf405181b3
r5584:545d748cc681
r7545:2cbf405181b3
r5584:545d748cc681
r5584:545d748cc681
r7545:2cbf405181b3
r5584:545d748cc681
r11345:85f52e96797f
r5584:545d748cc681
r6700:d421e53a3cc4
r11356:ae9277304002
r11356:ae9277304002
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r6700:d421e53a3cc4
r6700:d421e53a3cc4
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r5584:545d748cc681
r6247:96e840dbefcc
r5584:545d748cc681
r11967:df0600d2c7e7
r5584:545d748cc681
/* $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
 * @param si Pointer to the Sign
 *
 */
void UpdateSignVirtCoords(Sign *si)
{
	Point pt = RemapCoords(si->x, si->y, si->z);
	SetDParam(0, si->index);
	UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_SIGN_WHITE);
}

/** Update the coordinates of all signs */
void UpdateAllSignVirtCoords()
{
	Sign *si;

	FOR_ALL_SIGNS(si) UpdateSignVirtCoords(si);
}

/**
 * Marks the region of a sign as dirty.
 *
 * This function marks the sign in all viewports as dirty for repaint.
 *
 * @param si Pointer to the Sign
 * @ingroup dirty
 */
void MarkSignDirty(Sign *si)
{
	/* We use ZOOM_LVL_MAX here, as every viewport can have an other zoom,
	 *  and there is no way for us to know which is the biggest. So make the
	 *  biggest area dirty, and we are safe for sure. */
	MarkAllViewportsDirty(
		si->sign.left - 6,
		si->sign.top  - 3,
		si->sign.left + ScaleByZoom(si->sign.width_1 + 12, ZOOM_LVL_MAX),
		si->sign.top  + ScaleByZoom(12, ZOOM_LVL_MAX));
}

/**
 *
 * Initialize the signs
 *
 */
void InitializeSigns()
{
	_sign_pool.CleanPool();
}