OpenTTD Source 20261112-master-gbcbec5e63f
tilearea_bitmap.cpp
Go to the documentation of this file.
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "stdafx.h"
11
12#include "tilearea_bitmap.h"
13
14#include "safeguards.h"
15
21{
22 this->data.resize(static_cast<size_t>(this->ta.w) * this->ta.h);
23}
24
30{
31 return this->ta.IsEmpty() || std::ranges::none_of(this->data, [](bool b) {
32 return b;
33 });
34}
35
41{
42 this->ta.tile = ta.tile;
43 this->ta.w = ta.w;
44 this->ta.h = ta.h;
45
46 this->data.clear();
47 this->data.resize(static_cast<size_t>(this->ta.w) * this->ta.h);
48}
BitmapTileArea()=default
Construct an empty bitmap tile area.
OrthogonalTileArea ta
Underlying tile area.
std::vector< bool > data
Storage of tiles contained within the tile area.
bool IsEmpty() const
Test if this tile area is empty.
void Initialize(const OrthogonalTileArea &ta)
Initialize the BitmapTileArea with the specified OrthogonalTileArea.
Represents the covered area of e.g.
uint16_t w
The width of the area.
TileIndex tile
The base tile of the area.
uint16_t h
The height of the area.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Classes for storing and iterating a tile area.