Merge pull request #2543 from myk002/myk_prep_for_quietust

prep for Quietust's structure updates
develop
Myk 2023-01-02 20:42:48 -08:00 committed by GitHub
commit 6361b0a3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 14 deletions

@ -2267,6 +2267,7 @@ bool Core::ncurses_wgetch(int in, int & out)
}
if(in >= KEY_F(1) && in <= KEY_F(8))
{
/* TODO: understand how this changes for v50
int idx = in - KEY_F(1);
// FIXME: copypasta, push into a method!
if(df::global::ui && df::global::gview)
@ -2285,6 +2286,7 @@ bool Core::ncurses_wgetch(int in, int & out)
return true;
}
}
*/
}
out = in;
return true;
@ -2452,6 +2454,7 @@ bool Core::SelectHotkey(int sym, int modifiers)
int idx = sym - SDL::K_F1;
if(idx >= 0 && idx < 8)
{
/* TODO: understand how this changes for v50
if (modifiers & 1)
idx += 8;
@ -2461,6 +2464,7 @@ bool Core::SelectHotkey(int sym, int modifiers)
{
cmd = df::global::ui->main.hotkeys[idx].name;
}
*/
}
}
}

@ -35,7 +35,6 @@ distribution.
#include <stdio.h>
#include "tinythread.h"
#include "../plugins/uicommon.h"
/*
* Plugin loading functions

@ -76,6 +76,7 @@ void Burrows::clearUnits(df::burrow *burrow)
burrow->units.clear();
/* TODO: understand how this changes for v50
// Sync ui if active
if (ui && ui->main.mode == ui_sidebar_mode::Burrows &&
ui->burrows.in_add_units_mode && ui->burrows.sel_id == burrow->id)
@ -85,6 +86,7 @@ void Burrows::clearUnits(df::burrow *burrow)
for (size_t i = 0; i < sel.size(); i++)
sel[i] = false;
}
*/
}
bool Burrows::isAssignedUnit(df::burrow *burrow, df::unit *unit)
@ -113,6 +115,7 @@ void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable)
erase_from_vector(burrow->units, unit->id);
}
/* TODO: understand how this changes for v50
// Sync ui if active
if (ui && ui->main.mode == ui_sidebar_mode::Burrows &&
ui->burrows.in_add_units_mode && ui->burrows.sel_id == burrow->id)
@ -121,6 +124,7 @@ void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable)
if (idx >= 0)
ui->burrows.sel_units[idx] = enable;
}
*/
}
void Burrows::listBlocks(std::vector<df::map_block*> *pvec, df::burrow *burrow)

