Skip to content

Commit 0f8346a

Browse files
committed
ui: add info window for temple complex building
1 parent 480b934 commit 0f8346a

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed

src/building/building.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ building_mansion *building::dcast_mansion() { return dcast()->dcast_mansion(); }
239239
building_physician *building::dcast_physician() { return dcast()->dcast_physician(); }
240240
building_wharf *building::dcast_wharf() { return dcast()->dcast_wharf(); }
241241
building_warship_wharf *building::dcast_warship_wharf() { return dcast()->dcast_warship_wharf(); }
242+
building_temple_complex *building::dcast_temple_complex() { return dcast()->dcast_temple_complex(); }
242243
building_temple_complex_altar *building::dcast_temple_complex_altar() { return dcast()->dcast_temple_complex_altar(); }
243244

244245
building::building() {

src/building/building.h

+1
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ class building {
491491
building_physician *dcast_physician();
492492
building_wharf *dcast_wharf();
493493
building_warship_wharf *dcast_warship_wharf();
494+
building_temple_complex *dcast_temple_complex();
494495
building_temple_complex_altar *dcast_temple_complex_altar();
495496

496497
bool spawn_noble(bool spawned);

src/scripts/ui.js

+29-11
Original file line numberDiff line numberDiff line change
@@ -1040,17 +1040,35 @@ window terrain_info_window = {
10401040

10411041
window temple_info_window = {
10421042
ui : {
1043-
background : { type : "outer_panel", pos: [0, 0], size: [29, 18]},
1044-
title : { type : "text", pos: [0, 16], size: [px(29), 13], font : FONT_LARGE_BLACK_ON_LIGHT, align:"center"},
1045-
inner_panel : { type : "inner_panel", pos : [16, 56], size: [27, 4] },
1046-
workers_img : { type : "image", pack:PACK_GENERAL, id:134, offset:14, pos:[40, 70] },
1047-
workers_text: { type : "text", text:"${building.num_workers} ${8.12} ( ${model.laborers} ${69.0}", pos: [70, 74], font: FONT_NORMAL_BLACK_ON_DARK, multiline:true, wrap:px(24) },
1048-
workers_desc: { type : "text", pos: [70, 74 + 16], font: FONT_NORMAL_BLACK_ON_DARK },
1049-
button_help : { type : "image_button", margin:{left:14, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134 },
1050-
button_close: { type : "image_button", margin:{right:-40, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134, offset:4 },
1051-
show_overlay: { type:"generic_button", margin:{right:-64, bottom:-40}, size:[23, 23]},
1052-
god_image : { type : "image", pos: [190, 134] },
1053-
mothball : { type:"generic_button", margin:{right:-90, bottom:-40}, size:[23, 23]},
1043+
background : outer_panel({ pos: [0, 0], size: [29, 18]}),
1044+
title : text({ pos: [0, 16], size: [px(29), 13], font : FONT_LARGE_BLACK_ON_LIGHT, align:"center"}),
1045+
1046+
inner_panel : inner_panel({ pos : [16, 56], size: [27, 4] }),
1047+
workers_img : image({ pack:PACK_GENERAL, id:134, offset:14, pos:[40, 70] }),
1048+
workers_text: text({ text:"${building.num_workers} ${8.12} ( ${model.laborers} ${69.0}", pos: [70, 74], font: FONT_NORMAL_BLACK_ON_DARK, multiline:true, wrap:px(24) }),
1049+
workers_desc: text({ pos: [70, 74 + 16], font: FONT_NORMAL_BLACK_ON_DARK }),
1050+
button_help : image_button({ margin:{left:14, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134 }),
1051+
button_close: image_button({ margin:{right:-40, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134, offset:4 }),
1052+
show_overlay: button({ margin:{right:-64, bottom:-40}, size:[23, 23]}),
1053+
god_image : image({ pos: [190, 134] }),
1054+
mothball : button({ margin:{right:-90, bottom:-40}, size:[23, 23]}),
1055+
}
1056+
}
1057+
1058+
window temple_complex_info_window = {
1059+
ui : {
1060+
background : outer_panel({ pos: [0, 0], size: [29, 18]}),
1061+
title : text({ pos: [0, 16], size: [px(29), 13], font : FONT_LARGE_BLACK_ON_LIGHT, align:"center"}),
1062+
1063+
inner_panel : inner_panel({ pos : [16, 56], size: [27, 4] }),
1064+
workers_img : image({ pack:PACK_GENERAL, id:134, offset:14, pos:[40, 70] }),
1065+
workers_text: text({ text:"${building.num_workers} ${8.12} ( ${model.laborers} ${69.0}", pos: [70, 74], font: FONT_NORMAL_BLACK_ON_DARK, multiline:true, wrap:px(24) }),
1066+
workers_desc: text({ pos: [70, 74 + 16], font: FONT_NORMAL_BLACK_ON_DARK }),
1067+
button_help : image_button({ margin:{left:14, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134 }),
1068+
button_close: image_button({ margin:{right:-40, bottom:-40}, size:[27, 27], pack:PACK_GENERAL, id:134, offset:4 }),
1069+
show_overlay: button({ margin:{right:-64, bottom:-40}, size:[23, 23]}),
1070+
god_image : image({ pos: [190, 134] }),
1071+
mothball : button({ margin:{right:-90, bottom:-40}, size:[23, 23]}),
10541072
}
10551073
}
10561074

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "window_building_info.h"
2+
3+
#include "building/building_temple_complex.h"
4+
5+
struct temple_complex_info_window : public building_info_window_t<temple_complex_info_window> {
6+
virtual void init(object_info &c) override;
7+
virtual bool check(object_info &c) override {
8+
building *b = c.building_get();
9+
return !!smart_cast<building_temple_complex>(b);
10+
}
11+
};
12+
13+
temple_complex_info_window temple_complex_infow;
14+
15+
void temple_complex_info_window::init(object_info &c) {
16+
building_info_window::init(c);
17+
18+
auto temple = smart_cast<building_temple_complex>(c.building_get());
19+
20+
int image_offset = 0;
21+
switch (temple->type()) {
22+
case BUILDING_TEMPLE_COMPLEX_OSIRIS: image_offset = 21; break;
23+
case BUILDING_TEMPLE_COMPLEX_RA: image_offset = 22; break;
24+
case BUILDING_TEMPLE_COMPLEX_PTAH: image_offset = 23; break;
25+
case BUILDING_TEMPLE_COMPLEX_SETH: image_offset = 24; break;
26+
case BUILDING_TEMPLE_COMPLEX_BAST: image_offset = 25; break;
27+
28+
default:
29+
assert(false);
30+
}
31+
32+
ui["god_image"].image({ PACK_UNLOADED, 21, image_offset });
33+
}

0 commit comments

Comments
 (0)