-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathroom.h
296 lines (282 loc) · 7.84 KB
/
room.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#pragma once
#include "apply.h"
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include "df/construction_type.h"
#include "df/coord.h"
#include "df/furnace_type.h"
#include "df/stockpile_list.h"
#include "df/tile_dig_designation.h"
#include "df/tiletype_shape_basic.h"
#include "df/workshop_type.h"
namespace df
{
struct building;
}
struct furniture;
#define ROOM_ENUMS \
BEGIN_ENUM(room, status) \
ENUM_ITEM(plan) \
ENUM_ITEM(dig) \
ENUM_ITEM(dug) \
ENUM_ITEM(finished) \
END_ENUM(room, status) \
\
BEGIN_ENUM(room, type) \
ENUM_ITEM(corridor) \
\
ENUM_ITEM(barracks) \
ENUM_ITEM(bedroom) \
ENUM_ITEM(cemetery) \
ENUM_ITEM(cistern) \
ENUM_ITEM(dininghall) \
ENUM_ITEM(farmplot) \
ENUM_ITEM(furnace) \
ENUM_ITEM(garbagedump) \
ENUM_ITEM(infirmary) \
ENUM_ITEM(jail) \
ENUM_ITEM(location) \
ENUM_ITEM(nobleroom) \
ENUM_ITEM(outpost) \
ENUM_ITEM(pasture) \
ENUM_ITEM(pitcage) \
ENUM_ITEM(pond) \
ENUM_ITEM(releasecage) \
ENUM_ITEM(stockpile) \
ENUM_ITEM(tradedepot) \
ENUM_ITEM(windmill) \
ENUM_ITEM(workshop) \
END_ENUM(room, type) \
\
BEGIN_ENUM(corridor, type) \
ENUM_ITEM(corridor) \
ENUM_ITEM(veinshaft) \
ENUM_ITEM(aqueduct) \
ENUM_ITEM(outpost) \
ENUM_ITEM(walkable) \
END_ENUM(corridor, type) \
\
BEGIN_ENUM(farm, type) \
ENUM_ITEM(food) \
ENUM_ITEM(cloth) \
END_ENUM(farm, type) \
\
BEGIN_ENUM(stockpile, type) \
ENUM_ITEM(food) \
ENUM_ITEM(furniture) \
ENUM_ITEM(wood) \
ENUM_ITEM(stone) \
ENUM_ITEM(refuse) \
ENUM_ITEM(animals) \
ENUM_ITEM(corpses) \
ENUM_ITEM(gems) \
ENUM_ITEM(finished_goods) \
ENUM_ITEM(cloth) \
ENUM_ITEM(bars_blocks) \
ENUM_ITEM(leather) \
ENUM_ITEM(ammo) \
ENUM_ITEM(armor) \
ENUM_ITEM(weapons) \
ENUM_ITEM(coins) \
ENUM_ITEM(sheets) \
ENUM_ITEM(fresh_raw_hide) \
END_ENUM(stockpile, type) \
\
BEGIN_ENUM(nobleroom, type) \
ENUM_ITEM(tomb) \
ENUM_ITEM(dining) \
ENUM_ITEM(bedroom) \
ENUM_ITEM(office) \
END_ENUM(nobleroom, type) \
\
BEGIN_ENUM(outpost, type) \
ENUM_ITEM(cavern) \
ENUM_ITEM(mining) \
END_ENUM(outpost, type) \
\
BEGIN_ENUM(location, type) \
ENUM_ITEM(guildhall) \
ENUM_ITEM(library) \
ENUM_ITEM(tavern) \
ENUM_ITEM(temple) \
END_ENUM(location, type) \
\
BEGIN_ENUM(cistern, type) \
ENUM_ITEM(well) \
ENUM_ITEM(reserve) \
END_ENUM(cistern, type) \
\
BEGIN_ENUM(layout, type) \
ENUM_ITEM(none) \
\
ENUM_ITEM(archery_target) \
ENUM_ITEM(armor_stand) \
ENUM_ITEM(bed) \
ENUM_ITEM(bookcase) \
ENUM_ITEM(cabinet) \
ENUM_ITEM(cage) \
ENUM_ITEM(cage_trap) \
ENUM_ITEM(chair) \
ENUM_ITEM(chest) \
ENUM_ITEM(coffin) \
ENUM_ITEM(door) \
ENUM_ITEM(floodgate) \
ENUM_ITEM(gear_assembly) \
ENUM_ITEM(hatch) \
ENUM_ITEM(hive) \
ENUM_ITEM(lever) \
ENUM_ITEM(nest_box) \
ENUM_ITEM(offering_place) \
ENUM_ITEM(pedestal) \
ENUM_ITEM(restraint) \
ENUM_ITEM(roller) \
ENUM_ITEM(statue) \
ENUM_ITEM(table) \
ENUM_ITEM(track_stop) \
ENUM_ITEM(traction_bench) \
ENUM_ITEM(vertical_axle) \
ENUM_ITEM(weapon_rack) \
ENUM_ITEM(well) \
END_ENUM(layout, type) \
\
BEGIN_ENUM(task, type) \
ENUM_ITEM(check_construct) \
ENUM_ITEM(check_furnish) \
ENUM_ITEM(check_idle) \
ENUM_ITEM(check_rooms) \
ENUM_ITEM(construct_activityzone) \
ENUM_ITEM(construct_farmplot) \
ENUM_ITEM(construct_furnace) \
ENUM_ITEM(construct_stockpile) \
ENUM_ITEM(construct_tradedepot) \
ENUM_ITEM(construct_windmill) \
ENUM_ITEM(construct_workshop) \
ENUM_ITEM(dig_cistern) \
ENUM_ITEM(dig_garbage) \
ENUM_ITEM(dig_room) \
ENUM_ITEM(dig_room_immediate) \
ENUM_ITEM(furnish) \
ENUM_ITEM(monitor_cistern) \
ENUM_ITEM(monitor_farm_irrigation) \
ENUM_ITEM(monitor_room_value) \
ENUM_ITEM(rescue_caged) \
ENUM_ITEM(setup_farmplot) \
ENUM_ITEM(want_dig) \
END_ENUM(task, type)
#define BEGIN_ENUM BEGIN_DECLARE_ENUM
#define ENUM_ITEM DECLARE_ENUM_ITEM
#define END_ENUM END_DECLARE_ENUM
ROOM_ENUMS
#undef BEGIN_ENUM
#undef ENUM_ITEM
#undef END_ENUM
struct room
{
room_status::status status;
room_type::type type;
corridor_type::type corridor_type;
farm_type::type farm_type;
stockpile_type::type stockpile_type;
nobleroom_type::type nobleroom_type;
outpost_type::type outpost_type;
location_type::type location_type;
cistern_type::type cistern_type;
df::workshop_type workshop_type;
df::furnace_type furnace_type;
std::string raw_type;
std::string comment;
df::coord min, max;
std::vector<room *> accesspath;
std::vector<furniture *> layout;
int32_t owner;
int32_t bld_id;
int32_t squad_id;
int32_t level;
int32_t noblesuite;
int32_t queue;
room *workshop;
std::set<int32_t> users;
df::coord channel_enable;
std::set<df::stockpile_list> stock_disable;
bool stock_specific1;
bool stock_specific2;
size_t has_users;
bool furnished;
bool queue_dig;
bool temporary;
bool outdoor;
bool channeled;
bool build_when_accessible;
int32_t required_value;
int32_t data1;
int32_t data2;
room(room_type::type type, df::coord min, df::coord max, std::string comment = "");
room(corridor_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(farm_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(stockpile_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(nobleroom_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(outpost_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(location_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(cistern_type::type subtype, df::coord min, df::coord max, std::string comment = "");
room(df::workshop_type subtype, df::coord min, df::coord max, std::string comment = "");
room(df::furnace_type subtype, df::coord min, df::coord max, std::string comment = "");
~room();
inline df::coord size() const { return max - min + df::coord{ 1, 1, 1 }; }
inline df::coord pos() const
{
df::coord s{ size() };
return df::coord{ uint16_t(min.x + s.x / 2), uint16_t(min.y + s.y / 2), uint16_t(min.z + s.z / 2) };
}
void dig(bool plan = false, bool channel = false);
bool include(df::coord t) const;
bool safe_include(df::coord t) const;
df::tile_dig_designation dig_mode(df::coord t) const;
bool is_dug(df::tiletype_shape_basic want = tiletype_shape_basic::None) const
{
std::ostringstream discard;
return is_dug(discard, want);
}
bool is_dug(std::ostream & reason, df::tiletype_shape_basic want = tiletype_shape_basic::None) const;
bool constructions_done() const
{
std::ostringstream discard;
return constructions_done(discard);
}
bool constructions_done(std::ostream & reason) const;
df::building *dfbuilding() const;
int32_t compute_value() const;
int32_t distance_to(const room *other) const;
bool low_grass() const;
};
struct furniture
{
layout_type::type type;
df::construction_type construction;
df::tile_dig_designation dig;
int32_t bld_id;
df::coord pos;
furniture *target;
std::set<int32_t> users;
size_t has_users;
bool ignore;
bool makeroom;
bool internal;
std::string comment;
furniture(const std::string & comment = "") :
type(layout_type::none),
construction(construction_type::NONE),
dig(tile_dig_designation::Default),
bld_id(-1),
pos(0, 0, 0),
target(nullptr),
users(),
has_users(0),
ignore(false),
makeroom(false),
internal(false),
comment(comment)
{
}
};