-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathfurniture_entry.h
36 lines (28 loc) · 888 Bytes
/
furniture_entry.h
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
#pragma once
#include "util.h"
#include "effect.h"
#include "tribe.h"
class Position;
class Creature;
class Furniture;
class FurnitureEntry {
public:
using Sokoban = EmptyStruct<struct SokobanTag>;
struct Trap {
Trap(Effect e, bool s = false) : effect(e), invisible(s) {}
SERIALIZATION_CONSTRUCTOR(Trap)
Effect SERIAL(effect);
bool SERIAL(invisible) = false;
SERIALIZE_ALL(NAMED(effect), OPTION(invisible))
};
using Water = EmptyStruct<struct WaterTag>;
using Magma = EmptyStruct<struct MagmaTag>;
MAKE_VARIANT(EntryData, Sokoban, Trap, Water, Magma, Effect);
template <typename T>
FurnitureEntry(const T& t) : FurnitureEntry(EntryData(t)) {}
FurnitureEntry(EntryData);
void handle(Furniture*, Creature*);
bool isVisibleTo(const Furniture*, const Creature*) const;
SERIALIZATION_DECL(FurnitureEntry)
EntryData SERIAL(entryData);
};