@@ -39,7 +39,6 @@ static void button_overlay(int param1, int param2);
39
39
static void button_collapse_expand (int param1, int param2);
40
40
static void button_build (int submenu, int param2);
41
41
static void button_undo (int param1, int param2);
42
- static void button_messages (int param1, int param2);
43
42
static void button_help (int param1, int param2);
44
43
static void button_advisors (int param1, int param2);
45
44
static void button_empire (int param1, int param2);
@@ -101,7 +100,6 @@ static image_button buttons_build_expanded[] = {
101
100
{COL4, ROW3, 34 , 49 , IB_BUILD, GROUP_SIDEBAR_BUTTONS, 44 , button_build, button_none, BUILDING_MENU_SECURITY, 0 , 1 },
102
101
103
102
{COL1, ROW4, 35 , 45 , IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 48 , button_undo, button_none, 0 , 0 , 1 },
104
- {COL2, ROW4, 38 , 45 , IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 52 , button_messages, button_help, 0 , MESSAGE_DIALOG_MESSAGES, 1 },
105
103
};
106
104
107
105
static image_button buttons_top_expanded[3 ] = {
@@ -136,25 +134,23 @@ static void draw_sidebar_remainder(int x_offset, bool is_collapsed) {
136
134
sidebar_common_draw_relief (x_offset, relief_y_offset, {PACK_GENERAL, 121 }, is_collapsed);
137
135
}
138
136
139
- static void draw_number_of_messages (int x_offset ) {
137
+ void ui::sidebar_window:: draw_number_of_messages () {
140
138
int messages = city_message_count ();
141
- buttons_build_expanded[13 ].enabled = messages > 0 ;
142
- if (messages) {
143
- text_draw_number_centered_colored (messages, x_offset + 74 , 452 , 32 , FONT_SMALL_PLAIN, COLOR_BLACK);
144
- text_draw_number_centered_colored (messages, x_offset + 73 , 453 , 32 , FONT_SMALL_PLAIN, COLOR_WHITE);
145
- }
139
+
140
+ ui[" show_messages" ].readonly = (messages <= 0 );
141
+ ui[" num_messages" ] = messages > 0 ? bstring32 (messages) : bstring32 ();
146
142
}
147
143
148
144
static void draw_buttons_collapsed (int x_offset) {
149
145
image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, button_expand_sidebar, 1 );
150
146
image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, buttons_build_collapsed, 12 );
151
147
}
152
148
153
- void ui::sidebar_window::draw_buttons_expanded (int x_offset ) {
149
+ void ui::sidebar_window::draw_buttons_expanded () {
154
150
buttons_build_expanded[12 ].enabled = game_can_undo ();
155
151
ui[" goto_problem" ].readonly = !city_message_problem_area_count ();
156
152
image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, buttons_overlays_collapse_sidebar, 1 );
157
- image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, buttons_build_expanded, 15 );
153
+ image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, buttons_build_expanded, std::size (buttons_build_expanded) );
158
154
image_buttons_draw ({x_offset, TOP_MENU_HEIGHT}, buttons_top_expanded, 3 );
159
155
}
160
156
@@ -198,6 +194,8 @@ void ui::sidebar_window::init() {
198
194
window_invalidate ();
199
195
}
200
196
});
197
+
198
+ ui[" show_messages" ].onclick ([] { window_message_list_show (); });
201
199
}
202
200
203
201
void ui::sidebar_window::ui_draw_foreground () {
@@ -222,9 +220,9 @@ void ui::sidebar_window::ui_draw_foreground() {
222
220
223
221
ui.image (extra_block, { extra_block_x, 0 });
224
222
225
- draw_number_of_messages (x_offset - 26 );
223
+ draw_number_of_messages ();
226
224
227
- draw_buttons_expanded (x_offset );
225
+ draw_buttons_expanded ();
228
226
draw_overlay_text ();
229
227
230
228
draw_sidebar_remainder (x_offset, false );
@@ -237,11 +235,10 @@ void ui::sidebar_window::ui_draw_foreground() {
237
235
int x_offset = sidebar_common_get_x_offset_collapsed ();
238
236
draw_buttons_collapsed (x_offset);
239
237
} else {
240
- int x_offset = sidebar_common_get_x_offset_expanded ();
241
- draw_buttons_expanded (x_offset);
238
+ draw_buttons_expanded ();
242
239
243
240
widget_minimap_draw ({ x_offset + 12 , MINIMAP_Y_OFFSET }, MINIMAP_WIDTH, MINIMAP_HEIGHT, 0 );
244
- draw_number_of_messages (x_offset - 26 );
241
+ draw_number_of_messages ();
245
242
}
246
243
sidebar_extra_draw_foreground ();
247
244
@@ -360,9 +357,7 @@ static void button_undo(int param1, int param2) {
360
357
game_undo_perform ();
361
358
window_invalidate ();
362
359
}
363
- static void button_messages (int param1, int param2) {
364
- window_message_list_show ();
365
- }
360
+
366
361
static void button_help (int param1, int param2) {
367
362
window_message_dialog_show (param2, -1 , window_city_draw_all);
368
363
}
0 commit comments