summaryrefslogtreecommitdiffhomepage
path: root/src/scenery-proto.hpp
blob: 113660aa83748a1b97bed0e2a22b574d053b1088 (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
39
40
41
42
43
44
45
46
47
#pragma once
#include "scenery-type.hpp"
#include "object.hpp"
#include <variant>

namespace floormat {

struct generic_scenery_proto
{
    bool active      : 1 = false;
    bool interactive : 1 = false;

    bool operator==(const generic_scenery_proto& p) const;
    static enum scenery_type scenery_type();
};

struct door_scenery_proto
{
    bool active      : 1 = false;
    bool interactive : 1 = true;
    bool closing     : 1 = false;

    bool operator==(const door_scenery_proto& p) const;
    static enum scenery_type scenery_type();
};

using scenery_proto_variants = std::variant<std::monostate, generic_scenery_proto, door_scenery_proto>;

struct scenery_proto : object_proto
{
    scenery_proto_variants subtype;

    scenery_proto() noexcept;
    ~scenery_proto() noexcept override;
    explicit operator bool() const;
    bool operator==(const object_proto& proto) const override;
    enum scenery_type scenery_type() const;
    scenery_proto(const scenery_proto&) noexcept;
    scenery_proto& operator=(const scenery_proto&) noexcept;
    scenery_proto(scenery_proto&&) noexcept;
    scenery_proto& operator=(scenery_proto&&) noexcept;
};

template<> struct scenery_type_<generic_scenery_proto> : std::integral_constant<scenery_type, scenery_type::generic> {};
template<> struct scenery_type_<door_scenery_proto> : std::integral_constant<scenery_type, scenery_type::door> {};

} // namespace floormat