Codefix: [NewGRF] Don't read an extended byte into uint8_t. (#13302)
[openttd-github.git] / src / animated_tile_map.h
blob4103a948e403f6e09b3903f17e68b463c113d965
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 */
8 /** @file animated_tile_map.h Maps accessors for animated tiles. */
10 #ifndef ANIMATED_TILE_MAP_H
11 #define ANIMATED_TILE_MAP_H
13 #include "core/bitmath_func.hpp"
14 #include "map_func.h"
16 /**
17 * Animation state of a possibly-animated tile.
19 enum class AnimatedTileState : uint8_t {
20 None = 0, ///< Tile is not animated.
21 Deleted = 1, ///< Tile was animated but should be removed.
22 Animated = 3, ///< Tile is animated.
25 /**
26 * Get the animated state of a tile.
27 * @param t The tile.
28 * @returns true iff the tile is animated.
30 inline AnimatedTileState GetAnimatedTileState(Tile t)
32 return static_cast<AnimatedTileState>(GB(t.m6(), 0, 2));
35 /**
36 * Set the animated state of a tile.
37 * @param t The tile.
39 inline void SetAnimatedTileState(Tile t, AnimatedTileState state)
41 SB(t.m6(), 0, 2, to_underlying(state));
44 #endif /* ANIMATED_TILE_MAP_H */