1 /***************************************************************************
2  *   Free Heroes of Might and Magic II: https://github.com/ihhub/fheroes2  *
3  *   Copyright (C) 2021                                                    *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20 
21 #include "castle_building_info.h"
22 #include "maps_fileinfo.h"
23 #include "race.h"
24 #include "translations.h"
25 
26 #include <cassert>
27 
28 namespace
29 {
getKnightBuildingArea(const building_t buildingId)30     fheroes2::Rect getKnightBuildingArea( const building_t buildingId )
31     {
32         switch ( buildingId ) {
33         case BUILD_THIEVESGUILD:
34             return { 0, 130, 53, 63 };
35         case BUILD_TAVERN:
36             return { 345, 114, 83, 62 };
37         case BUILD_SHIPYARD:
38             return { 531, 211, 108, 45 };
39         case BUILD_WELL:
40             return { 188, 214, 39, 42 };
41         case BUILD_STATUE:
42             return { 478, 193, 46, 63 };
43         case BUILD_MARKETPLACE:
44             return { 219, 138, 120, 30 };
45         case BUILD_WEL2:
46             return { 241, 102, 141, 24 };
47         case BUILD_MOAT:
48             return { 0, 146, 311, 30 };
49         case BUILD_SPEC:
50             return { 0, 78, 251, 22 };
51         case BUILD_CASTLE:
52             return { 0, 49, 286, 116 };
53         case BUILD_CAPTAIN:
54             return { 293, 107, 59, 35 };
55         case BUILD_MAGEGUILD1:
56             return { 397, 150, 84, 32 };
57         case BUILD_MAGEGUILD2:
58             return { 397, 128, 84, 54 };
59         case BUILD_MAGEGUILD3:
60             return { 397, 105, 84, 77 };
61         case BUILD_MAGEGUILD4:
62             return { 397, 85, 84, 97 };
63         case BUILD_MAGEGUILD5:
64             return { 397, 55, 84, 127 };
65         case BUILD_TENT:
66             return { 69, 108, 67, 55 };
67         case DWELLING_MONSTER1:
68             return { 192, 163, 69, 52 };
69         case DWELLING_MONSTER2:
70         case DWELLING_UPGRADE2:
71             return { 135, 149, 73, 32 };
72         case DWELLING_MONSTER3:
73         case DWELLING_UPGRADE3:
74             return { 240, 166, 91, 66 };
75         case DWELLING_MONSTER4:
76         case DWELLING_UPGRADE4:
77             return { 323, 174, 132, 73 };
78         case DWELLING_MONSTER5:
79         case DWELLING_UPGRADE5:
80             return { 0, 176, 152, 79 };
81         case DWELLING_MONSTER6:
82         case DWELLING_UPGRADE6:
83         case DWELLING_UPGRADE7:
84             return { 445, 50, 194, 157 };
85         case BUILD_LEFTTURRET:
86             return { 7, 33, 0, 0 };
87         case BUILD_RIGHTTURRET:
88             return { 134, 37, 0, 0 };
89         default:
90             break;
91         }
92 
93         // Did you add a new building but forgot to add its area?
94         assert( 0 );
95         return {};
96     }
97 
getBarbarianBuildingArea(const building_t buildingId)98     fheroes2::Rect getBarbarianBuildingArea( const building_t buildingId )
99     {
100         switch ( buildingId ) {
101         case BUILD_THIEVESGUILD:
102             return { 466, 94, 87, 47 };
103         case BUILD_TAVERN:
104             return { 0, 161, 136, 90 };
105         case BUILD_SHIPYARD:
106             return { 505, 199, 134, 56 };
107         case BUILD_WELL:
108             return { 268, 189, 50, 58 };
109         case BUILD_STATUE:
110             return { 463, 154, 38, 81 };
111         case BUILD_MARKETPLACE:
112             return { 217, 166, 67, 43 };
113         case BUILD_WEL2:
114             return { 240, 106, 73, 34 };
115         case BUILD_MOAT:
116             return { 115, 138, 182, 42 };
117         case BUILD_SPEC:
118             return { 210, 80, 197, 61 };
119         case BUILD_CASTLE:
120             return { 0, 0, 214, 175 };
121         case BUILD_CAPTAIN:
122             return { 206, 99, 46, 42 };
123         case BUILD_MAGEGUILD1:
124             return { 348, 118, 50, 25 };
125         case BUILD_MAGEGUILD2:
126             return { 348, 94, 50, 49 };
127         case BUILD_MAGEGUILD3:
128             return { 348, 72, 50, 72 };
129         case BUILD_MAGEGUILD4:
130             return { 348, 48, 50, 96 };
131         case BUILD_MAGEGUILD5:
132             return { 348, 20, 50, 124 };
133         case BUILD_TENT:
134             return { 44, 109, 87, 52 };
135         case DWELLING_MONSTER1:
136             return { 290, 138, 58, 45 };
137         case DWELLING_MONSTER2:
138         case DWELLING_UPGRADE2:
139             return { 145, 195, 76, 52 };
140         case DWELLING_MONSTER3:
141         case DWELLING_UPGRADE3:
142             return { 557, 48, 83, 83 };
143         case DWELLING_MONSTER4:
144         case DWELLING_UPGRADE4:
145             return { 496, 136, 138, 64 };
146         case DWELLING_MONSTER5:
147         case DWELLING_UPGRADE5:
148             return { 318, 174, 131, 54 };
149         case DWELLING_MONSTER6:
150         case DWELLING_UPGRADE6:
151         case DWELLING_UPGRADE7:
152             return { 407, 0, 113, 106 };
153         case BUILD_LEFTTURRET:
154             return { 5, 50, 0, 0 };
155         case BUILD_RIGHTTURRET:
156             return { 118, 45, 0, 0 };
157         default:
158             break;
159         }
160 
161         // Did you add a new building but forgot to add its area?
162         assert( 0 );
163         return {};
164     }
165 
getSorceressBuildingArea(const building_t buildingId)166     fheroes2::Rect getSorceressBuildingArea( const building_t buildingId )
167     {
168         switch ( buildingId ) {
169         case BUILD_THIEVESGUILD:
170             return { 423, 167, 87, 50 };
171         case BUILD_TAVERN:
172             return { 490, 141, 148, 91 };
173         case BUILD_SHIPYARD:
174             return { 0, 208, 178, 48 };
175         case BUILD_WELL:
176             return { 335, 205, 45, 29 };
177         case BUILD_STATUE:
178             return { 152, 163, 28, 65 };
179         case BUILD_MARKETPLACE:
180             return { 404, 122, 69, 45 };
181         case BUILD_WEL2:
182             return { 131, 185, 71, 53 };
183         case BUILD_MOAT:
184             return { 0, 171, 272, 23 };
185         case BUILD_SPEC:
186             return { 152, 0, 236, 84 };
187         case BUILD_CASTLE:
188             return { 0, 0, 201, 179 };
189         case BUILD_CAPTAIN:
190             return { 223, 122, 37, 52 };
191         case BUILD_MAGEGUILD1:
192             return { 280, 21, 60, 143 };
193         case BUILD_MAGEGUILD2:
194         case BUILD_MAGEGUILD3:
195         case BUILD_MAGEGUILD4:
196         case BUILD_MAGEGUILD5:
197             return { 280, 0, 60, 164 };
198         case BUILD_TENT:
199             return { 104, 130, 59, 42 };
200         case DWELLING_MONSTER1:
201             return { 472, 59, 111, 92 };
202         case DWELLING_MONSTER2:
203         case DWELLING_UPGRADE2:
204             return { 338, 146, 93, 61 };
205         case DWELLING_MONSTER3:
206         case DWELLING_UPGRADE3:
207             return { 51, 164, 106, 40 };
208         case DWELLING_MONSTER4:
209         case DWELLING_UPGRADE4:
210             return { 198, 178, 143, 71 };
211         case DWELLING_MONSTER5:
212         case DWELLING_UPGRADE5:
213             return { 263, 226, 296, 30 };
214         case DWELLING_MONSTER6:
215         case DWELLING_UPGRADE6:
216         case DWELLING_UPGRADE7:
217             return { 179, 0, 84, 119 };
218         case BUILD_LEFTTURRET:
219             return { 98, 99, 0, 0 };
220         case BUILD_RIGHTTURRET:
221             return { 151, 98, 0, 0 };
222         default:
223             break;
224         }
225 
226         // Did you add a new building but forgot to add its area?
227         assert( 0 );
228         return {};
229     }
230 
getWarlockBuildingArea(const building_t buildingId)231     fheroes2::Rect getWarlockBuildingArea( const building_t buildingId )
232     {
233         switch ( buildingId ) {
234         case BUILD_THIEVESGUILD:
235             return { 520, 103, 64, 54 };
236         case BUILD_TAVERN:
237             return { 476, 96, 82, 55 };
238         case BUILD_SHIPYARD:
239             return { 517, 200, 122, 56 };
240         case BUILD_WELL:
241             return { 342, 205, 67, 42 };
242         case BUILD_STATUE:
243             return { 478, 161, 37, 63 };
244         case BUILD_MARKETPLACE:
245             return { 386, 171, 71, 40 };
246         case BUILD_WEL2:
247             return { 60, 32, 63, 186 };
248         case BUILD_MOAT:
249             return { 211, 166, 301, 21 };
250         case BUILD_SPEC:
251             return { 0, 160, 59, 95 };
252         case BUILD_CASTLE:
253             return { 241, 18, 181, 150 };
254         case BUILD_CAPTAIN:
255             return { 418, 83, 53, 84 };
256         case BUILD_MAGEGUILD1:
257             return { 590, 135, 49, 35 };
258         case BUILD_MAGEGUILD2:
259             return { 590, 108, 49, 60 };
260         case BUILD_MAGEGUILD3:
261             return { 590, 77, 49, 90 };
262         case BUILD_MAGEGUILD4:
263             return { 590, 45, 49, 125 };
264         case BUILD_MAGEGUILD5:
265             return { 590, 14, 49, 155 };
266         case BUILD_TENT:
267             return { 298, 135, 72, 31 };
268         case DWELLING_MONSTER1:
269             return { 0, 64, 48, 50 };
270         case DWELLING_MONSTER2:
271         case DWELLING_UPGRADE2:
272             return { 237, 168, 78, 79 };
273         case DWELLING_MONSTER3:
274         case DWELLING_UPGRADE3:
275             return { 492, 50, 53, 39 };
276         case DWELLING_MONSTER4:
277         case DWELLING_UPGRADE4:
278             return { 139, 163, 190, 83 };
279         case DWELLING_MONSTER5:
280         case DWELLING_UPGRADE5:
281             return { 82, 92, 178, 68 };
282         case DWELLING_MONSTER6:
283         case DWELLING_UPGRADE6:
284         case DWELLING_UPGRADE7:
285             return { 92, 0, 64, 255 };
286         case BUILD_LEFTTURRET:
287             return { 311, 84, 0, 0 };
288         case BUILD_RIGHTTURRET:
289             return { 359, 83, 0, 0 };
290         default:
291             break;
292         }
293 
294         // Did you add a new building but forgot to add its area?
295         assert( 0 );
296         return {};
297     }
298 
getWizardBuildingArea(const building_t buildingId)299     fheroes2::Rect getWizardBuildingArea( const building_t buildingId )
300     {
301         switch ( buildingId ) {
302         case BUILD_THIEVESGUILD:
303             return { 505, 50, 51, 49 };
304         case BUILD_TAVERN:
305             return { 0, 149, 118, 76 };
306         case BUILD_SHIPYARD:
307             return { 0, 206, 206, 49 };
308         case BUILD_WELL:
309             return { 249, 139, 28, 33 };
310         case BUILD_STATUE:
311             return { 464, 45, 24, 72 };
312         case BUILD_MARKETPLACE:
313             return { 255, 163, 108, 53 };
314         case BUILD_WEL2:
315             return { 237, 208, 137, 39 };
316         case BUILD_MOAT:
317             return { 0, 90, 223, 14 };
318         case BUILD_SPEC:
319             return { 297, 95, 109, 78 };
320         case BUILD_CASTLE:
321             return { 0, 0, 200, 99 };
322         case BUILD_CAPTAIN:
323             return { 210, 52, 28, 35 };
324         case BUILD_MAGEGUILD1:
325             return { 585, 73, 54, 48 };
326         case BUILD_MAGEGUILD2:
327             return { 585, 69, 54, 50 };
328         case BUILD_MAGEGUILD3:
329             return { 585, 44, 54, 78 };
330         case BUILD_MAGEGUILD4:
331             return { 585, 20, 54, 102 };
332         case BUILD_MAGEGUILD5:
333             return { 585, 0, 54, 122 };
334         case BUILD_TENT:
335             return { 58, 60, 49, 42 };
336         case DWELLING_MONSTER1:
337             return { 467, 181, 38, 30 };
338         case DWELLING_MONSTER2:
339         case DWELLING_UPGRADE2:
340             return { 231, 68, 192, 36 };
341         case DWELLING_MONSTER3:
342         case DWELLING_UPGRADE3:
343             return { 152, 130, 96, 60 };
344         case DWELLING_MONSTER4:
345         case DWELLING_UPGRADE4:
346             return { 593, 184, 46, 31 };
347         case DWELLING_MONSTER5:
348         case DWELLING_UPGRADE5:
349             return { 411, 0, 49, 167 };
350         case DWELLING_MONSTER6:
351         case DWELLING_UPGRADE6:
352         case DWELLING_UPGRADE7:
353             return { 160, 0, 178, 67 };
354         case BUILD_LEFTTURRET:
355             return { 30, 17, 0, 0 };
356         case BUILD_RIGHTTURRET:
357             return { 127, 17, 0, 0 };
358         default:
359             break;
360         }
361 
362         // Did you add a new building but forgot to add its area?
363         assert( 0 );
364         return {};
365     }
366 
getNecromancerBuildingArea(const building_t buildingId)367     fheroes2::Rect getNecromancerBuildingArea( const building_t buildingId )
368     {
369         switch ( buildingId ) {
370         case BUILD_THIEVESGUILD:
371             return { 275, 124, 62, 77 };
372         case BUILD_SHRINE:
373             return { 455, 39, 51, 103 };
374         case BUILD_SHIPYARD:
375             return { 500, 220, 139, 36 };
376         case BUILD_WELL:
377             return { 215, 213, 29, 39 };
378         case BUILD_STATUE:
379             return { 365, 154, 41, 93 };
380         case BUILD_MARKETPLACE:
381             return { 412, 193, 98, 61 };
382         case BUILD_WEL2:
383             return { 263, 181, 90, 65 };
384         case BUILD_MOAT:
385             return { 258, 171, 193, 19 };
386         case BUILD_SPEC:
387             return { 0, 0, 640, 63 };
388         case BUILD_CASTLE:
389             return { 289, 10, 134, 164 };
390         case BUILD_CAPTAIN:
391             return { 441, 77, 22, 99 };
392         case BUILD_MAGEGUILD1:
393             return { 565, 131, 73, 74 };
394         case BUILD_MAGEGUILD2:
395             return { 568, 102, 62, 104 };
396         case BUILD_MAGEGUILD3:
397             return { 570, 79, 56, 130 };
398         case BUILD_MAGEGUILD4:
399             return { 570, 61, 60, 146 };
400         case BUILD_MAGEGUILD5:
401             return { 570, 45, 61, 162 };
402         case BUILD_TENT:
403             return { 333, 115, 47, 70 };
404         case DWELLING_MONSTER1:
405             return { 396, 177, 71, 35 };
406         case DWELLING_MONSTER2:
407         case DWELLING_UPGRADE2:
408             return { 110, 174, 141, 45 };
409         case DWELLING_MONSTER3:
410         case DWELLING_UPGRADE3:
411             return { 0, 28, 241, 142 };
412         case DWELLING_MONSTER4:
413         case DWELLING_UPGRADE4:
414             return { 0, 107, 140, 129 };
415         case DWELLING_MONSTER5:
416         case DWELLING_UPGRADE5:
417             return { 221, 127, 66, 84 };
418         case DWELLING_MONSTER6:
419         case DWELLING_UPGRADE6:
420         case DWELLING_UPGRADE7:
421             return { 464, 72, 105, 124 };
422         case BUILD_LEFTTURRET:
423             return { 330, 47, 0, 0 };
424         case BUILD_RIGHTTURRET:
425             return { 360, 46, 0, 0 };
426         default:
427             break;
428         }
429 
430         // Did you add a new building but forgot to add its area?
431         assert( 0 );
432         return {};
433     }
434 
getKnightBuildingName(const building_t buildingId)435     const char * getKnightBuildingName( const building_t buildingId )
436     {
437         switch ( buildingId ) {
438         case BUILD_SPEC:
439             return _( "Fortifications" );
440         case BUILD_WEL2:
441             return _( "Farm" );
442         case DWELLING_MONSTER1:
443             return _( "Thatched Hut" );
444         case DWELLING_MONSTER2:
445             return _( "Archery Range" );
446         case DWELLING_UPGRADE2:
447             return _( "Upg. Archery Range" );
448         case DWELLING_MONSTER3:
449             return _( "Blacksmith" );
450         case DWELLING_UPGRADE3:
451             return _( "Upg. Blacksmith" );
452         case DWELLING_MONSTER4:
453             return _( "Armory" );
454         case DWELLING_UPGRADE4:
455             return _( "Upg. Armory" );
456         case DWELLING_MONSTER5:
457             return _( "Jousting Arena" );
458         case DWELLING_UPGRADE5:
459             return _( "Upg. Jousting Arena" );
460         case DWELLING_MONSTER6:
461             return _( "Cathedral" );
462         case DWELLING_UPGRADE6:
463             return _( "Upg. Cathedral" );
464         default:
465             break;
466         }
467 
468         // Did you add a new building?
469         assert( 0 );
470         return nullptr;
471     }
472 
getBarbarianBuildingName(const building_t buildingId)473     const char * getBarbarianBuildingName( const building_t buildingId )
474     {
475         switch ( buildingId ) {
476         case BUILD_SPEC:
477             return _( "Coliseum" );
478         case BUILD_WEL2:
479             return _( "Garbage Heap" );
480         case DWELLING_MONSTER1:
481             return _( "Hut" );
482         case DWELLING_MONSTER2:
483             return _( "Stick Hut" );
484         case DWELLING_UPGRADE2:
485             return _( "Upg. Stick Hut" );
486         case DWELLING_MONSTER3:
487             return _( "Den" );
488         case DWELLING_MONSTER4:
489             return _( "Adobe" );
490         case DWELLING_UPGRADE4:
491             return _( "Upg. Adobe" );
492         case DWELLING_MONSTER5:
493             return _( "Bridge" );
494         case DWELLING_UPGRADE5:
495             return _( "Upg. Bridge" );
496         case DWELLING_MONSTER6:
497             return _( "Pyramid" );
498         default:
499             break;
500         }
501 
502         // Did you add a new building?
503         assert( 0 );
504         return nullptr;
505     }
506 
getSorceressBuildingName(const building_t buildingId)507     const char * getSorceressBuildingName( const building_t buildingId )
508     {
509         switch ( buildingId ) {
510         case BUILD_SPEC:
511             return _( "Rainbow" );
512         case BUILD_WEL2:
513             return _( "Crystal Garden" );
514         case DWELLING_MONSTER1:
515             return _( "Treehouse" );
516         case DWELLING_MONSTER2:
517             return _( "Cottage" );
518         case DWELLING_UPGRADE2:
519             return _( "Upg. Cottage" );
520         case DWELLING_MONSTER3:
521             return _( "Archery Range" );
522         case DWELLING_UPGRADE3:
523             return _( "Upg. Archery Range" );
524         case DWELLING_MONSTER4:
525             return _( "Stonehenge" );
526         case DWELLING_UPGRADE4:
527             return _( "Upg. Stonehenge" );
528         case DWELLING_MONSTER5:
529             return _( "Fenced Meadow" );
530         case DWELLING_MONSTER6:
531             return _( "Red Tower" );
532         default:
533             break;
534         }
535 
536         // Did you add a new building?
537         assert( 0 );
538         return nullptr;
539     }
540 
getWarlockBuildingName(const building_t buildingId)541     const char * getWarlockBuildingName( const building_t buildingId )
542     {
543         switch ( buildingId ) {
544         case BUILD_SPEC:
545             return _( "Dungeon" );
546         case BUILD_WEL2:
547             return _( "Waterfall" );
548         case DWELLING_MONSTER1:
549             return _( "Cave" );
550         case DWELLING_MONSTER2:
551             return _( "Crypt" );
552         case DWELLING_MONSTER3:
553             return _( "Nest" );
554         case DWELLING_MONSTER4:
555             return _( "Maze" );
556         case DWELLING_UPGRADE4:
557             return _( "Upg. Maze" );
558         case DWELLING_MONSTER5:
559             return _( "Swamp" );
560         case DWELLING_MONSTER6:
561             return _( "Green Tower" );
562         case DWELLING_UPGRADE6:
563             return _( "Red Tower" );
564         case DWELLING_UPGRADE7:
565             return _( "Black Tower" );
566         default:
567             break;
568         }
569 
570         // Did you add a new building?
571         assert( 0 );
572         return nullptr;
573     }
574 
getWizardBuildingName(const building_t buildingId)575     const char * getWizardBuildingName( const building_t buildingId )
576     {
577         switch ( buildingId ) {
578         case BUILD_SPEC:
579             return _( "Library" );
580         case BUILD_WEL2:
581             return _( "Orchard" );
582         case DWELLING_MONSTER1:
583             return _( "Habitat" );
584         case DWELLING_MONSTER2:
585             return _( "Pen" );
586         case DWELLING_MONSTER3:
587             return _( "Foundry" );
588         case DWELLING_UPGRADE3:
589             return _( "Upg. Foundry" );
590         case DWELLING_MONSTER4:
591             return _( "Cliff Nest" );
592         case DWELLING_MONSTER5:
593             return _( "Ivory Tower" );
594         case DWELLING_UPGRADE5:
595             return _( "Upg. Ivory Tower" );
596         case DWELLING_MONSTER6:
597             return _( "Cloud Castle" );
598         case DWELLING_UPGRADE6:
599             return _( "Upg. Cloud Castle" );
600         default:
601             break;
602         }
603 
604         // Did you add a new building?
605         assert( 0 );
606         return nullptr;
607     }
608 
getNecromancerBuildingName(const building_t buildingId)609     const char * getNecromancerBuildingName( const building_t buildingId )
610     {
611         switch ( buildingId ) {
612         case BUILD_SPEC:
613             return _( "Storm" );
614         case BUILD_WEL2:
615             return _( "Skull Pile" );
616         case DWELLING_MONSTER1:
617             return _( "Excavation" );
618         case DWELLING_MONSTER2:
619             return _( "Graveyard" );
620         case DWELLING_UPGRADE2:
621             return _( "Upg. Graveyard" );
622         case DWELLING_MONSTER3:
623             return _( "Pyramid" );
624         case DWELLING_UPGRADE3:
625             return _( "Upg. Pyramid" );
626         case DWELLING_MONSTER4:
627             return _( "Mansion" );
628         case DWELLING_UPGRADE4:
629             return _( "Upg. Mansion" );
630         case DWELLING_MONSTER5:
631             return _( "Mausoleum" );
632         case DWELLING_UPGRADE5:
633             return _( "Upg. Mausoleum" );
634         case DWELLING_MONSTER6:
635             return _( "Laboratory" );
636         case BUILD_SHRINE:
637             return _( "Shrine" );
638         default:
639             break;
640         }
641 
642         // Did you add a new building?
643         assert( 0 );
644         return nullptr;
645     }
646 
getKnightBuildingDescription(const building_t buildingId)647     const char * getKnightBuildingDescription( const building_t buildingId )
648     {
649         switch ( buildingId ) {
650         case BUILD_SPEC:
651             return _( "The Fortifications increase the toughness of the walls, increasing the number of turns it takes to knock them down." );
652         case BUILD_WEL2:
653             return _( "The Farm increases production of Peasants by %{count} per week." );
654         default:
655             break;
656         }
657 
658         // Did you add a new building?
659         assert( 0 );
660         return nullptr;
661     }
662 
getBarbarianBuildingDescription(const building_t buildingId)663     const char * getBarbarianBuildingDescription( const building_t buildingId )
664     {
665         switch ( buildingId ) {
666         case BUILD_SPEC:
667             return _( "The Coliseum provides inspiring spectacles to defending troops, raising their morale by two during combat." );
668         case BUILD_WEL2:
669             return _( "The Garbage Heap increases production of Goblins by %{count} per week." );
670         default:
671             break;
672         }
673 
674         // Did you add a new building?
675         assert( 0 );
676         return nullptr;
677     }
678 
getSorceressBuildingDescription(const building_t buildingId)679     const char * getSorceressBuildingDescription( const building_t buildingId )
680     {
681         switch ( buildingId ) {
682         case BUILD_SPEC:
683             return _( "The Rainbow increases the luck of the defending units by two." );
684         case BUILD_WEL2:
685             return _( "The Crystal Garden increases production of Sprites by %{count} per week." );
686         default:
687             break;
688         }
689 
690         // Did you add a new building?
691         assert( 0 );
692         return nullptr;
693     }
694 
getWarlockBuildingDescription(const building_t buildingId)695     const char * getWarlockBuildingDescription( const building_t buildingId )
696     {
697         switch ( buildingId ) {
698         case BUILD_SPEC:
699             return _( "The Dungeon increases the income of the town by %{count} / day." );
700         case BUILD_WEL2:
701             return _( "The Waterfall increases production of Centaurs by %{count} per week." );
702         default:
703             break;
704         }
705 
706         // Did you add a new building?
707         assert( 0 );
708         return nullptr;
709     }
710 
getWizardBuildingDescription(const building_t buildingId)711     const char * getWizardBuildingDescription( const building_t buildingId )
712     {
713         switch ( buildingId ) {
714         case BUILD_SPEC:
715             return _( "The Library increases the number of spells in the Guild by one for each level of the guild." );
716         case BUILD_WEL2:
717             return _( "The Orchard increases production of Halflings by %{count} per week." );
718         default:
719             break;
720         }
721 
722         // Did you add a new building?
723         assert( 0 );
724         return nullptr;
725     }
726 
getNecromancerBuildingDescription(const building_t buildingId)727     const char * getNecromancerBuildingDescription( const building_t buildingId )
728     {
729         switch ( buildingId ) {
730         case BUILD_SPEC:
731             return _( "The Storm adds +2 to the power of spells of a defending spell caster." );
732         case BUILD_WEL2:
733             return _( "The Skull Pile increases production of Skeletons by %{count} per week." );
734         default:
735             break;
736         }
737 
738         // Did you add a new building?
739         assert( 0 );
740         return nullptr;
741     }
742 }
743 
744 namespace fheroes2
745 {
getCastleBuildingArea(const int race,const building_t buildingId)746     Rect getCastleBuildingArea( const int race, const building_t buildingId )
747     {
748         if ( buildingId == BUILD_NOTHING ) {
749             // Special case which we should ignore.
750             return {};
751         }
752 
753         switch ( race ) {
754         case Race::KNGT:
755             return getKnightBuildingArea( buildingId );
756         case Race::BARB:
757             return getBarbarianBuildingArea( buildingId );
758         case Race::SORC:
759             return getSorceressBuildingArea( buildingId );
760         case Race::WRLK:
761             return getWarlockBuildingArea( buildingId );
762         case Race::WZRD:
763             return getWizardBuildingArea( buildingId );
764         case Race::NECR:
765             return getNecromancerBuildingArea( buildingId );
766         default:
767             break;
768         }
769 
770         // Did you add a new castle?
771         assert( 0 );
772 
773         return {};
774     }
775 
getBuildingName(const int race,const building_t buildingId)776     const char * getBuildingName( const int race, const building_t buildingId )
777     {
778         if ( buildingId == BUILD_NOTHING ) {
779             // Special case which we should ignore.
780             return "";
781         }
782 
783         // Check common buildings as they have the same name.
784         switch ( buildingId ) {
785         case BUILD_THIEVESGUILD:
786             return _( "Thieves' Guild" );
787         case BUILD_TAVERN:
788             return _( "Tavern" );
789         case BUILD_SHIPYARD:
790             return _( "Shipyard" );
791         case BUILD_WELL:
792             return _( "Well" );
793         case BUILD_STATUE:
794             return _( "Statue" );
795         case BUILD_LEFTTURRET:
796             return _( "Left Turret" );
797         case BUILD_RIGHTTURRET:
798             return _( "Right Turret" );
799         case BUILD_MARKETPLACE:
800             return _( "Marketplace" );
801         case BUILD_MOAT:
802             return _( "Moat" );
803         case BUILD_CASTLE:
804             return _( "Castle" );
805         case BUILD_TENT:
806             return _( "Tent" );
807         case BUILD_CAPTAIN:
808             return _( "Captain's Quarters" );
809         case BUILD_MAGEGUILD1:
810             return _( "Mage Guild, Level 1" );
811         case BUILD_MAGEGUILD2:
812             return _( "Mage Guild, Level 2" );
813         case BUILD_MAGEGUILD3:
814             return _( "Mage Guild, Level 3" );
815         case BUILD_MAGEGUILD4:
816             return _( "Mage Guild, Level 4" );
817         case BUILD_MAGEGUILD5:
818             return _( "Mage Guild, Level 5" );
819         default:
820             break;
821         }
822 
823         switch ( race ) {
824         case Race::KNGT:
825             return getKnightBuildingName( buildingId );
826         case Race::BARB:
827             return getBarbarianBuildingName( buildingId );
828         case Race::SORC:
829             return getSorceressBuildingName( buildingId );
830         case Race::WRLK:
831             return getWarlockBuildingName( buildingId );
832         case Race::WZRD:
833             return getWizardBuildingName( buildingId );
834         case Race::NECR:
835             return getNecromancerBuildingName( buildingId );
836         default:
837             break;
838         }
839 
840         // Did you add a new castle?
841         assert( 0 );
842 
843         return nullptr;
844     }
845 
getBuildingDescription(const int race,const building_t buildingId)846     const char * getBuildingDescription( const int race, const building_t buildingId )
847     {
848         if ( buildingId == BUILD_NOTHING ) {
849             // Special case which we should ignore.
850             return "";
851         }
852 
853         switch ( buildingId ) {
854         case BUILD_SHRINE:
855             return _( "The Shrine increases the necromancy skill of all your necromancers by 10 percent." );
856         case BUILD_THIEVESGUILD:
857             return _(
858                 "The Thieves' Guild provides information on enemy players. Thieves' Guilds can also provide scouting information on enemy towns. Additional Guilds provide more information." );
859         case BUILD_TAVERN:
860             return _( "The Tavern increases morale for troops defending the castle." );
861         case BUILD_SHIPYARD:
862             return _( "The Shipyard allows ships to be built." );
863         case BUILD_WELL:
864             return _( "The Well increases the growth rate of all dwellings by %{count} creatures per week." );
865         case BUILD_STATUE:
866             return _( "The Statue increases your town's income by %{count} per day." );
867         case BUILD_LEFTTURRET:
868             return _( "The Left Turret provides extra firepower during castle combat." );
869         case BUILD_RIGHTTURRET:
870             return _( "The Right Turret provides extra firepower during castle combat." );
871         case BUILD_MARKETPLACE:
872             return _( "The Marketplace can be used to convert one type of resource into another. The more marketplaces you control, the better the exchange rate." );
873         case BUILD_MOAT:
874             return _( "The Moat slows attacking units. Any unit entering the moat must end its turn there and becomes more vulnerable to attack." );
875         case BUILD_CASTLE:
876             return _( "The Castle improves town defense and increases income to %{count} gold per day." );
877         case BUILD_TENT:
878             return _( "The Tent provides workers to build a castle, provided the materials and the gold are available." );
879         case BUILD_CAPTAIN:
880             return _( "The Captain's Quarters provides a captain to assist in the castle's defense when no hero is present." );
881         case BUILD_MAGEGUILD1:
882         case BUILD_MAGEGUILD2:
883         case BUILD_MAGEGUILD3:
884         case BUILD_MAGEGUILD4:
885         case BUILD_MAGEGUILD5:
886             return _( "The Mage Guild allows heroes to learn spells and replenish their spell points." );
887         default:
888             break;
889         }
890 
891         switch ( race ) {
892         case Race::KNGT:
893             return getKnightBuildingDescription( buildingId );
894         case Race::BARB:
895             return getBarbarianBuildingDescription( buildingId );
896         case Race::SORC:
897             return getSorceressBuildingDescription( buildingId );
898         case Race::WRLK:
899             return getWarlockBuildingDescription( buildingId );
900         case Race::WZRD:
901             return getWizardBuildingDescription( buildingId );
902         case Race::NECR:
903             return getNecromancerBuildingDescription( buildingId );
904         default:
905             break;
906         }
907 
908         // Did you add a new castle?
909         assert( 0 );
910 
911         return nullptr;
912     }
913 
getBuildingDrawingPriorities(const int race,const GameVersion version)914     std::vector<building_t> getBuildingDrawingPriorities( const int race, const GameVersion version )
915     {
916         std::vector<building_t> priorities;
917         priorities.reserve( 32 );
918 
919         switch ( race ) {
920         case Race::KNGT:
921             priorities.emplace_back( BUILD_TENT );
922             priorities.emplace_back( BUILD_WEL2 );
923             priorities.emplace_back( BUILD_CASTLE );
924             priorities.emplace_back( BUILD_SPEC );
925             priorities.emplace_back( BUILD_CAPTAIN );
926             priorities.emplace_back( BUILD_LEFTTURRET );
927             priorities.emplace_back( BUILD_RIGHTTURRET );
928             priorities.emplace_back( BUILD_MOAT );
929             priorities.emplace_back( BUILD_MARKETPLACE );
930             priorities.emplace_back( DWELLING_MONSTER2 );
931             priorities.emplace_back( DWELLING_UPGRADE2 );
932             priorities.emplace_back( BUILD_THIEVESGUILD );
933             priorities.emplace_back( BUILD_TAVERN );
934             priorities.emplace_back( BUILD_MAGEGUILD1 );
935             priorities.emplace_back( BUILD_MAGEGUILD2 );
936             priorities.emplace_back( BUILD_MAGEGUILD3 );
937             priorities.emplace_back( BUILD_MAGEGUILD4 );
938             priorities.emplace_back( BUILD_MAGEGUILD5 );
939             priorities.emplace_back( DWELLING_MONSTER5 );
940             priorities.emplace_back( DWELLING_UPGRADE5 );
941             priorities.emplace_back( DWELLING_MONSTER6 );
942             priorities.emplace_back( DWELLING_UPGRADE6 );
943             priorities.emplace_back( DWELLING_MONSTER1 );
944             priorities.emplace_back( DWELLING_MONSTER3 );
945             priorities.emplace_back( DWELLING_UPGRADE3 );
946             priorities.emplace_back( DWELLING_MONSTER4 );
947             priorities.emplace_back( DWELLING_UPGRADE4 );
948             priorities.emplace_back( BUILD_WELL );
949             priorities.emplace_back( BUILD_SHIPYARD );
950             priorities.emplace_back( BUILD_STATUE );
951             break;
952         case Race::BARB:
953             priorities.emplace_back( BUILD_SPEC );
954             priorities.emplace_back( BUILD_WEL2 );
955             priorities.emplace_back( DWELLING_MONSTER6 );
956             priorities.emplace_back( BUILD_MAGEGUILD1 );
957             priorities.emplace_back( BUILD_MAGEGUILD2 );
958             priorities.emplace_back( BUILD_MAGEGUILD3 );
959             priorities.emplace_back( BUILD_MAGEGUILD4 );
960             priorities.emplace_back( BUILD_MAGEGUILD5 );
961             priorities.emplace_back( BUILD_CAPTAIN );
962             priorities.emplace_back( BUILD_TENT );
963             priorities.emplace_back( BUILD_CASTLE );
964             priorities.emplace_back( BUILD_LEFTTURRET );
965             priorities.emplace_back( BUILD_RIGHTTURRET );
966             priorities.emplace_back( BUILD_MOAT );
967             priorities.emplace_back( DWELLING_MONSTER3 );
968             priorities.emplace_back( BUILD_THIEVESGUILD );
969             priorities.emplace_back( DWELLING_MONSTER1 );
970             priorities.emplace_back( BUILD_MARKETPLACE );
971             priorities.emplace_back( DWELLING_MONSTER2 );
972             priorities.emplace_back( DWELLING_UPGRADE2 );
973             priorities.emplace_back( BUILD_TAVERN );
974             priorities.emplace_back( DWELLING_MONSTER4 );
975             priorities.emplace_back( DWELLING_UPGRADE4 );
976             priorities.emplace_back( DWELLING_MONSTER5 );
977             priorities.emplace_back( DWELLING_UPGRADE5 );
978             priorities.emplace_back( BUILD_WELL );
979             priorities.emplace_back( BUILD_STATUE );
980             priorities.emplace_back( BUILD_SHIPYARD );
981             break;
982         case Race::SORC:
983             priorities.emplace_back( BUILD_SPEC );
984             priorities.emplace_back( DWELLING_MONSTER6 );
985             priorities.emplace_back( BUILD_MAGEGUILD1 );
986             priorities.emplace_back( BUILD_MAGEGUILD2 );
987             priorities.emplace_back( BUILD_MAGEGUILD3 );
988             priorities.emplace_back( BUILD_MAGEGUILD4 );
989             priorities.emplace_back( BUILD_MAGEGUILD5 );
990             priorities.emplace_back( BUILD_CAPTAIN );
991             priorities.emplace_back( BUILD_TENT );
992             priorities.emplace_back( BUILD_CASTLE );
993             priorities.emplace_back( BUILD_LEFTTURRET );
994             priorities.emplace_back( BUILD_RIGHTTURRET );
995             priorities.emplace_back( BUILD_MOAT );
996             priorities.emplace_back( DWELLING_MONSTER3 );
997             priorities.emplace_back( DWELLING_UPGRADE3 );
998             priorities.emplace_back( BUILD_SHIPYARD );
999             priorities.emplace_back( BUILD_MARKETPLACE );
1000             priorities.emplace_back( DWELLING_MONSTER2 );
1001             priorities.emplace_back( DWELLING_UPGRADE2 );
1002             priorities.emplace_back( BUILD_THIEVESGUILD );
1003             priorities.emplace_back( DWELLING_MONSTER1 );
1004             priorities.emplace_back( BUILD_TAVERN );
1005             priorities.emplace_back( BUILD_STATUE );
1006             priorities.emplace_back( BUILD_WEL2 );
1007             priorities.emplace_back( DWELLING_MONSTER4 );
1008             priorities.emplace_back( DWELLING_UPGRADE4 );
1009             priorities.emplace_back( BUILD_WELL );
1010             priorities.emplace_back( DWELLING_MONSTER5 );
1011             break;
1012         case Race::WRLK:
1013             priorities.emplace_back( DWELLING_MONSTER5 );
1014             priorities.emplace_back( DWELLING_MONSTER3 );
1015             priorities.emplace_back( BUILD_TENT );
1016             priorities.emplace_back( BUILD_CASTLE );
1017             priorities.emplace_back( BUILD_LEFTTURRET );
1018             priorities.emplace_back( BUILD_RIGHTTURRET );
1019             priorities.emplace_back( BUILD_MOAT );
1020             priorities.emplace_back( BUILD_CAPTAIN );
1021             priorities.emplace_back( BUILD_SHIPYARD );
1022             priorities.emplace_back( BUILD_MAGEGUILD1 );
1023             priorities.emplace_back( BUILD_MAGEGUILD2 );
1024             priorities.emplace_back( BUILD_MAGEGUILD3 );
1025             priorities.emplace_back( BUILD_MAGEGUILD4 );
1026             priorities.emplace_back( BUILD_MAGEGUILD5 );
1027             priorities.emplace_back( BUILD_TAVERN );
1028             priorities.emplace_back( BUILD_THIEVESGUILD );
1029             priorities.emplace_back( BUILD_MARKETPLACE );
1030             priorities.emplace_back( BUILD_STATUE );
1031             priorities.emplace_back( DWELLING_MONSTER1 );
1032             priorities.emplace_back( BUILD_WEL2 );
1033             priorities.emplace_back( BUILD_SPEC );
1034             priorities.emplace_back( DWELLING_MONSTER4 );
1035             priorities.emplace_back( DWELLING_UPGRADE4 );
1036             priorities.emplace_back( DWELLING_MONSTER2 );
1037             priorities.emplace_back( DWELLING_MONSTER6 );
1038             priorities.emplace_back( DWELLING_UPGRADE6 );
1039             priorities.emplace_back( DWELLING_UPGRADE7 );
1040             priorities.emplace_back( BUILD_WELL );
1041             break;
1042         case Race::WZRD:
1043             priorities.emplace_back( DWELLING_MONSTER6 );
1044             priorities.emplace_back( DWELLING_UPGRADE6 );
1045             priorities.emplace_back( BUILD_TENT );
1046             priorities.emplace_back( BUILD_CASTLE );
1047             priorities.emplace_back( BUILD_LEFTTURRET );
1048             priorities.emplace_back( BUILD_RIGHTTURRET );
1049             priorities.emplace_back( BUILD_MOAT );
1050             priorities.emplace_back( BUILD_CAPTAIN );
1051             priorities.emplace_back( DWELLING_MONSTER2 );
1052             priorities.emplace_back( BUILD_THIEVESGUILD );
1053             priorities.emplace_back( BUILD_TAVERN );
1054             priorities.emplace_back( BUILD_SHIPYARD );
1055             priorities.emplace_back( BUILD_WELL );
1056             priorities.emplace_back( DWELLING_MONSTER3 );
1057             priorities.emplace_back( DWELLING_UPGRADE3 );
1058             priorities.emplace_back( DWELLING_MONSTER5 );
1059             priorities.emplace_back( DWELLING_UPGRADE5 );
1060             priorities.emplace_back( BUILD_MAGEGUILD1 );
1061             priorities.emplace_back( BUILD_MAGEGUILD2 );
1062             priorities.emplace_back( BUILD_MAGEGUILD3 );
1063             priorities.emplace_back( BUILD_MAGEGUILD4 );
1064             priorities.emplace_back( BUILD_MAGEGUILD5 );
1065             priorities.emplace_back( BUILD_SPEC );
1066             priorities.emplace_back( BUILD_STATUE );
1067             priorities.emplace_back( DWELLING_MONSTER1 );
1068             priorities.emplace_back( DWELLING_MONSTER4 );
1069             priorities.emplace_back( BUILD_MARKETPLACE );
1070             priorities.emplace_back( BUILD_WEL2 );
1071             break;
1072         case Race::NECR:
1073             priorities.emplace_back( BUILD_SPEC );
1074             if ( version == GameVersion::PRICE_OF_LOYALTY ) {
1075                 priorities.emplace_back( BUILD_SHRINE );
1076             }
1077             priorities.emplace_back( BUILD_TENT );
1078             priorities.emplace_back( BUILD_CASTLE );
1079             priorities.emplace_back( BUILD_LEFTTURRET );
1080             priorities.emplace_back( BUILD_RIGHTTURRET );
1081             priorities.emplace_back( BUILD_MOAT );
1082             priorities.emplace_back( BUILD_CAPTAIN );
1083             priorities.emplace_back( DWELLING_MONSTER6 );
1084             priorities.emplace_back( DWELLING_MONSTER1 );
1085             priorities.emplace_back( BUILD_THIEVESGUILD );
1086             priorities.emplace_back( DWELLING_MONSTER3 );
1087             priorities.emplace_back( DWELLING_UPGRADE3 );
1088             priorities.emplace_back( DWELLING_MONSTER5 );
1089             priorities.emplace_back( DWELLING_UPGRADE5 );
1090             priorities.emplace_back( DWELLING_MONSTER2 );
1091             priorities.emplace_back( DWELLING_UPGRADE2 );
1092             priorities.emplace_back( DWELLING_MONSTER4 );
1093             priorities.emplace_back( DWELLING_UPGRADE4 );
1094             priorities.emplace_back( BUILD_MAGEGUILD1 );
1095             priorities.emplace_back( BUILD_MAGEGUILD2 );
1096             priorities.emplace_back( BUILD_MAGEGUILD3 );
1097             priorities.emplace_back( BUILD_MAGEGUILD4 );
1098             priorities.emplace_back( BUILD_MAGEGUILD5 );
1099             priorities.emplace_back( BUILD_SHIPYARD );
1100             priorities.emplace_back( BUILD_WEL2 );
1101             priorities.emplace_back( BUILD_MARKETPLACE );
1102             priorities.emplace_back( BUILD_STATUE );
1103             priorities.emplace_back( BUILD_WELL );
1104             break;
1105         default:
1106             // Did you add a new castle?
1107             assert( 0 );
1108             break;
1109         }
1110 
1111         return priorities;
1112     }
1113 }
1114