Skip to content

Commit d85311d

Browse files
author
s.kushnirenko
committed
ui: tax collector: draw tax rate buttons in window
1 parent af4c6f4 commit d85311d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/building/building_tax_collector.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "figure/figure.h"
66
#include "game/resource.h"
77
#include "city/finance.h"
8+
#include "graphics/window.h"
9+
#include "graphics/elements/arrow_button.h"
810
#include "graphics/elements/panel.h"
911
#include "graphics/view/view.h"
1012
#include "graphics/elements/lang_text.h"
@@ -35,8 +37,19 @@ void building_tax_collector::window_info_background(object_info &c) {
3537
int amount = config_get(CONFIG_GP_CH_NEW_TAX_COLLECTION_SYSTEM) ? b->deben_storage : b->tax_income_or_storage;
3638
ui::label_num(8, 0, amount, {44 + width, 43});
3739

38-
ui::label(60, 1, {c.width_blocks * 16 / 2 + 50, 40});
39-
ui::label_percent(city_finance_tax_percentage(), {c.width_blocks * 16 / 2 + 150, 40});
40+
int tax_block = c.width_blocks * 16 / 2;
41+
ui::label(60, 1, {tax_block + 50, 44});
42+
ui::label_percent(city_finance_tax_percentage(), {tax_block + 140, 44});
43+
ui::arw_button({tax_block + 170, 36}, true)
44+
.onclick([] (int, int) {
45+
city_finance_change_tax_percentage(-1);
46+
window_invalidate();
47+
});
48+
ui::arw_button({tax_block + 194, 36}, false)
49+
.onclick([] (int, int) {
50+
city_finance_change_tax_percentage(1);
51+
window_invalidate();
52+
});
4053

4154
if (!c.has_road_access) {
4255
window_building_draw_description(c, 69, 25);
@@ -56,8 +69,6 @@ void building_tax_collector::window_info_background(object_info &c) {
5669

5770
inner_panel_draw(c.offset.x + 16, c.offset.y + 136, c.width_blocks - 2, 4);
5871
window_building_draw_employment(&c, 142);
59-
60-
ui::end_widget();
6172
}
6273

6374
void building_tax_collector::update_month() {

0 commit comments

Comments
 (0)