2015-08-02 11:29:04 +00:00
|
|
|
/*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2015-08-02 09:57:53 +00:00
|
|
|
/** @file zoning.h */
|
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
#ifndef ZONING_H
|
|
|
|
#define ZONING_H
|
2015-08-02 09:57:53 +00:00
|
|
|
|
|
|
|
#include "tile_cmd.h"
|
2015-08-02 11:29:04 +00:00
|
|
|
#include "company_type.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Zoning evaluation modes
|
|
|
|
*/
|
2024-01-07 16:41:53 +00:00
|
|
|
enum ZoningEvaluationMode : uint8_t {
|
2015-08-02 11:29:04 +00:00
|
|
|
ZEM_NOTHING = 0, ///< No zoning action selected
|
|
|
|
ZEM_AUTHORITY, ///< Check the local authority's opinion.
|
|
|
|
ZEM_CAN_BUILD, ///< Check wither or not the player can build.
|
|
|
|
ZEM_STA_CATCH, ///< Check catchment area for stations
|
2016-01-01 12:17:11 +00:00
|
|
|
ZEM_STA_CATCH_WIN, ///< Check catchment area for stations with their station windows open
|
2015-08-02 11:29:04 +00:00
|
|
|
ZEM_BUL_UNSER, ///< Check for unserved buildings
|
|
|
|
ZEM_IND_UNSER, ///< Check for unserved industries
|
2015-10-14 23:23:46 +00:00
|
|
|
ZEM_TRACERESTRICT, ///< Check for restricted signals
|
2018-10-06 12:01:01 +00:00
|
|
|
ZEM_2x2_GRID, ///< Show 2x2 town road grid
|
|
|
|
ZEM_3x3_GRID, ///< Show 3x3 town road grid
|
2020-10-26 03:45:35 +00:00
|
|
|
ZEM_ONE_WAY_ROAD, ///< Show one way roads
|
2019-03-12 18:44:40 +00:00
|
|
|
|
2024-01-10 18:28:43 +00:00
|
|
|
ZEM_LAST_NORMAL_MODE = ZEM_ONE_WAY_ROAD,
|
|
|
|
|
|
|
|
ZEM_DBG_WATER_FLOOD,
|
|
|
|
ZEM_DBG_WATER_REGION,
|
|
|
|
ZEM_DBG_TROPIC_ZONE,
|
|
|
|
ZEM_DBG_ANIMATED_TILE,
|
2015-08-02 09:57:53 +00:00
|
|
|
};
|
|
|
|
|
2018-01-22 17:49:53 +00:00
|
|
|
/**
|
|
|
|
* Zoning evaluation modes
|
|
|
|
*/
|
|
|
|
enum ZoningModeMask {
|
|
|
|
ZMM_NOTHING = 0, ///< No zoning mask
|
|
|
|
ZMM_INNER, ///< Inner
|
|
|
|
ZMM_OUTER, ///< Outer
|
|
|
|
ZMM_ALL = ZMM_INNER | ZMM_OUTER,
|
|
|
|
};
|
|
|
|
DECLARE_ENUM_AS_BIT_SET(ZoningModeMask)
|
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
/**
|
|
|
|
* Global Zoning state structure
|
|
|
|
*/
|
2015-08-02 09:57:53 +00:00
|
|
|
struct Zoning {
|
2015-08-02 11:29:04 +00:00
|
|
|
ZoningEvaluationMode inner;
|
|
|
|
ZoningEvaluationMode outer;
|
2015-08-02 09:57:53 +00:00
|
|
|
};
|
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
extern Zoning _zoning;
|
2015-08-02 09:57:53 +00:00
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
SpriteID TileZoningSpriteEvaluation(TileIndex tile, Owner owner, ZoningEvaluationMode ev_mode);
|
2015-08-02 09:57:53 +00:00
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
int TileZoningEvaluation(TileIndex tile, Owner owner, ZoningEvaluationMode ev_mode);
|
2015-08-02 09:57:53 +00:00
|
|
|
|
|
|
|
void DrawTileZoning(const TileInfo *ti);
|
|
|
|
|
|
|
|
void ShowZoningToolbar();
|
|
|
|
|
2018-01-22 17:49:53 +00:00
|
|
|
void ZoningMarkDirtyStationCoverageArea(const Station *st, ZoningModeMask mask = ZMM_ALL);
|
2015-11-01 16:07:55 +00:00
|
|
|
inline void ZoningMarkDirtyStationCoverageArea(const Waypoint *st) { } // no-op
|
|
|
|
|
2018-01-22 17:49:53 +00:00
|
|
|
void ZoningStationWindowOpenClose(const Station *st);
|
2018-05-10 23:03:49 +00:00
|
|
|
void ZoningTownAuthorityRatingChange();
|
2018-01-22 17:49:53 +00:00
|
|
|
|
|
|
|
void SetZoningMode(bool inner, ZoningEvaluationMode mode);
|
2020-10-26 22:17:25 +00:00
|
|
|
void PostZoningModeChange();
|
2018-01-22 17:49:53 +00:00
|
|
|
|
|
|
|
void ClearZoningCaches();
|
2016-01-01 12:17:11 +00:00
|
|
|
|
2015-08-02 11:29:04 +00:00
|
|
|
#endif /* ZONING_H */
|