pool_func.cpp

Go to the documentation of this file.
00001 /* $Id: pool_func.cpp 22136 2011-02-24 06:57:55Z planetmaker $ */
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 "pool_type.hpp"
00014 
00019 /* virtual */ PoolBase::~PoolBase()
00020 {
00021   PoolVector *pools = PoolBase::GetPools();
00022   pools->Erase(pools->Find(this));
00023   if (pools->Length() == 0) delete pools;
00024 }
00025 
00030 /* static */ void PoolBase::Clean(PoolType pt)
00031 {
00032   PoolVector *pools = PoolBase::GetPools();
00033   PoolBase **end = pools->End();
00034   for (PoolBase **ppool = pools->Begin(); ppool != end; ppool++) {
00035     PoolBase *pool = *ppool;
00036     if (pool->type & pt) pool->CleanPool();
00037   }
00038 }