Skip to content

Commit 7f6d0fd

Browse files
committed
ui: sidebar briefing button moved to js config
1 parent b1f9e88 commit 7f6d0fd

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/graphics/elements/ui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct element {
102102
vec2i pos;
103103
vec2i size;
104104
recti margin = { recti::nomargin, recti::nomargin, recti::nomargin, recti::nomargin };
105-
bool readonly = true;
105+
bool readonly = false;
106106
bool enabled = true;
107107
bool grayed = false;
108108

src/scripts/ui.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,9 @@ sidebar_window = {
835835

836836
show_overlays : button({pos:[4, 30], size:[117, 20], border:false, font_hover:FONT_NORMAL_YELLOW }),
837837

838-
goto_problem : image_button({pos:[86, 434], pack:PACK_GENERAL, id:136, offset:56}),
839838
show_messages : image_button({pos:[46, 434], pack:PACK_GENERAL, id:136, offset:52}),
839+
goto_problem : image_button({pos:[86, 434], pack:PACK_GENERAL, id:136, offset:56}),
840+
show_briefing : image_button({pos:[116, 434], pack:PACK_GENERAL, id:136, offset:60}),
840841
num_messages : text({pos: [52, 450], shadow:0xff000000, font:FONT_NORMAL_BLACK_ON_DARK, color:0xffffffff }),
841842
}
842843
}

src/widget/widget_sidebar.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ static void button_undo(int param1, int param2);
4141
static void button_help(int param1, int param2);
4242
static void button_advisors(int param1, int param2);
4343
static void button_empire(int param1, int param2);
44-
static void button_mission_briefing(int param1, int param2);
4544
static void button_rotate_north(int param1, int param2);
4645
static void button_rotate(int clockwise, int param2);
4746

@@ -100,10 +99,9 @@ static image_button buttons_build_expanded[] = {
10099
{COL1, ROW4, 35, 45, IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 48, button_undo, button_none, 0, 0, 1},
101100
};
102101

103-
static image_button buttons_top_expanded[3] = {
102+
static image_button buttons_top_expanded[] = {
104103
{COL1 + 7, 143, 60, 36, IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 64, button_advisors, button_none, 0, 0, 1},
105104
{COL3 + 4, 143, 62, 36, IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 68, button_empire, button_help, 0, MESSAGE_DIALOG_EMPIRE_MAP, 1},
106-
{COL4 - 9, ROW4, 43, 45, IB_NORMAL, GROUP_SIDEBAR_BUTTONS, 60, button_mission_briefing, button_none, 0, 0, 1},
107105
};
108106

109107
ui::sidebar_window g_sidebar;
@@ -145,9 +143,10 @@ static void draw_buttons_collapsed(int x_offset) {
145143
void ui::sidebar_window::draw_buttons_expanded() {
146144
buttons_build_expanded[12].enabled = game_can_undo();
147145
ui["goto_problem"].readonly = !city_message_problem_area_count();
146+
148147
image_buttons_draw({x_offset, TOP_MENU_HEIGHT}, buttons_overlays_collapse_sidebar, 1);
149148
image_buttons_draw({x_offset, TOP_MENU_HEIGHT}, buttons_build_expanded, std::size(buttons_build_expanded));
150-
image_buttons_draw({x_offset, TOP_MENU_HEIGHT}, buttons_top_expanded, 3);
149+
image_buttons_draw({x_offset, TOP_MENU_HEIGHT}, buttons_top_expanded, std::size(buttons_top_expanded));
151150
}
152151

153152
static void refresh_build_menu_buttons() {
@@ -176,6 +175,10 @@ void ui::sidebar_window::load(archive arch, pcstr section) {
176175

177176
arch.r_desc("extra_block", extra_block);
178177
extra_block_x = arch.r_int("extra_block_x");
178+
179+
if (game.session.active) {
180+
init();
181+
}
179182
}
180183

181184
void ui::sidebar_window::init() {
@@ -193,6 +196,9 @@ void ui::sidebar_window::init() {
193196

194197
ui["show_messages"].onclick([] { window_message_list_show(); });
195198

199+
ui["show_briefing"].readonly = scenario_is_custom();
200+
ui["show_briefing"].onclick([] { window_mission_briefing_show_review(); });
201+
196202
ui["show_overlays"]
197203
.onclick([] { window_overlay_menu_show(); })
198204
.onrclick([] { window_message_dialog_show(MESSAGE_DIALOG_OVERLAYS, -1, window_city_draw_all);; });
@@ -365,10 +371,6 @@ static void button_advisors(int param1, int param2) {
365371
static void button_empire(int param1, int param2) {
366372
window_empire_show_checked();
367373
}
368-
static void button_mission_briefing(int param1, int param2) {
369-
if (!scenario_is_custom())
370-
window_mission_briefing_show_review();
371-
}
372374
static void button_rotate_north(int param1, int param2) {
373375
game_orientation_rotate_north();
374376
window_invalidate();

0 commit comments

Comments
 (0)