Skip to content

Commit

Permalink
remove archery priority visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dvincent56 committed Mar 31, 2024
1 parent e92790c commit d8deb7b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
5 changes: 4 additions & 1 deletion src/building/barracks.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ int building_barracks_create_tower_sentry(building *barracks, int x, int y)

void building_barracks_set_priority(building *barracks, int priority)
{
barracks->subtype.barracks_priority = priority;
// TODO remove when archery available
if (priority != 4) {
barracks->subtype.barracks_priority = priority;
}
}

void building_barracks_toggle_delivery(building *barracks)
Expand Down
6 changes: 3 additions & 3 deletions src/window/building/culture.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ static void draw_grand_temple_mars_military(building_info_context *c)
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_PRIORITY, c->x_offset + 25, c->y_offset + 88, FONT_NORMAL_BLACK); // "Priority"

inner_panel_draw(c->x_offset + 16, c->y_offset + 108, c->width_blocks - 2, 5);
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_FORTS, c->x_offset + 50, c->y_offset + 115, FONT_NORMAL_BROWN); // "Forts"
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_TOWERS, c->x_offset + 327, c->y_offset + 115, FONT_NORMAL_BROWN); // "Towers"
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_FORTS, c->x_offset + 50, c->y_offset + 113, FONT_NORMAL_BROWN); // "Forts"
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_TOWERS, c->x_offset + 327, c->y_offset + 113, FONT_NORMAL_BROWN); // "Towers"

image_draw(image_group(GROUP_FIGURE_CARTPUSHER_CART) + 108,
c->x_offset + 402, c->y_offset + 42, COLOR_MASK_NONE, SCALE_NONE);
Expand Down Expand Up @@ -757,7 +757,7 @@ void window_building_draw_grand_temple_foreground(building_info_context *c)
16 * (c->width_blocks - 10), FONT_NORMAL_BLACK, 0);
}
if (b->type == BUILDING_GRAND_TEMPLE_MARS) {
window_building_draw_priority_buttons(c->x_offset + 50, c->y_offset + 135);
window_building_draw_priority_buttons(c->x_offset + 50, c->y_offset + 133);
window_building_draw_delivery_buttons(c->x_offset + 440, c->y_offset + 52);
}
}
Expand Down
47 changes: 25 additions & 22 deletions src/window/building/military.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,17 @@ static void draw_priority_buttons(int x, int y, int buttons)
building *barracks = building_get(data.building_id);
int priority = building_barracks_get_priority(barracks);

if (has_focus || priority == i) {
button_border_draw(x_adj - 3, y_adj - 3, 46, 46, 1);
}

if (priority == i) {
image_draw(assets_get_image_id("UI", priority_forts[i + 7].image_id), x_adj, y_adj, COLOR_MASK_NONE, SCALE_NONE);
} else {
image_draw(assets_get_image_id("UI", priority_forts[i].image_id), x_adj, y_adj, COLOR_MASK_NONE, SCALE_NONE);
}
// TODO remove when archery available
if (i != 4) {
if (has_focus || priority == i) {
button_border_draw(x_adj - 3, y_adj - 3, 46, 46, 1);
}
if (priority == i) {
image_draw(assets_get_image_id("UI", priority_forts[i + 7].image_id), x_adj, y_adj, COLOR_MASK_NONE, SCALE_NONE);
} else {
image_draw(assets_get_image_id("UI", priority_forts[i].image_id), x_adj, y_adj, COLOR_MASK_NONE, SCALE_NONE);
}
}
}

window_request_refresh();
Expand All @@ -142,6 +144,7 @@ static void draw_delivery_buttons(int x, int y)
{
building *barracks = building_get(data.building_id);
button_border_draw(x, y, 20, 20, data.focus_delivery_button_id);

if (barracks->accept_delivery) {
image_draw(assets_get_image_id("UI", "Allowed_Walker_Check"), x + 4, y + 4,
COLOR_MASK_NONE, SCALE_NONE);
Expand Down Expand Up @@ -234,24 +237,23 @@ void window_building_draw_barracks(building_info_context *c)
}
}

