3
3
#include " window/building/common.h"
4
4
#include " graphics/elements/panel.h"
5
5
#include " graphics/elements/lang_text.h"
6
+ #include " graphics/text.h"
7
+ #include " graphics/elements/button.h"
8
+ #include " graphics/elements/generic_button.h"
9
+ #include " city/emperor.h"
10
+ #include " city/victory.h"
11
+ #include " city/finance.h"
12
+ #include " city/ratings.h"
13
+
14
+ struct window_info_mansion {
15
+ int focus_button_id;
16
+ };
17
+
18
+ static void button_set_salary (int rank, int param2) {
19
+ if (!city_victory_has_won ()) {
20
+ city_emperor_set_salary_rank (rank);
21
+ city_finance_update_salary ();
22
+ city_ratings_update_kingdom_explanation ();
23
+ // window_advisors_show();
24
+ }
25
+ }
26
+
27
+ window_info_mansion g_window_info_mansion;
28
+
29
+ static generic_button imperial_buttons[] = {
30
+ {40 , 90 , 400 , 20 , button_set_salary, button_none, 0 , 0 },
31
+ };
6
32
7
33
void building_mansion::window_info_background (object_info &c) {
8
34
c.help_id = 78 ;
35
+ c.go_to_advisor .left_a = ADVISOR_IMPERIAL;
9
36
window_building_play_sound (&c, " wavs/gov_palace.wav" );
10
37
outer_panel_draw (c.offset , c.width_blocks , c.height_blocks );
11
38
lang_text_draw_centered (103 , 0 , c.offset .x , c.offset .y + 10 , 16 * c.width_blocks , FONT_LARGE_BLACK_ON_LIGHT);
12
39
window_building_draw_description_at (c, 16 * c.height_blocks - 143 , 103 , 1 );
13
- }
40
+
41
+ button_border_draw (c.offset .x + 40 , c.offset .y + 90 , 400 , 20 , g_window_info_mansion.focus_button_id == 2 );
42
+ int width = lang_text_draw (52 , city_emperor_salary_rank () + 4 , c.offset .x + 40 , c.offset .y + 94 , FONT_NORMAL_WHITE_ON_DARK);
43
+ width += text_draw_number (city_emperor_salary_amount (), ' @' , " " , c.offset .x + 40 + width, c.offset .y + 94 , FONT_NORMAL_WHITE_ON_DARK);
44
+ lang_text_draw (52 , 3 , c.offset .x + 40 + width, c.offset .y + 94 , FONT_NORMAL_WHITE_ON_DARK);
45
+ }
46
+
47
+ int building_mansion::window_info_handle_mouse (const mouse *m, object_info &c) {
48
+ return generic_buttons_handle_mouse (m, 0 , 0 , imperial_buttons, 8 , &g_window_info_mansion.focus_button_id );
49
+ }
0 commit comments