signs.cpp

Go to the documentation of this file.
00001 /* $Id: signs.cpp 17693 2009-10-04 17:16:41Z rubidium $ */
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 Sign::Sign(Owner owner)
00026 {
00027   this->owner = owner;
00028 }
00029 
00030 Sign::~Sign()
00031 {
00032   free(this->name);
00033 
00034   if (CleaningPool()) return;
00035 
00036   DeleteRenameSignWindow(this->index);
00037 }
00038 
00042 void Sign::UpdateVirtCoord()
00043 {
00044   Point pt = RemapCoords(this->x, this->y, this->z);
00045   SetDParam(0, this->index);
00046   this->sign.UpdatePosition(pt.x, pt.y - 6, STR_WHITE_SIGN);
00047 }
00048 
00050 void UpdateAllSignVirtCoords()
00051 {
00052   Sign *si;
00053 
00054   FOR_ALL_SIGNS(si) {
00055     si->UpdateVirtCoord();
00056   }
00057 }
00058 
00064 void InitializeSigns()
00065 {
00066   _sign_pool.CleanPool();
00067 }

Generated on Sat Jun 5 21:52:10 2010 for OpenTTD by  doxygen 1.6.1