image_draw(image_group(GROUP_FIGURE_CARTPUSHER_CART) + 108, c->x_offset + 387, c->y_offset + 50, COLOR_MASK_NONE, SCALE_NONE);

lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_PRIORITY, c->x_offset + 32, c->y_offset + 170, FONT_NORMAL_BLACK); // "Priority"
inner_panel_draw(c->x_offset + 16, c->y_offset + 188, c->width_blocks - 2, 5);

lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_FORTS, c->x_offset + 42, c->y_offset + 202, FONT_NORMAL_BROWN); // "Forts"
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_TOWERS, c->x_offset + 324, c->y_offset + 202, FONT_NORMAL_BROWN); // "Towers"

inner_panel_draw(c->x_offset + 16, c->y_offset + 280, c->width_blocks - 2, 4);
window_building_draw_employment(c, 282);
window_building_draw_risks(c, c->x_offset + c->width_blocks * BLOCK_SIZE - 76, c->y_offset + 288);
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_FORTS, c->x_offset + 42, c->y_offset + 200, FONT_NORMAL_BROWN); // "Forts"
lang_text_draw(CUSTOM_TRANSLATION, TR_WINDOW_BARRACKS_TOWERS, c->x_offset + 324, c->y_offset + 200, FONT_NORMAL_BROWN); // "Towers"

image_draw(image_group(GROUP_FIGURE_CARTPUSHER_CART) + 108,
c->x_offset + 200, c->y_offset + 350, COLOR_MASK_NONE, SCALE_NONE);
inner_panel_draw(c->x_offset + 16, c->y_offset + 290, c->width_blocks - 2, 4);
window_building_draw_employment(c, 294);
window_building_draw_risks(c, c->x_offset + c->width_blocks * BLOCK_SIZE - 76, c->y_offset + 298);
}

void window_building_draw_barracks_foreground(building_info_context *c)
{
draw_priority_buttons(c->x_offset + 42, c->y_offset + 220, 7);
draw_delivery_buttons(c->x_offset + 238, c->y_offset + 360);
draw_priority_buttons(c->x_offset + 42, c->y_offset + 218, 7);
draw_delivery_buttons(c->x_offset + 425, c->y_offset + 60);
}

void window_building_draw_priority_buttons(int x, int y)
Expand All @@ -266,9 +268,9 @@ void window_building_draw_delivery_buttons(int x, int y)

int window_building_handle_mouse_barracks(const mouse *m, building_info_context *c)
{
if (generic_buttons_handle_mouse(m, c->x_offset + 46, c->y_offset + 224,
if (generic_buttons_handle_mouse(m, c->x_offset + 46, c->y_offset + 222,
priority_buttons, 7, &data.focus_priority_button_id) ||
generic_buttons_handle_mouse(m, c->x_offset + 238, c->y_offset + 360,
generic_buttons_handle_mouse(m, c->x_offset + 425, c->y_offset + 60,
delivery_buttons, 1, &data.focus_delivery_button_id)) {
window_invalidate();
return 1;
Expand Down Expand Up @@ -641,7 +643,8 @@ void window_building_barracks_get_tooltip_priority(int *translation)
*translation = TR_TOOLTIP_BARRACKS_PRIORITY_AUXINF;
break;
case 5:
*translation = TR_TOOLTIP_BARRACKS_PRIORITY_AUXARCH;
// TODO uncomment when archery available
// *translation = TR_TOOLTIP_BARRACKS_PRIORITY_AUXARCH;
break;
case 6:
*translation = TR_TOOLTIP_BARRACKS_PRIORITY_TOWER;
Expand Down
2 changes: 1 addition & 1 deletion src/window/building_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static int get_height_id(void)
case BUILDING_AMPHITHEATER:
case BUILDING_ARENA:
case BUILDING_CONCRETE_MAKER:
return 5;
return 5;

case BUILDING_DOCK:
case BUILDING_LIGHTHOUSE:
Expand Down

0 comments on commit d8deb7b

Please sign in to comment.