summaryrefslogtreecommitdiffhomepage
path: root/src/tile.hpp
blob: e8bac83499b4f82f28df017600c08a3af5cd51cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include "compat/defs.hpp"
#include "compat/integer-types.hpp"
#include "tile-defs.hpp"
#include <memory>

namespace floormat {

struct tile_atlas;

struct tile_image final
{
    std::shared_ptr<tile_atlas> atlas;
    std::size_t variant = (std::size_t)-1;

    explicit operator bool() const noexcept { return !!atlas; }

    std::strong_ordering operator<=>(const tile_image& o) const noexcept
    {
        const auto ret = atlas.get() <=> o.atlas.get();
        return ret != std::strong_ordering::equal ? ret : variant <=> o.variant;
    }
};

struct tile final
{
    enum pass_mode : std::uint8_t { pass_blocked, pass_ok, pass_shoot_through, };

    tile_image ground_image, wall_north, wall_west;
    pass_mode passability = pass_shoot_through;

    constexpr tile() = default;
    tile(tile&&) = default;

    fm_DECLARE_DEPRECATED_COPY_ASSIGNMENT(tile);
};

} //namespace floormat