# signs.cpp

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #include "stdafx.h"
    00013 #include "landscape.h"
    00014 #include "signs_base.h"
    00015 #include "signs_func.h"
    00016 #include "strings_func.h"
    00017 #include "core/pool_func.hpp"
    00018
    00019 #include "table/strings.h"
    00020
    00021 /* Initialize the sign-pool */
    00022 SignPool _sign_pool("Sign");
    00023 INSTANTIATE_POOL_METHODS(Sign)
    00024
    00025
    00028 Sign::Sign(Owner owner)
    00029 {
    00030   this->owner = owner;
    00031 }
    00032
    00034 Sign::~Sign()
    00035 {
    00036   free(this->name);
    00037
    00038   if (CleaningPool()) return;
    00039
    00040   DeleteRenameSignWindow(this->index);
    00041 }
    00042
    00046 void Sign::UpdateVirtCoord()
    00047 {
    00048   Point pt = RemapCoords(this->x, this->y, this->z);
    00049   SetDParam(0, this->index);
    00050   this->sign.UpdatePosition(pt.x, pt.y - 6, STR_WHITE_SIGN);
    00051 }
    00052
    00054 void UpdateAllSignVirtCoords()
    00055 {
    00056   Sign *si;
    00057
    00058   FOR_ALL_SIGNS(si) {
    00059     si->UpdateVirtCoord();
    00060   }
    00061 }
    00062
    00068 void InitializeSigns()
    00069 {
    00070   _sign_pool.CleanPool();
    00071 }