OpenTTD Source: src/newgrf_canal.h Source File

OpenTTD Source 15.3

newgrf_canal.h
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
10#ifndef NEWGRF_CANAL_H
11#define NEWGRF_CANAL_H
12
13#include "newgrf.h"
14#include "newgrf_callbacks.h"
15#include "tile_type.h"
16
18 enum CanalFeatureFlag : uint8_t {
19 CFF_HAS_FLAT_SPRITE = 0,
20};
21
23 struct WaterFeature {
24 const SpriteGroup *group = nullptr;
25 const GRFFile *grffile = nullptr;
26 CanalCallbackMasks callback_mask = {};
27 uint8_t flags = 0;
28};
29
30
32extern std::array<WaterFeature, CF_END> _water_feature;
33
34
35 SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile);
36
37uint GetCanalSpriteOffset(CanalFeature feature, TileIndex tile, uint cur_offset);
38
39#endif /* NEWGRF_CANAL_H */
EnumBitSet< CanalCallbackMask, uint8_t >
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition gfx_type.h:17
newgrf.h
Base for the NewGRF implementation.
CanalFeature
CanalFeature
List of different canal 'features'.
Definition newgrf.h:25
newgrf_callbacks.h
Callbacks that NewGRFs could implement.
GetCanalSpriteOffset
uint GetCanalSpriteOffset(CanalFeature feature, TileIndex tile, uint cur_offset)
Get the new sprite offset for a water tile.
Definition newgrf_canal.cpp:171
_water_feature
std::array< WaterFeature, CF_END > _water_feature
Table of canal 'feature' sprite groups.
Definition newgrf_canal.cpp:20
GetCanalSprite
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
Lookup the base sprite to use for a canal.
Definition newgrf_canal.cpp:139
CanalFeatureFlag
CanalFeatureFlag
Flags controlling the display of canals.
Definition newgrf_canal.h:18
CFF_HAS_FLAT_SPRITE
@ CFF_HAS_FLAT_SPRITE
Additional flat ground sprite in the beginning.
Definition newgrf_canal.h:19
GRFFile
Dynamic data of a loaded NewGRF.
Definition newgrf.h:114
SpriteGroup
Definition newgrf_spritegroup.h:47
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
WaterFeature
Information about a water feature.
Definition newgrf_canal.h:23
WaterFeature::group
const SpriteGroup * group
Sprite group to start resolving.
Definition newgrf_canal.h:24
WaterFeature::grffile
const GRFFile * grffile
NewGRF where 'group' belongs to.
Definition newgrf_canal.h:25
WaterFeature::callback_mask
CanalCallbackMasks callback_mask
Bitmask of canal callbacks that have to be called.
Definition newgrf_canal.h:26
WaterFeature::flags
uint8_t flags
Flags controlling display.
Definition newgrf_canal.h:27
tile_type.h
Types related to tiles.