@@ -72,8 +72,6 @@ static void button_help(int param1, int param2);
72
72
static void button_close (int param1, int param2);
73
73
static void button_advisor (int advisor, int param2);
74
74
static void button_mothball (int mothball, int param2);
75
- static void button_debugpath (int debug, int param2);
76
- static void button_overlay (int overlay, int param2);
77
75
78
76
object_info g_building_info_context;
79
77
@@ -82,10 +80,6 @@ struct building_info_data {
82
80
int generic_button_id = 0 ;
83
81
int debug_path_button_id = 0 ;
84
82
85
- generic_button generic_button_figures[1 ] = {
86
- {400 , 3 , 24 , 24 , button_debugpath, button_none, 0 , 0 }
87
- };
88
-
89
83
generic_button generic_button_mothball[1 ] = {
90
84
{400 , 3 , 24 , 24 , button_mothball, button_none, 0 , 0 }
91
85
};
@@ -574,13 +568,6 @@ static void draw_mothball_button(int x, int y, int focused) {
574
568
}
575
569
}
576
570
577
- static void draw_debugpath_button (int x, int y, int focused) {
578
- auto &context = g_building_info_context;
579
- button_border_draw (x, y, 20 , 20 , focused ? 1 : 0 );
580
- figure* f = figure_get (context.figure .figure_ids [0 ]);
581
- text_draw_centered ((uint8_t *)(f->draw_debug_mode ? " P" : " p" ), x + 1 , y + 4 , 20 , FONT_NORMAL_BLACK_ON_LIGHT, 0 );
582
- }
583
-
584
571
static void draw_refresh_background () {
585
572
auto &context = g_building_info_context;
586
573
if (context.type == BUILDING_INFO_NONE) {
@@ -837,19 +824,26 @@ static void draw_foreground() {
837
824
}
838
825
839
826
if (context.figure .draw_debug_path ) {
840
- draw_debugpath_button (context.offset .x + 400 , context.offset .y + 3 + 16 * context.height_blocks - 40 , g_building_info.debug_path_button_id );
827
+ figure* f = figure_get (context.figure .figure_ids [0 ]);
828
+ pcstr label = (f->draw_debug_mode ? " P" : " p" );
829
+ ui::button (label, {400 , 3 + 16 * context.height_blocks - 40 }, {24 , 24 })
830
+ .onclick ([&context, f] (int , int ) {
831
+ f->draw_debug_mode = f->draw_debug_mode ? 0 :FIGURE_DRAW_DEBUG_ROUTING;
832
+ window_invalidate ();
833
+ });
841
834
}
842
835
843
836
if (context.show_overlay != OVERLAY_NONE) {
844
837
pcstr label = (game_state_overlay () != context.show_overlay ? " v" : " V" );
845
- ui::button (label, {375 , 3 + 16 * context.height_blocks - 40 }, {20 , 20 }, [&context] (int , int ) {
846
- if (game_state_overlay () != context.show_overlay ) {
847
- game_state_set_overlay ((e_overlay)context.show_overlay );
848
- } else {
849
- game_state_reset_overlay ();
850
- }
851
- window_invalidate ();
852
- });
838
+ ui::button (label, {375 , 3 + 16 * context.height_blocks - 40 }, {20 , 20 })
839
+ .onclick ([&context] (int , int ) {
840
+ if (game_state_overlay () != context.show_overlay ) {
841
+ game_state_set_overlay ((e_overlay)context.show_overlay );
842
+ } else {
843
+ game_state_reset_overlay ();
844
+ }
845
+ window_invalidate ();
846
+ });
853
847
}
854
848
855
849
}
@@ -946,11 +940,6 @@ static void handle_input(const mouse* m, const hotkeys* h) {
946
940
button_id |= !!handle_specific_building_info_mouse (m);
947
941
}
948
942
949
- if (context.figure .draw_debug_path ) {
950
- button_id |= generic_buttons_handle_mouse (m, context.offset + vec2i (0 , 16 * context.height_blocks - 40 ),
951
- g_building_info.generic_button_figures , g_building_info.debug_path_button_id );
952
- }
953
-
954
943
button_id |= ui::handle_mouse (m);
955
944
956
945
if (!button_id && input_go_back_requested (m, h)) {
@@ -997,13 +986,6 @@ static void button_mothball(int mothball, int param2) {
997
986
}
998
987
}
999
988
1000
- static void button_debugpath (int debug, int param2) {
1001
- auto &context = g_building_info_context;
1002
- figure* f = figure_get (context.figure .figure_ids [0 ]);
1003
- f->draw_debug_mode = f->draw_debug_mode ? 0 :FIGURE_DRAW_DEBUG_ROUTING;
1004
- window_invalidate ();
1005
- }
1006
-
1007
989
void window_building_info_show (const map_point& point) {
1008
990
window_type window = {
1009
991
WINDOW_BUILDING_INFO,
0 commit comments