OpenTTD Source 20241224-master-gf74b0cf984
animated_tile_map.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 <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef ANIMATED_TILE_MAP_H
11#define ANIMATED_TILE_MAP_H
12
13#include "core/bitmath_func.hpp"
14#include "map_func.h"
15
19enum class AnimatedTileState : uint8_t {
20 None = 0,
21 Deleted = 1,
22 Animated = 3,
23};
24
31{
32 return static_cast<AnimatedTileState>(GB(t.m6(), 0, 2));
33}
34
40{
41 SB(t.m6(), 0, 2, to_underlying(state));
42}
43
44#endif /* ANIMATED_TILE_MAP_H */
AnimatedTileState
Animation state of a possibly-animated tile.
@ Animated
Tile is animated.
@ Deleted
Tile was animated but should be removed.
@ None
Tile is not animated.
void SetAnimatedTileState(Tile t, AnimatedTileState state)
Set the animated state of a tile.
AnimatedTileState GetAnimatedTileState(Tile t)
Get the animated state of a tile.
Functions related to bit mathematics.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Wrapper class to abstract away the way the tiles are stored.
Definition map_func.h:25
debug_inline uint8_t & m6()
General purpose.
Definition map_func.h:173
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Definition enum_type.hpp:15
Functions related to maps.