Fix: Don't allow right-click to close world generation progress window. (#13084)
[openttd-github.git] / src / core / pool_func.cpp
blobe59a2de44777ec73c44d64a3213301f25e973618
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
8 /** @file pool_func.cpp Implementation of PoolBase methods. */
10 #include "../stdafx.h"
11 #include "pool_type.hpp"
13 #include "../safeguards.h"
15 /**
16 * Destructor removes this object from the pool vector and
17 * deletes the vector itself if this was the last item removed.
19 /* virtual */ PoolBase::~PoolBase()
21 PoolVector *pools = PoolBase::GetPools();
22 pools->erase(std::find(pools->begin(), pools->end(), this));
23 if (pools->empty()) delete pools;
26 /**
27 * Clean all pools of given type.
28 * @param pt pool types to clean.
30 /* static */ void PoolBase::Clean(PoolType pt)
32 for (PoolBase *pool : *PoolBase::GetPools()) {
33 if (pool->type & pt) pool->CleanPool();