Files
@ r16464:ae3f342df07b
Branch filter:
Location: cpp/openttd-patchpack/source/src/tilearea_type.h - annotation
r16464:ae3f342df07b
1.7 KiB
text/x-c
(svn r21198) -Fix: don't call variables properties in debug messages
r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r16301:77dff03489e3 r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14459:28d2c5eeb292 r14793:a45ff0f9b914 r14793:a45ff0f9b914 r14459:28d2c5eeb292 r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec r14168:135d7d8d5e5b r14168:135d7d8d5e5b r14462:59a5df88e4d2 r14462:59a5df88e4d2 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r16301:77dff03489e3 r14156:7136b6af34ec r14156:7136b6af34ec r14156:7136b6af34ec | /* $Id$ */
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file tilearea_type.h Type for storing the 'area' of something uses on the map. */
#ifndef TILEAREA_TYPE_H
#define TILEAREA_TYPE_H
#include "map_func.h"
/** Represents the covered area of e.g. a rail station */
struct TileArea {
TileIndex tile; ///< The base tile of the area
uint16 w; ///< The width of the area
uint16 h; ///< The height of the area
/** Just construct this tile area */
TileArea() {}
/**
* Construct this tile area with some set values
* @param tile the base tile
* @param w the width
* @param h the height
*/
TileArea(TileIndex tile, uint8 w, uint8 h) : tile(tile), w(w), h(h) {}
TileArea(TileIndex start, TileIndex end);
void Add(TileIndex to_add);
/**
* Clears the 'tile area', i.e. make the tile invalid.
*/
void Clear()
{
this->tile = INVALID_TILE;
this->w = 0;
this->h = 0;
}
bool Intersects(const TileArea &ta) const;
void ClampToMap();
/**
* Get the center tile.
* @return The tile at the center, or just north of it.
*/
TileIndex GetCenterTile() const
{
return TILE_ADDXY(this->tile, this->w / 2, this->h / 2);
}
};
#endif /* TILEAREA_TYPE_H */
|