Merge ui_area_map_width into ui_menu_width, now a 2-byte array

develop
Quietust 2017-12-03 20:34:59 -06:00
parent c72ae8d8a7
commit 88c7e493b8
9 changed files with 16 additions and 24 deletions

@ -18,8 +18,8 @@ refreshSidebar = dfhack.gui.refreshSidebar
function getPanelLayout() function getPanelLayout()
local dims = dfhack.gui.getDwarfmodeViewDims() local dims = dfhack.gui.getDwarfmodeViewDims()
local area_pos = df.global.ui_area_map_width local area_pos = df.global.ui_menu_width[1]
local menu_pos = df.global.ui_menu_width local menu_pos = df.global.ui_menu_width[0]
if dims.menu_forced then if dims.menu_forced then
menu_pos = area_pos - 1 menu_pos = area_pos - 1

@ -108,7 +108,6 @@ using df::global::ui;
using df::global::world; using df::global::world;
using df::global::selection_rect; using df::global::selection_rect;
using df::global::ui_menu_width; using df::global::ui_menu_width;
using df::global::ui_area_map_width;
using df::global::gamemode; using df::global::gamemode;
static df::layer_object_listst *getLayerList(df::viewscreen_layer *layer, int idx) static df::layer_object_listst *getLayerList(df::viewscreen_layer *layer, int idx)
@ -1508,8 +1507,8 @@ Gui::DwarfmodeDims getDwarfmodeViewDims_default()
dims.area_x1 = dims.area_x2 = dims.menu_x1 = dims.menu_x2 = -1; dims.area_x1 = dims.area_x2 = dims.menu_x1 = dims.menu_x2 = -1;
dims.menu_forced = false; dims.menu_forced = false;
int menu_pos = (ui_menu_width ? *ui_menu_width : 2); int menu_pos = (ui_menu_width ? (*ui_menu_width)[0] : 2);
int area_pos = (ui_area_map_width ? *ui_area_map_width : 3); int area_pos = (ui_menu_width ? (*ui_menu_width)[1] : 3);
if (ui && ui->main.mode && menu_pos >= area_pos) if (ui && ui->main.mode && menu_pos >= area_pos)
{ {
@ -1715,14 +1714,14 @@ bool Gui::getWindowSize (int32_t &width, int32_t &height)
bool Gui::getMenuWidth(uint8_t &menu_width, uint8_t &area_map_width) bool Gui::getMenuWidth(uint8_t &menu_width, uint8_t &area_map_width)
{ {
menu_width = *df::global::ui_menu_width; menu_width = (*df::global::ui_menu_width)[0];
area_map_width = *df::global::ui_area_map_width; area_map_width = (*df::global::ui_menu_width)[1];
return true; return true;
} }
bool Gui::setMenuWidth(const uint8_t menu_width, const uint8_t area_map_width) bool Gui::setMenuWidth(const uint8_t menu_width, const uint8_t area_map_width)
{ {
*df::global::ui_menu_width = menu_width; (*df::global::ui_menu_width)[0] = menu_width;
*df::global::ui_area_map_width = area_map_width; (*df::global::ui_menu_width)[1] = area_map_width;
return true; return true;
} }

@ -1 +1 @@
Subproject commit 9ffd5971bd4709abec914715cee1a23963b7ee91 Subproject commit 0a9a571545eaf1fd960366fd12dffe6b30add756

@ -57,8 +57,6 @@ using df::global::ui;
using df::global::world; using df::global::world;
using df::global::gamemode; using df::global::gamemode;
using df::global::ui_build_selector; using df::global::ui_build_selector;
using df::global::ui_menu_width;
using df::global::ui_area_map_width;
using namespace DFHack::Gui; using namespace DFHack::Gui;
using Screen::Pen; using Screen::Pen;

@ -88,8 +88,8 @@ rect2d getMapViewport()
int menu_x1=area_x2-MENU_WIDTH-1; int menu_x1=area_x2-MENU_WIDTH-1;
int view_rb=w-1; int view_rb=w-1;
int area_pos=*df::global::ui_area_map_width; int area_pos=(*df::global::ui_menu_width)[1];
int menu_pos=*df::global::ui_menu_width; int menu_pos=(*df::global::ui_menu_width)[0];
if(area_pos<3) if(area_pos<3)
{ {
view_rb=area_x2; view_rb=area_x2;

@ -36,8 +36,6 @@ REQUIRE_GLOBAL(enabler);
REQUIRE_GLOBAL(gametype); REQUIRE_GLOBAL(gametype);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(ui);
REQUIRE_GLOBAL(ui_area_map_width);
REQUIRE_GLOBAL(ui_menu_width);
REQUIRE_GLOBAL(window_x); REQUIRE_GLOBAL(window_x);
REQUIRE_GLOBAL(window_y); REQUIRE_GLOBAL(window_y);
REQUIRE_GLOBAL(window_z); REQUIRE_GLOBAL(window_z);

@ -15,15 +15,15 @@ module DFHack
x, y, z = x.x, x.y, x.z if x.respond_to?(:x) x, y, z = x.x, x.y, x.z if x.respond_to?(:x)
# compute screen 'map' size (tiles) # compute screen 'map' size (tiles)
menuwidth = ui_menu_width menuwidth = ui_menu_width[0]
# ui_menu_width shows only the 'tab' status # ui_menu_width shows only the 'tab' status
menuwidth = 1 if menuwidth == 2 and ui_area_map_width == 2 and cursor.x != -30000 menuwidth = 1 if menuwidth == 2 and ui_menu_width[1] == 2 and cursor.x != -30000
menuwidth = 2 if menuwidth == 3 and cursor.x != -30000 menuwidth = 2 if menuwidth == 3 and cursor.x != -30000
w_w = gps.dimx - 2 w_w = gps.dimx - 2
w_h = gps.dimy - 2 w_h = gps.dimy - 2
case menuwidth case menuwidth
when 1; w_w -= 55 when 1; w_w -= 55
when 2; w_w -= (ui_area_map_width == 2 ? 24 : 31) when 2; w_w -= (ui_menu_width[1] == 2 ? 24 : 31)
end end
# center view # center view

@ -117,12 +117,10 @@ DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(enabler);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(ui);
REQUIRE_GLOBAL(ui_area_map_width);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(ui_building_in_assign); REQUIRE_GLOBAL(ui_building_in_assign);
REQUIRE_GLOBAL(ui_building_in_resize); REQUIRE_GLOBAL(ui_building_in_resize);
REQUIRE_GLOBAL(ui_building_item_cursor); REQUIRE_GLOBAL(ui_building_item_cursor);
REQUIRE_GLOBAL(ui_menu_width);
REQUIRE_GLOBAL(ui_look_cursor); REQUIRE_GLOBAL(ui_look_cursor);
REQUIRE_GLOBAL(ui_sidebar_menus); REQUIRE_GLOBAL(ui_sidebar_menus);
REQUIRE_GLOBAL(ui_unit_view_mode); REQUIRE_GLOBAL(ui_unit_view_mode);

@ -108,7 +108,6 @@ REQUIRE_GLOBAL(ui_building_assign_items);
REQUIRE_GLOBAL(ui_building_in_assign); REQUIRE_GLOBAL(ui_building_in_assign);
REQUIRE_GLOBAL(ui_menu_width); REQUIRE_GLOBAL(ui_menu_width);
REQUIRE_GLOBAL(ui_area_map_width);
using namespace DFHack::Gui; using namespace DFHack::Gui;
@ -3926,8 +3925,8 @@ public:
return; return;
int left_margin = gps->dimx - 30; int left_margin = gps->dimx - 30;
int8_t a = *ui_menu_width; int8_t a = (*ui_menu_width)[0];
int8_t b = *ui_area_map_width; int8_t b = (*ui_menu_width)[1];
if ((a == 1 && b > 1) || (a == 2 && b == 2)) if ((a == 1 && b > 1) || (a == 2 && b == 2))
left_margin -= 24; left_margin -= 24;