-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathBuildingConsts.cpp
More file actions
454 lines (448 loc) · 19.5 KB
/
Copy pathBuildingConsts.cpp
File metadata and controls
454 lines (448 loc) · 19.5 KB
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#include "BuildingConsts.h"
#include "mygettext/mygettext.h"
#include "gameData/MilitaryConsts.h"
#include "gameData/GameConsts.h"
#include "figures/nofFarmhand.h"
#include "figures/nofCatapultMan.h"
#include "figures/nofHunter.h"
#include "gameTypes/BuildingTypes.h"
#include <type_traits>
const helpers::EnumArray<const char*, BuildingType> BUILDING_NAMES = {
gettext_noop("Headquarters"),
gettext_noop("Barracks"),
gettext_noop("Guardhouse"),
gettext_noop("Skinner"),
gettext_noop("Watchtower"),
gettext_noop("Vineyard"),
gettext_noop("Winery"),
gettext_noop("Temple"),
gettext_noop("Tannery"),
gettext_noop("Fortress"),
gettext_noop("Granite mine"),
gettext_noop("Coal mine"),
gettext_noop("Iron mine"),
gettext_noop("Gold mine"),
gettext_noop("Lookout tower"),
gettext_noop("Leatherworks"),
gettext_noop("Catapult"),
gettext_noop("Woodcutter"),
gettext_noop("Fishery"),
gettext_noop("Quarry"),
gettext_noop("Forester"),
gettext_noop("Slaughterhouse"),
gettext_noop("Hunter"),
gettext_noop("Brewery"),
gettext_noop("Armory"),
gettext_noop("Metalworks"),
gettext_noop("Iron smelter"),
gettext_noop("Charburner"),
gettext_noop("Pig farm"),
gettext_noop("Storehouse"),
"",
gettext_noop("Mill"),
gettext_noop("Bakery"),
gettext_noop("Sawmill"),
gettext_noop("Mint"),
gettext_noop("Well"),
gettext_noop("Shipyard"),
gettext_noop("Farm"),
gettext_noop("Donkey breeding"),
gettext_noop("Harbor building"),
};
const helpers::EnumArray<const char*, BuildingType> BUILDING_HELP_STRINGS = {{
// Headquarters
gettext_noop("The headquarters represents the "
"center of your realm. The large "
"amount of storage space "
"available means a great many "
"things can be safely stored "
"here. You can release certain "
"merchandise from the "
"headquarters, as and when "
"required or stop its storage. To "
"do this, first choose the "
"corresponding icon followed by "
"the desired merchandise or job "
"symbol. On the third page, you "
"can adjust the number of reserve "
"soldiers who are responsible for "
"guarding the headquarters. There "
"are two values given: the first "
"value indicates the current "
"number of men, the second value "
"indicates the desired number. "),
// Barracks
gettext_noop("The barracks is a very small hut "
"which can be used by your "
"soldiers as quarters. Using the "
"gold coin button you can stop "
"the delivery of gold coins to "
"the soldiers stationed here. "
"However, without gold coins the "
"soldiers here can not train and "
"improve their skills."),
// Guardhouse
gettext_noop("The guardhouse is a comfortable "
"place for the military which is "
"also protected by solid stone "
"walls. Using the gold coin "
"button you can stop the delivery "
"of gold coins to the soldiers "
"stationed here. However, without "
"gold coins the soldiers here can "
"not train and improve their "
"skills."),
// Skinner building
gettext_noop("Skins are gathered from animal carcasses "
"by the skinner. They are sent to the tannery "
"for leather production. The skinner can also "
"be supplied with pigs for extra skins."),
// Watchtower
gettext_noop("The watchtower with its large "
"amount of space is best suited "
"for stationing a large number "
"of your troops. Using the gold coin "
"button you can stop the delivery "
"of gold coins to the soldiers "
"stationed here. However, without "
"gold coins the soldiers here can "
"not train and improve their "
"skills."),
// Vineyard building
gettext_noop("The winegrower plants and harvests "
"grapes in the surrounding fields. A "
"vineyard requires a steady supply of "
"sturdy logs for trellises and fresh "
"water to irrigate the fields. Ripe "
"grapes are sent to the winery to "
"be pressed into wine."),
// Winery building
gettext_noop("At the winery, grapes are stomped in "
"a vat to produce wine. The vintner's "
"wine is of high quality, worthy of "
"sacrifice at the temple."),
// Temple building
gettext_noop("The temple servant sacrifices wine and "
"food granting a blessing of gold, iron "
"ore, coal or granite. This allows your "
"iron founder and minter to continue "
"working when mines become exhausted. The "
"desired mineral can be selected by "
"toggling the output button."),
// Tannery building
gettext_noop("The tanner works animal skins to form leather. "
"Before tanning; the skins are cured, scraped and "
"stretched on wooden frames made from boards. "
"Leather is used to produce armor at the leatherworks."),
// Fortress
gettext_noop("The defensive capabilities and "
"size of the fortress are "
"unsurpassed. This stronghold "
"ensures that other valuable "
"buildings and commodities are "
"protected. Using the gold coin "
"button you can stop the delivery "
"of gold coins to the soldiers "
"stationed here. However, without "
"gold coins the soldiers here can "
"not train and improve their "
"skills."),
// Granite mine
gettext_noop("The quarrying of stone in a "
"granite mine guarantees the "
"supply of stone for buildings. "
"However, even a granite mine has "
"to feed its workers."),
// Coal mine
gettext_noop("The mining of coal supports the "
"metalworks and smithy. This hard "
"work requires an adequate supply "
"of food."),
// Iron mine
gettext_noop("Deep within the mountains, "
"miners dig for iron ore. They "
"will obviously need a lot of "
"food for the strenuous work."),
// Gold mine
gettext_noop("A gold mine allows you to "
"prospect for valuable gold "
"deposits. For this, it is "
"necessary to ensure that the "
"miners are provided with plenty "
"of food."),
// Lookout-tower
gettext_noop("From the lookout tower you can "
"see far into previously "
"unexplored lands."),
// Leatherworks building
gettext_noop("The leatherworker crafts armor from finely "
"tanned leather. The armor is then transported "
"to military buildings to bolster your soldiers "
"defense. "
"An armored soldier can withstand an additional hit "
"in battle and sometimes survives a catapult strike, "
"but the armor is lost once struck."),
// Catapult
gettext_noop("Thanks to its immense strength, "
"the catapults represents an "
"effective weapon against enemy "
"military buildings."),
// Woodcutter
gettext_noop("A woodcutter provides the "
"sawmill with logs. A forester is "
"able to replant the depleted "
"forest."),
// Fishery
gettext_noop("The fish man is responsible for "
"finding water rich in fish. His "
"fish feed a great many miners."),
// Quarry
gettext_noop("The stonemason works the stone "
"near his quarry into bricks. "
"These are needed mainly for "
"building houses and as "
"ammunition for catapults."),
// Forester
gettext_noop("Within his area, the forester "
"ensures the survival of the "
"forest. He plants all types of "
"trees."),
// Slaughterhouse
gettext_noop("The butcher processes the "
"livestock delivered into "
"nutritious ham on which you "
"miners are fed."),
// Hunter
gettext_noop("Meat the hunter acquires is used "
"to feed the miners."),
// Brewery
gettext_noop("The brewer produces fine beer "
"from grain and water. This drink "
"is needed to fill the soldiers "
"with courage."),
// Armory
gettext_noop("The armory produces swords and "
"strong shields. This equipment "
"is vital for your soldiers."),
// Metalworks
gettext_noop("The countless tools which your "
"workers need are made in the "
"metalworks. This requires boards "
"and iron."),
// Iron smelter
gettext_noop("Raw iron ore is smelted in the "
"iron smelters with the help of "
"coal. The processed iron is "
"then used to making weapons "
"(in the Armory) and tools "
"(in the metalworks)."),
// Charburner
gettext_noop("The charburner stacks up piles of "
"wood and straw which is then burned "
"to create charcoal. This can be used "
"just like the coal from the mine without "
"any loss in quality."),
// Pig farm
gettext_noop("Grain and water are needed for "
"rearing pigs. The meat thus "
"obtained can then be processed "
"by a butcher."),
// Storehouse
gettext_noop("The storehouse can help reduce "
"long transportation journeys and "
"is suited to the temporary "
"storage of merchandise and "
"inhabitants. You can release "
"certain merchandise from the "
"storehouse, as and when "
"required. Alternatively, the "
"storage function can be "
"disabled. To do this, first "
"choose the relevant icon "
"followed by the desired "
"merchandise or job symbol."),
// Nothing
"",
// Mill
gettext_noop("The grain is ground in the "
"windmill. The flour from the "
"windmill is later used at the "
"bakery to bake bread."),
// Bakery
gettext_noop("The flour produced at the "
"windmill can be combined with "
"water in the bakery to make "
"oven-fresh bread. It's your "
"miners' favorite!"),
// Sawmill
gettext_noop("The carpenter turns the "
"woodcutter's logs into "
"made-to-measure planks. These "
"form the basic for building "
"houses and ships."),
// Mint
gettext_noop("The mint is responsible for "
"producing valuable gold coins. "
"These precious objects are "
"produced using coal and gold."),
// Well
gettext_noop("A well supplies water to the "
"bakery, brewery, donkey breeder "
"and pig farm."),
// Shipyard
gettext_noop("It is possible to build small "
"rowing boats as well as huge "
"cargo ships in a shipyard. The "
"boards required for this are "
"skillfully worked by "
"shipwrights."),
// Farm
gettext_noop("The farmer plants and harvests "
"grain in the surrounding fields. "
"A windmill then processes the "
"harvested grain into flour or "
"can be used to feed the pigs."),
// Donkey breeder
gettext_noop("The pack donkeys bred here are "
"used to transport your "
"merchandise more efficiently. "
"They are reared on water and "
"grain."),
// Harbor building
gettext_noop("Ships can only be loaded and "
"unloaded in a harbor. "
"Expeditions can also be prepared "
"here. You can release certain "
"merchandise from the storehouse, "
"as and when required. "
"Alternatively, the storage "
"function can be disabled. To do "
"this, first choose the relevant "
"icon followed by the desired "
"merchandise or job symbol."),
}};
const helpers::MultiEnumArray<SmokeConst, Nation, BuildingType> BUILDING_SMOKE_CONSTS = []() {
std::remove_const_t<decltype(BUILDING_SMOKE_CONSTS)> result{};
auto& africans = result[Nation::Africans];
africans[BuildingType::Quarry] = SmokeConst(1, {3, -32});
africans[BuildingType::Armory] = SmokeConst(1, {-32, -23});
africans[BuildingType::Metalworks] = SmokeConst(4, {-26, -47});
africans[BuildingType::Ironsmelter] = SmokeConst(2, {-20, -37});
africans[BuildingType::Charburner] = SmokeConst(2, {-18, -52});
africans[BuildingType::Bakery] = SmokeConst(4, {27, -39});
africans[BuildingType::Mint] = SmokeConst(1, {17, -52});
africans[BuildingType::Skinner] = SmokeConst(3, {5, -45});
africans[BuildingType::Tannery] = SmokeConst(2, {24, -39});
auto& japanese = result[Nation::Japanese];
japanese[BuildingType::Armory] = SmokeConst(1, {-22, -43});
japanese[BuildingType::Charburner] = SmokeConst(2, {-32, -55});
japanese[BuildingType::Bakery] = SmokeConst(4, {-30, -39});
japanese[BuildingType::Mint] = SmokeConst(3, {18, -58});
auto& romans = result[Nation::Romans];
romans[BuildingType::Brewery] = SmokeConst(1, {-26, -45});
romans[BuildingType::Armory] = SmokeConst(2, {-36, -34});
romans[BuildingType::Ironsmelter] = SmokeConst(1, {-16, -34});
romans[BuildingType::Charburner] = SmokeConst(2, {-36, -38});
romans[BuildingType::Bakery] = SmokeConst(4, {-15, -26});
romans[BuildingType::Mint] = SmokeConst(4, {20, -50});
romans[BuildingType::Skinner] = SmokeConst(2, {6, -41});
romans[BuildingType::Tannery] = SmokeConst(3, {-23, -42});
auto& vikings = result[Nation::Vikings];
vikings[BuildingType::Woodcutter] = SmokeConst(1, {2, -36});
vikings[BuildingType::Fishery] = SmokeConst(1, {4, -36});
vikings[BuildingType::Quarry] = SmokeConst(1, {0, -34});
vikings[BuildingType::Forester] = SmokeConst(1, {-5, -29});
vikings[BuildingType::Slaughterhouse] = SmokeConst(1, {7, -41});
vikings[BuildingType::Hunter] = SmokeConst(1, {-6, -38});
vikings[BuildingType::Brewery] = SmokeConst(3, {5, -39});
vikings[BuildingType::Armory] = SmokeConst(3, {-23, -36});
vikings[BuildingType::Metalworks] = SmokeConst(1, {-9, -35});
vikings[BuildingType::Ironsmelter] = SmokeConst(2, {-2, -38});
vikings[BuildingType::Charburner] = SmokeConst(2, {-22, -55});
vikings[BuildingType::PigFarm] = SmokeConst(2, {-30, -37});
vikings[BuildingType::Bakery] = SmokeConst(4, {-21, -26});
vikings[BuildingType::Sawmill] = SmokeConst(1, {-11, -45});
vikings[BuildingType::Mint] = SmokeConst(1, {16, -38});
vikings[BuildingType::Farm] = SmokeConst(1, {-17, -48});
vikings[BuildingType::DonkeyBreeder] = SmokeConst(4, {-27, -40});
vikings[BuildingType::Vineyard] = SmokeConst(1, {18, -48});
vikings[BuildingType::Winery] = SmokeConst(1, {-14, -32});
vikings[BuildingType::Skinner] = SmokeConst(1, {-7, -39});
vikings[BuildingType::Tannery] = SmokeConst(3, {-12, -46});
vikings[BuildingType::LeatherWorks] = SmokeConst(2, {-15, -37});
auto& babylonians = result[Nation::Babylonians];
babylonians[BuildingType::Brewery] = SmokeConst(2, {-18, -43});
babylonians[BuildingType::Armory] = SmokeConst(1, {-22, -47});
babylonians[BuildingType::Ironsmelter] = SmokeConst(2, {-23, -36});
babylonians[BuildingType::Bakery] = SmokeConst(4, {-27, -32});
babylonians[BuildingType::Mint] = SmokeConst(3, {11, -58});
return result;
}();
const helpers::MultiEnumArray<DrawPoint, Nation, BuildingType> BUILDING_ARMOR_SIGN_CONSTS = []() {
std::remove_const_t<decltype(BUILDING_ARMOR_SIGN_CONSTS)> result{};
auto& africans = result[Nation::Africans];
africans[BuildingType::Barracks] = DrawPoint(11, -19);
africans[BuildingType::Guardhouse] = DrawPoint(8, -21);
africans[BuildingType::Watchtower] = DrawPoint(23, -38);
africans[BuildingType::Fortress] = DrawPoint(27, -42);
auto& japanese = result[Nation::Japanese];
japanese[BuildingType::Barracks] = DrawPoint(12, -18);
japanese[BuildingType::Guardhouse] = DrawPoint(13, -18);
japanese[BuildingType::Watchtower] = DrawPoint(25, -12);
japanese[BuildingType::Fortress] = DrawPoint(22, -19);
auto& romans = result[Nation::Romans];
romans[BuildingType::Barracks] = DrawPoint(15, -11);
romans[BuildingType::Guardhouse] = DrawPoint(14, -10);
romans[BuildingType::Watchtower] = DrawPoint(-19, 2);
romans[BuildingType::Fortress] = DrawPoint(20, -49);
auto& vikings = result[Nation::Vikings];
vikings[BuildingType::Barracks] = DrawPoint(14, -10);
vikings[BuildingType::Guardhouse] = DrawPoint(15, -7);
vikings[BuildingType::Watchtower] = DrawPoint(-7, -16);
vikings[BuildingType::Fortress] = DrawPoint(26, -13);
auto& babylonians = result[Nation::Babylonians];
babylonians[BuildingType::Barracks] = DrawPoint(5, -11);
babylonians[BuildingType::Guardhouse] = DrawPoint(19, -11);
babylonians[BuildingType::Watchtower] = DrawPoint(5, -28);
babylonians[BuildingType::Fortress] = DrawPoint(20, -34);
return result;
}();
unsigned GetBuildingRadius(BuildingType bld)
{
switch(bld)
{
// Military buildings (territory influence radius) — from MilitaryConsts.h
case BuildingType::Barracks: return MILITARY_RADIUS[0];
case BuildingType::Guardhouse: return MILITARY_RADIUS[1];
case BuildingType::Watchtower: return MILITARY_RADIUS[2];
case BuildingType::Fortress: return MILITARY_RADIUS[3];
// Headquarters
case BuildingType::Headquarters: return HQ_RADIUS;
// Harbor building
case BuildingType::HarborBuilding: return HARBOR_RADIUS;
// Lookout tower — scouting visibility range
case BuildingType::LookoutTower: return VISUALRANGE_LOOKOUTTOWER;
// Catapult attack range
case BuildingType::Catapult: return CATAPULT_MAX_TARGET_RANGE;
// Hunter searches for animals in a square of this half-side length
case BuildingType::Hunter: return HUNTER_SEARCH_HALFSIDE;
// Mines — miner stays inside and extracts from adjacent tiles
case BuildingType::GraniteMine:
case BuildingType::CoalMine:
case BuildingType::IronMine:
case BuildingType::GoldMine: return MINER_RADIUS;
// For farmhand-based buildings, delegate to nofFarmhand::GetWorkRadius via the BLD_WORK_DESC
// job mapping. This is the single source of truth for worker reach radii, including
// addon-adjustable ranges (woodcutter, forester, stonemason).
default:
{
const auto job = BLD_WORK_DESC[bld].job;
if(job)
return nofFarmhand::GetWorkRadius(*job);
return 0;
}
}
}