# tilearea_type.h

Go to the documentation of this file.

    00001 /* $Id: tilearea_type.h 19393 2010-03-12 21:12:35Z 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 #ifndef TILEAREA_TYPE_H
    00013 #define TILEAREA_TYPE_H
    00014
    00015 #include "tile_type.h"
    00016
    00018 struct TileArea {
    00019   TileIndex tile;
    00020   uint16 w;
    00021   uint16 h;
    00022
    00024   TileArea() {}
    00025
    00032   TileArea(TileIndex tile, uint8 w, uint8 h) : tile(tile), w(w), h(h) {}
    00033
    00034   TileArea(TileIndex start, TileIndex end);
    00035
    00036
    00037   void Add(TileIndex to_add);
    00038
    00042   void Clear()
    00043   {
    00044     this->tile = INVALID_TILE;
    00045     this->w    = 0;
    00046     this->h    = 0;
    00047   }
    00048
    00049   bool Intersects(const TileArea &ta) const;
    00050
    00051   void ClampToMap();
    00052 };
    00053
    00054 #endif /* TILEAREA_TYPE_H */