@ -143,6 +143,7 @@ static std::map<virtual_identity*, getFocusStringHandler> getFocusStringHandlers
DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
{
/* TODO: understand how this changes for v50
using namespace df::enums::ui_sidebar_mode;
using df::global::ui_workshop_in_add;
@ -315,7 +316,6 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
focus += "/List";
break;
/* TODO: understand how this changes for v50
case Hauling:
if (ui->hauling.in_assign_vehicle)
{
@ -354,11 +354,11 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
focus += "/Select/" + tag;
}
break;
*/
default:
break;
}
*/
}
/* TODO: understand how this changes for v50
@ -667,13 +667,14 @@ bool Gui::cursor_hotkey(df::viewscreen *top)
bool Gui::workshop_job_hotkey(df::viewscreen *top)
{
if (!dwarfmode_hotkey(top))
return false;
/* TODO: understand how this changes for v50
using namespace ui_sidebar_mode;
using df::global::ui_workshop_in_add;
using df::global::ui_workshop_job_cursor;
if (!dwarfmode_hotkey(top))
return false;
switch (ui->main.mode) {
case QueryBuilding:
{
@ -699,16 +700,18 @@ bool Gui::workshop_job_hotkey(df::viewscreen *top)
default:
return false;
}
*/ return false;
}
bool Gui::build_selector_hotkey(df::viewscreen *top)
{
using namespace ui_sidebar_mode;
using df::global::ui_build_selector;
if (!dwarfmode_hotkey(top))
return false;
/* TODO: understand how this changes for v50
using namespace ui_sidebar_mode;
using df::global::ui_build_selector;
switch (ui->main.mode) {
case Build:
{
@ -726,20 +729,23 @@ bool Gui::build_selector_hotkey(df::viewscreen *top)
default:
return false;
}
*/ return false;
}
bool Gui::view_unit_hotkey(df::viewscreen *top)
{
using df::global::ui_selected_unit;
if (!dwarfmode_hotkey(top))
return false;
/* TODO: understand how this changes for v50
using df::global::ui_selected_unit;
if (ui->main.mode != ui_sidebar_mode::ViewUnits)
return false;
if (!ui_selected_unit) // allow missing
return false;
return vector_get(world->units.active, *ui_selected_unit) != NULL;
*/ return false;
}
bool Gui::unit_inventory_hotkey(df::viewscreen *top)
@ -826,6 +832,7 @@ df::job *Gui::getSelectedJob(color_ostream &out, bool quiet)
df::unit *Gui::getAnyUnit(df::viewscreen *top)
{
/* TODO: understand how this changes for v50
using namespace ui_sidebar_mode;
using df::global::ui_look_cursor;
using df::global::ui_look_list;
@ -834,7 +841,6 @@ df::unit *Gui::getAnyUnit(df::viewscreen *top)
using df::global::ui_building_assign_units;
using df::global::ui_building_item_cursor;
/* TODO: understand how this changes for v50
if (VIRTUAL_CAST_VAR(screen, df::viewscreen_unitst, top))
{
return screen->unit;
@ -1108,13 +1114,13 @@ df::unit *Gui::getSelectedUnit(color_ostream &out, bool quiet)
df::item *Gui::getAnyItem(df::viewscreen *top)
{
/* TODO: understand how this changes for v50
using namespace ui_sidebar_mode;
using df::global::ui_look_cursor;
using df::global::ui_look_list;
using df::global::ui_unit_view_mode;
using df::global::ui_building_item_cursor;
/* TODO: understand how this changes for v50
if (VIRTUAL_CAST_VAR(screen, df::viewscreen_textviewerst, top))
{
// return the main item if the parent screen is a viewscreen_itemst
@ -1248,11 +1254,11 @@ df::item *Gui::getSelectedItem(color_ostream &out, bool quiet)
df::building *Gui::getAnyBuilding(df::viewscreen *top)
{
/* TODO: understand how this changes for v50
using namespace ui_sidebar_mode;
using df::global::ui_look_list;
using df::global::ui_look_cursor;
/* TODO: understand how this changes for v50
if (VIRTUAL_CAST_VAR(screen, df::viewscreen_buildinglistst, top))
return vector_get(screen->buildings, screen->cursor);
@ -1324,10 +1330,12 @@ df::plant *Gui::getAnyPlant(df::viewscreen *top)
if (!cursor || !ui || !world)
return nullptr;
/* TODO: understand how this changes for v50
if (ui->main.mode == ui_sidebar_mode::LookAround)
{
return Maps::getPlantAtTile(cursor->x, cursor->y, cursor->z);
}
*/
}
return nullptr;
@ -1945,7 +1953,9 @@ void Gui::resetDwarfmodeView(bool pause)
{
ui->follow_unit = -1;
ui->follow_item = -1;
/* TODO: understand how this changes for v50
ui->main.mode = ui_sidebar_mode::Default;
*/
}
if (selection_rect)

@ -922,11 +922,13 @@ static bool detachItem(MapExtras::MapCache &mc, df::item *item)
case general_ref_type::UNIT_HOLDER:
if (auto unit = ref->getUnit())
{
/* TODO: understand how this changes for v50
// Unit view sidebar holds inventory item pointers
if (ui->main.mode == ui_sidebar_mode::ViewUnits &&
(!ui_selected_unit ||
vector_get(world->units.active, *ui_selected_unit) == unit))
return false;
*/
for (int i = unit->inventory.size()-1; i >= 0; i--)
{