rename globals according to structures update

develop
Myk Taylor 2023-01-05 17:11:01 -08:00
parent a5b11065db
commit 5e5775f5e3
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
86 changed files with 552 additions and 551 deletions

@ -65,8 +65,8 @@ using namespace std;
using namespace DFHack; using namespace DFHack;
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "df/world.h" #include "df/world.h"
#include "df/world_data.h" #include "df/world_data.h"
#include "df/interfacest.h" #include "df/interfacest.h"
@ -1307,7 +1307,7 @@ bool Core::loadScriptFile(color_ostream &out, string fname, bool silent)
static void run_dfhack_init(color_ostream &out, Core *core) static void run_dfhack_init(color_ostream &out, Core *core)
{ {
CoreSuspender lock; CoreSuspender lock;
if (!df::global::world || !df::global::ui || !df::global::gview) if (!df::global::world || !df::global::plotinfo || !df::global::gview)
{ {
out.printerr("Key globals are missing, skipping loading dfhack.init.\n"); out.printerr("Key globals are missing, skipping loading dfhack.init.\n");
return; return;
@ -1712,10 +1712,10 @@ bool Core::Init()
if (!listen.get()) if (!listen.get())
cerr << "TCP listen failed.\n"; cerr << "TCP listen failed.\n";
if (df::global::ui_sidebar_menus) if (df::global::game)
{ {
vector<string> args; vector<string> args;
const string & raw = df::global::ui_sidebar_menus->command_line.original; const string & raw = df::global::game->command_line.original;
size_t offset = 0; size_t offset = 0;
while (offset < raw.size()) while (offset < raw.size())
{ {
@ -1879,7 +1879,7 @@ void Core::doUpdate(color_ostream &out)
strict_virtual_cast<df::viewscreen_savegamest>(screen); strict_virtual_cast<df::viewscreen_savegamest>(screen);
// save data (do this before updating last_world_data_ptr and triggering unload events) // save data (do this before updating last_world_data_ptr and triggering unload events)
if ((df::global::ui->main.autosave_request && !d->last_autosave_request) || if ((df::global::plotinfo->main.autosave_request && !d->last_autosave_request) ||
(is_load_save && !d->was_load_save && strict_virtual_cast<df::viewscreen_savegamest>(screen))) (is_load_save && !d->was_load_save && strict_virtual_cast<df::viewscreen_savegamest>(screen)))
{ {
doSaveData(out); doSaveData(out);
@ -1941,7 +1941,7 @@ void Core::doUpdate(color_ostream &out)
// Execute per-frame handlers // Execute per-frame handlers
onUpdate(out); onUpdate(out);
d->last_autosave_request = df::global::ui->main.autosave_request; d->last_autosave_request = df::global::plotinfo->main.autosave_request;
d->was_load_save = is_load_save; d->was_load_save = is_load_save;
out << std::flush; out << std::flush;
@ -2288,14 +2288,14 @@ bool Core::ncurses_wgetch(int in, int & out)
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
int idx = in - KEY_F(1); int idx = in - KEY_F(1);
// FIXME: copypasta, push into a method! // FIXME: copypasta, push into a method!
if(df::global::ui && df::global::gview) if(df::global::plotinfo && df::global::gview)
{ {
df::viewscreen * ws = Gui::getCurViewscreen(); df::viewscreen * ws = Gui::getCurViewscreen();
if (strict_virtual_cast<df::viewscreen_dwarfmodest>(ws) && if (strict_virtual_cast<df::viewscreen_dwarfmodest>(ws) &&
df::global::ui->main.mode != ui_sidebar_mode::Hotkeys && df::global::plotinfo->main.mode != ui_sidebar_mode::Hotkeys &&
df::global::ui->main.hotkeys[idx].cmd == df::ui_hotkey::T_cmd::None) df::global::plotinfo->main.hotkeys[idx].cmd == df::ui_hotkey::T_cmd::None)
{ {
setHotkeyCmd(df::global::ui->main.hotkeys[idx].name); setHotkeyCmd(df::global::plotinfo->main.hotkeys[idx].name);
return false; return false;
} }
else else
@ -2422,7 +2422,7 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
bool Core::SelectHotkey(int sym, int modifiers) bool Core::SelectHotkey(int sym, int modifiers)
{ {
// Find the topmost viewscreen // Find the topmost viewscreen
if (!df::global::gview || !df::global::ui) if (!df::global::gview || !df::global::plotinfo)
return false; return false;
df::viewscreen *screen = &df::global::gview->view; df::viewscreen *screen = &df::global::gview->view;
@ -2477,10 +2477,10 @@ bool Core::SelectHotkey(int sym, int modifiers)
idx += 8; idx += 8;
if (strict_virtual_cast<df::viewscreen_dwarfmodest>(screen) && if (strict_virtual_cast<df::viewscreen_dwarfmodest>(screen) &&
df::global::ui->main.mode != ui_sidebar_mode::Hotkeys && df::global::plotinfo->main.mode != ui_sidebar_mode::Hotkeys &&
df::global::ui->main.hotkeys[idx].cmd == df::ui_hotkey::T_cmd::None) df::global::plotinfo->main.hotkeys[idx].cmd == df::ui_hotkey::T_cmd::None)
{ {
cmd = df::global::ui->main.hotkeys[idx].name; cmd = df::global::plotinfo->main.hotkeys[idx].name;
} }
*/ */
} }

@ -6,7 +6,7 @@
#include "df/world.h" #include "df/world.h"
#include "df/world_data.h" #include "df/world_data.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "DataIdentity.h" #include "DataIdentity.h"

@ -59,8 +59,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "LuaTools.h" #include "LuaTools.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_advmode.h" #include "df/adventurest.h"
#include "df/world.h" #include "df/world.h"
#include "df/world_data.h" #include "df/world_data.h"
#include "df/unit.h" #include "df/unit.h"
@ -375,11 +375,11 @@ static command_result GetDFVersion(color_ostream &stream,
static command_result GetWorldInfo(color_ostream &stream, static command_result GetWorldInfo(color_ostream &stream,
const EmptyMessage *, GetWorldInfoOut *out) const EmptyMessage *, GetWorldInfoOut *out)
{ {
using df::global::ui; using df::global::plotinfo;
using df::global::ui_advmode; using df::global::adventure;
using df::global::world; using df::global::world;
if (!ui || !world || !Core::getInstance().isWorldLoaded()) if (!plotinfo || !world || !Core::getInstance().isWorldLoaded())
return CR_NOT_FOUND; return CR_NOT_FOUND;
df::game_type gt = game_type::DWARF_MAIN; df::game_type gt = game_type::DWARF_MAIN;
@ -397,10 +397,10 @@ static command_result GetWorldInfo(color_ostream &stream,
case game_type::DWARF_RECLAIM: case game_type::DWARF_RECLAIM:
case game_type::DWARF_UNRETIRE: case game_type::DWARF_UNRETIRE:
out->set_mode(GetWorldInfoOut::MODE_DWARF); out->set_mode(GetWorldInfoOut::MODE_DWARF);
out->set_civ_id(ui->civ_id); out->set_civ_id(plotinfo->civ_id);
out->set_site_id(ui->site_id); out->set_site_id(plotinfo->site_id);
out->set_group_id(ui->group_id); out->set_group_id(plotinfo->group_id);
out->set_race_id(ui->race_id); out->set_race_id(plotinfo->race_id);
break; break;
case game_type::ADVENTURE_MAIN: case game_type::ADVENTURE_MAIN:
@ -410,10 +410,10 @@ static command_result GetWorldInfo(color_ostream &stream,
if (auto unit = vector_get(world->units.active, 0)) if (auto unit = vector_get(world->units.active, 0))
out->set_player_unit_id(unit->id); out->set_player_unit_id(unit->id);
if (!ui_advmode) if (!adventure)
break; break;
if (auto nemesis = vector_get(world->nemesis.all, ui_advmode->player_id)) if (auto nemesis = vector_get(world->nemesis.all, adventure->player_id))
{ {
if (nemesis->figure) if (nemesis->figure)
out->set_player_histfig_id(nemesis->figure->id); out->set_player_histfig_id(nemesis->figure->id);
@ -613,7 +613,7 @@ static command_result ListUnits(color_ostream &stream,
static command_result ListSquads(color_ostream &stream, static command_result ListSquads(color_ostream &stream,
const ListSquadsIn *in, ListSquadsOut *out) const ListSquadsIn *in, ListSquadsOut *out)
{ {
auto entity = df::historical_entity::find(df::global::ui->group_id); auto entity = df::historical_entity::find(df::global::plotinfo->group_id);
if (!entity) if (!entity)
return CR_NOT_FOUND; return CR_NOT_FOUND;

@ -42,13 +42,13 @@ class DebugCategory;
/*! /*!
* \brief Container holding all registered runtime debug categories * \brief Container holding all registered runtime debug categories
* Singleton DebugManager is a minor extension to std::vector that allows signal * Singleton DebugManager is a minor extension to std::vector that allows signal
* callbacks to be attached from ui code that manages. * callbacks to be attached from plotinfo code that manages.
* *
* To avoid parallel plugin unload causing issues access to DebugManager must be * To avoid parallel plugin unload causing issues access to DebugManager must be
* protected by mutex. The access mutex will be taken when * protected by mutex. The access mutex will be taken when
* DFHack::DebugCategory::~DebugCategory performs unregister calls to * DFHack::DebugCategory::~DebugCategory performs unregister calls to
* DFHack::DebugManager. The mutex will protect from memory disappearing while * DFHack::DebugManager. The mutex will protect from memory disappearing while
* ui code is accessing or changing the runtime state. * plotinfo code is accessing or changing the runtime state.
* *
* Signal emitting happens from a locked contexts. Taking the * Signal emitting happens from a locked contexts. Taking the
* DFHack::DebugManager::access_mutex_ in a signal callback will results to a * DFHack::DebugManager::access_mutex_ in a signal callback will results to a

@ -46,7 +46,7 @@ namespace DFHack
CR_NOT_IMPLEMENTED = -1, // Command not implemented, or plugin not loaded CR_NOT_IMPLEMENTED = -1, // Command not implemented, or plugin not loaded
CR_OK = 0, // Success CR_OK = 0, // Success
CR_FAILURE = 1, // Failure CR_FAILURE = 1, // Failure
CR_WRONG_USAGE = 2, // Wrong arguments or ui state CR_WRONG_USAGE = 2, // Wrong arguments or plotinfo state
CR_NOT_FOUND = 3 // Target object not found (for RPC mainly) CR_NOT_FOUND = 3 // Target object not found (for RPC mainly)
}; };

@ -33,7 +33,7 @@ distribution.
#include "DataDefs.h" #include "DataDefs.h"
#include "df/init.h" #include "df/init.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/announcement_type.h" #include "df/announcement_type.h"
#include "df/announcement_flags.h" #include "df/announcement_flags.h"
#include "df/report_init.h" #include "df/report_init.h"

@ -75,7 +75,7 @@ DFHACK_EXPORT void clearLimits();
DFHACK_EXPORT std::size_t size(); DFHACK_EXPORT std::size_t size();
// Finds the index of a kitchen exclusion in ui.kitchen.exc_types. Returns -1 if not found. // Finds the index of a kitchen exclusion in plotinfo.kitchen.exc_types. Returns -1 if not found.
DFHACK_EXPORT int findExclusion(df::kitchen_exc_type type, DFHACK_EXPORT int findExclusion(df::kitchen_exc_type type,
df::item_type item_type, int16_t item_subtype, df::item_type item_type, int16_t item_subtype,
int16_t mat_type, int32_t mat_index); int16_t mat_type, int32_t mat_index);

@ -81,14 +81,14 @@ using namespace DFHack;
#include "df/job_item.h" #include "df/job_item.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/tile_occupancy.h" #include "df/tile_occupancy.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_look_list.h" #include "df/ui_look_list.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
#include "df/world.h" #include "df/world.h"
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
using df::global::world; using df::global::world;
using df::global::d_init; using df::global::d_init;
using df::global::building_next_id; using df::global::building_next_id;
@ -425,7 +425,7 @@ df::building *Buildings::allocInstance(df::coord pos, df::building_type type, in
bld->y1 = bld->y2 = bld->centery = pos.y; bld->y1 = bld->y2 = bld->centery = pos.y;
bld->z = pos.z; bld->z = pos.z;
bld->race = ui->race_id; bld->race = plotinfo->race_id;
if (subtype != -1) if (subtype != -1)
bld->setSubtype(subtype); bld->setSubtype(subtype);
@ -989,7 +989,7 @@ static void linkRooms(df::building *bld)
} }
if (changed) if (changed)
df::global::ui->equipment.update.bits.buildings = true; df::global::plotinfo->equipment.update.bits.buildings = true;
*/ */
} }
@ -1219,7 +1219,7 @@ bool Buildings::constructWithFilters(df::building *bld, std::vector<df::job_item
/* The game picks up explicitly listed items in reverse /* The game picks up explicitly listed items in reverse
* order, but processes filters straight. This reverses * order, but processes filters straight. This reverses
* the order of filters so as to produce the same final * the order of filters so as to produce the same final
* contained_items ordering as the normal ui way. */ * contained_items ordering as the normal plotinfo way. */
vector_insert_at(job->job_items, 0, items[i]); vector_insert_at(job->job_items, 0, items[i]);
if (items[i]->item_type == item_type::BOULDER) if (items[i]->item_type == item_type::BOULDER)
@ -1238,7 +1238,7 @@ bool Buildings::constructWithFilters(df::building *bld, std::vector<df::job_item
bool Buildings::deconstruct(df::building *bld) bool Buildings::deconstruct(df::building *bld)
{ {
using df::global::ui; using df::global::plotinfo;
using df::global::world; using df::global::world;
using df::global::ui_look_list; using df::global::ui_look_list;
@ -1263,7 +1263,7 @@ bool Buildings::deconstruct(df::building *bld)
// Assume: no parties. // Assume: no parties.
unlinkRooms(bld); unlinkRooms(bld);
// Assume: not unit destroy target // Assume: not unit destroy target
vector_erase_at(ui->tax_collection.rooms, linear_index(ui->tax_collection.rooms, bld->id)); vector_erase_at(plotinfo->tax_collection.rooms, linear_index(plotinfo->tax_collection.rooms, bld->id));
// Assume: not used in punishment // Assume: not used in punishment
// Assume: not used in non-own jobs // Assume: not used in non-own jobs
// Assume: does not affect pathfinding // Assume: does not affect pathfinding

@ -42,14 +42,14 @@ using namespace std;
#include "df/block_burrow_link.h" #include "df/block_burrow_link.h"
#include "df/burrow.h" #include "df/burrow.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
df::burrow *Burrows::findByName(std::string name) df::burrow *Burrows::findByName(std::string name)
{ {
@ -77,11 +77,11 @@ void Burrows::clearUnits(df::burrow *burrow)
burrow->units.clear(); burrow->units.clear();
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
// Sync ui if active // Sync plotinfo if active
if (ui && ui->main.mode == ui_sidebar_mode::Burrows && if (plotinfo && plotinfo->main.mode == ui_sidebar_mode::Burrows &&
ui->burrows.in_add_units_mode && ui->burrows.sel_id == burrow->id) plotinfo->burrows.in_add_units_mode && plotinfo->burrows.sel_id == burrow->id)
{ {
auto &sel = ui->burrows.sel_units; auto &sel = plotinfo->burrows.sel_units;
for (size_t i = 0; i < sel.size(); i++) for (size_t i = 0; i < sel.size(); i++)
sel[i] = false; sel[i] = false;
@ -99,7 +99,7 @@ bool Burrows::isAssignedUnit(df::burrow *burrow, df::unit *unit)
void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable) void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable)
{ {
using df::global::ui; using df::global::plotinfo;
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
CHECK_NULL_POINTER(burrow); CHECK_NULL_POINTER(burrow);
@ -116,13 +116,13 @@ void Burrows::setAssignedUnit(df::burrow *burrow, df::unit *unit, bool enable)
} }
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
// Sync ui if active // Sync plotinfo if active
if (ui && ui->main.mode == ui_sidebar_mode::Burrows && if (plotinfo && plotinfo->main.mode == ui_sidebar_mode::Burrows &&
ui->burrows.in_add_units_mode && ui->burrows.sel_id == burrow->id) plotinfo->burrows.in_add_units_mode && plotinfo->burrows.sel_id == burrow->id)
{ {
int idx = linear_index(ui->burrows.list_units, unit); int idx = linear_index(plotinfo->burrows.list_units, unit);
if (idx >= 0) if (idx >= 0)
ui->burrows.sel_units[idx] = enable; plotinfo->burrows.sel_units[idx] = enable;
} }
*/ */
} }

@ -27,7 +27,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/job_list_link.h" #include "df/job_list_link.h"
#include "df/report.h" #include "df/report.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_flags1.h" #include "df/unit_flags1.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
@ -297,14 +297,14 @@ void DFHack::EventManager::onStateChange(color_ostream& out, state_change_event
return; return;
if (!df::global::job_next_id) if (!df::global::job_next_id)
return; return;
if (!df::global::ui) if (!df::global::plotinfo)
return; return;
if (!df::global::world) if (!df::global::world)
return; return;
nextItem = *df::global::item_next_id; nextItem = *df::global::item_next_id;
nextBuilding = *df::global::building_next_id; nextBuilding = *df::global::building_next_id;
nextInvasion = df::global::ui->invasions.next_id; nextInvasion = df::global::plotinfo->invasions.next_id;
lastJobId = -1 + *df::global::job_next_id; lastJobId = -1 + *df::global::job_next_id;
constructions.clear(); constructions.clear();
@ -807,13 +807,13 @@ static void manageSyndromeEvent(color_ostream& out) {
} }
static void manageInvasionEvent(color_ostream& out) { static void manageInvasionEvent(color_ostream& out) {
if (!df::global::ui) if (!df::global::plotinfo)
return; return;
multimap<Plugin*,EventHandler> copy(handlers[EventType::INVASION].begin(), handlers[EventType::INVASION].end()); multimap<Plugin*,EventHandler> copy(handlers[EventType::INVASION].begin(), handlers[EventType::INVASION].end());
if ( df::global::ui->invasions.next_id <= nextInvasion ) if ( df::global::plotinfo->invasions.next_id <= nextInvasion )
return; return;
nextInvasion = df::global::ui->invasions.next_id; nextInvasion = df::global::plotinfo->invasions.next_id;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;

@ -74,10 +74,10 @@ using namespace DFHack;
#include "df/report_zoom_type.h" #include "df/report_zoom_type.h"
#include "df/route_stockpile_link.h" #include "df/route_stockpile_link.h"
#include "df/stop_depart_condition.h" #include "df/stop_depart_condition.h"
#include "df/ui_advmode.h" #include "df/adventurest.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/ui_look_list.h" #include "df/ui_look_list.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "df/ui_unit_view_mode.h" #include "df/ui_unit_view_mode.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
@ -101,9 +101,9 @@ using df::global::gps;
using df::global::gview; using df::global::gview;
using df::global::init; using df::global::init;
using df::global::selection_rect; using df::global::selection_rect;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_menu_width; using df::global::ui_menu_width;
using df::global::ui_sidebar_menus; using df::global::game;
using df::global::world; using df::global::world;
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
@ -158,9 +158,9 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
using df::global::ui_building_assign_items; using df::global::ui_building_assign_items;
using df::global::ui_building_in_assign; using df::global::ui_building_in_assign;
focus += "/" + enum_item_key(ui->main.mode); focus += "/" + enum_item_key(plotinfo->main.mode);
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case QueryBuilding: case QueryBuilding:
if (df::building *selected = world->selected_building) if (df::building *selected = world->selected_building)
@ -304,38 +304,38 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
break; break;
case Burrows: case Burrows:
if (ui->burrows.in_confirm_delete) if (plotinfo->burrows.in_confirm_delete)
focus += "/ConfirmDelete"; focus += "/ConfirmDelete";
else if (ui->burrows.in_add_units_mode) else if (plotinfo->burrows.in_add_units_mode)
focus += "/AddUnits"; focus += "/AddUnits";
else if (ui->burrows.in_edit_name_mode) else if (plotinfo->burrows.in_edit_name_mode)
focus += "/EditName"; focus += "/EditName";
else if (ui->burrows.in_define_mode) else if (plotinfo->burrows.in_define_mode)
focus += "/Define"; focus += "/Define";
else else
focus += "/List"; focus += "/List";
break; break;
case Hauling: case Hauling:
if (ui->hauling.in_assign_vehicle) if (plotinfo->hauling.in_assign_vehicle)
{ {
auto vehicle = vector_get(ui->hauling.vehicles, ui->hauling.cursor_vehicle); auto vehicle = vector_get(plotinfo->hauling.vehicles, plotinfo->hauling.cursor_vehicle);
focus += "/AssignVehicle/" + std::string(vehicle ? "Some" : "None"); focus += "/AssignVehicle/" + std::string(vehicle ? "Some" : "None");
} }
else else
{ {
int idx = ui->hauling.cursor_top; int idx = plotinfo->hauling.cursor_top;
auto route = vector_get(ui->hauling.view_routes, idx); auto route = vector_get(plotinfo->hauling.view_routes, idx);
auto stop = vector_get(ui->hauling.view_stops, idx); auto stop = vector_get(plotinfo->hauling.view_stops, idx);
std::string tag = stop ? "Stop" : (route ? "Route" : "None"); std::string tag = stop ? "Stop" : (route ? "Route" : "None");
if (ui->hauling.in_name) if (plotinfo->hauling.in_name)
focus += "/Rename/" + tag; focus += "/Rename/" + tag;
else if (ui->hauling.in_stop) else if (plotinfo->hauling.in_stop)
{ {
int sidx = ui->hauling.cursor_stop; int sidx = plotinfo->hauling.cursor_stop;
auto cond = vector_get(ui->hauling.stop_conditions, sidx); auto cond = vector_get(plotinfo->hauling.stop_conditions, sidx);
auto link = vector_get(ui->hauling.stop_links, sidx); auto link = vector_get(plotinfo->hauling.stop_links, sidx);
focus += "/DefineStop"; focus += "/DefineStop";
@ -364,12 +364,12 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
DEFINE_GET_FOCUS_STRING_HANDLER(dungeonmode) DEFINE_GET_FOCUS_STRING_HANDLER(dungeonmode)
{ {
using df::global::ui_advmode; using df::global::adventure;
if (!ui_advmode) if (!adventure)
return; return;
focus += "/" + enum_item_key(ui_advmode->menu); focus += "/" + enum_item_key(adventure->menu);
} }
DEFINE_GET_FOCUS_STRING_HANDLER(unitlist) DEFINE_GET_FOCUS_STRING_HANDLER(unitlist)
@ -675,7 +675,7 @@ bool Gui::workshop_job_hotkey(df::viewscreen *top)
using df::global::ui_workshop_in_add; using df::global::ui_workshop_in_add;
using df::global::ui_workshop_job_cursor; using df::global::ui_workshop_job_cursor;
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case QueryBuilding: case QueryBuilding:
{ {
if (!ui_workshop_job_cursor) // allow missing if (!ui_workshop_job_cursor) // allow missing
@ -712,7 +712,7 @@ bool Gui::build_selector_hotkey(df::viewscreen *top)
using namespace ui_sidebar_mode; using namespace ui_sidebar_mode;
using df::global::ui_build_selector; using df::global::ui_build_selector;
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case Build: case Build:
{ {
if (!ui_build_selector) // allow missing if (!ui_build_selector) // allow missing
@ -739,7 +739,7 @@ bool Gui::view_unit_hotkey(df::viewscreen *top)
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
using df::global::ui_selected_unit; using df::global::ui_selected_unit;
if (ui->main.mode != ui_sidebar_mode::ViewUnits) if (plotinfo->main.mode != ui_sidebar_mode::ViewUnits)
return false; return false;
if (!ui_selected_unit) // allow missing if (!ui_selected_unit) // allow missing
return false; return false;
@ -1017,19 +1017,19 @@ df::unit *Gui::getAnyUnit(df::viewscreen *top)
if (!Gui::dwarfmode_hotkey(top)) if (!Gui::dwarfmode_hotkey(top))
return NULL; return NULL;
if (!ui) if (!plotinfo)
return NULL; return NULL;
// general assigning units in building, i.e. (q)uery cage -> (a)ssign // general assigning units in building, i.e. (q)uery cage -> (a)ssign
if (ui_building_in_assign && *ui_building_in_assign if (ui_building_in_assign && *ui_building_in_assign
&& ui_building_assign_units && ui_building_item_cursor && ui_building_assign_units && ui_building_item_cursor
&& ui->main.mode != Zones) // dont show for (i) zone && plotinfo->main.mode != Zones) // dont show for (i) zone
return vector_get(*ui_building_assign_units, *ui_building_item_cursor); return vector_get(*ui_building_assign_units, *ui_building_item_cursor);
if (ui->follow_unit != -1) if (plotinfo->follow_unit != -1)
return df::unit::find(ui->follow_unit); return df::unit::find(plotinfo->follow_unit);
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case ViewUnits: case ViewUnits:
{ {
if (!ui_selected_unit || !world) if (!ui_selected_unit || !world)
@ -1047,8 +1047,8 @@ df::unit *Gui::getAnyUnit(df::viewscreen *top)
} }
case Burrows: case Burrows:
{ {
if (ui->burrows.in_add_units_mode) if (plotinfo->burrows.in_add_units_mode)
return vector_get(ui->burrows.list_units, ui->burrows.unit_cursor_pos); return vector_get(plotinfo->burrows.list_units, plotinfo->burrows.unit_cursor_pos);
return NULL; return NULL;
} }
@ -1196,16 +1196,16 @@ df::item *Gui::getAnyItem(df::viewscreen *top)
if (!Gui::dwarfmode_hotkey(top)) if (!Gui::dwarfmode_hotkey(top))
return NULL; return NULL;
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case ViewUnits: case ViewUnits:
{ {
if (!ui_unit_view_mode || !ui_look_cursor || !ui_sidebar_menus) if (!ui_unit_view_mode || !ui_look_cursor || !game)
return NULL; return NULL;
if (ui_unit_view_mode->value != df::ui_unit_view_mode::Inventory) if (ui_unit_view_mode->value != df::ui_unit_view_mode::Inventory)
return NULL; return NULL;
auto inv_item = vector_get(ui_sidebar_menus->unit.inv_items, *ui_look_cursor); auto inv_item = vector_get(game->unit.inv_items, *ui_look_cursor);
return inv_item ? inv_item->item : NULL; return inv_item ? inv_item->item : NULL;
} }
case LookAround: case LookAround:
@ -1271,7 +1271,7 @@ df::building *Gui::getAnyBuilding(df::viewscreen *top)
if (!Gui::dwarfmode_hotkey(top)) if (!Gui::dwarfmode_hotkey(top))
return NULL; return NULL;
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case LookAround: case LookAround:
{ {
if (!ui_look_list || !ui_look_cursor) if (!ui_look_list || !ui_look_cursor)
@ -1293,8 +1293,8 @@ df::building *Gui::getAnyBuilding(df::viewscreen *top)
case ZonesPitInfo: case ZonesPitInfo:
case ZonesHospitalInfo: case ZonesHospitalInfo:
{ {
if (ui_sidebar_menus) if (game)
return ui_sidebar_menus->zone.selected; return game->zone.selected;
return NULL; return NULL;
} }
default: default:
@ -1327,11 +1327,11 @@ df::plant *Gui::getAnyPlant(df::viewscreen *top)
if (Gui::dwarfmode_hotkey(top)) if (Gui::dwarfmode_hotkey(top))
{ {
if (!cursor || !ui || !world) if (!cursor || !plotinfo || !world)
return nullptr; return nullptr;
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
if (ui->main.mode == ui_sidebar_mode::LookAround) if (plotinfo->main.mode == ui_sidebar_mode::LookAround)
{ {
return Maps::getPlantAtTile(cursor->x, cursor->y, cursor->z); return Maps::getPlantAtTile(cursor->x, cursor->y, cursor->z);
} }
@ -1949,12 +1949,12 @@ void Gui::resetDwarfmodeView(bool pause)
{ {
using df::global::cursor; using df::global::cursor;
if (ui) if (plotinfo)
{ {
ui->follow_unit = -1; plotinfo->follow_unit = -1;
ui->follow_item = -1; plotinfo->follow_item = -1;
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
ui->main.mode = ui_sidebar_mode::Default; plotinfo->main.mode = ui_sidebar_mode::Default;
*/ */
} }
@ -2011,8 +2011,8 @@ bool Gui::revealInDwarfmodeMap(int32_t x, int32_t y, int32_t z, bool center)
*window_x = clip_range(new_win_x, 0, (world->map.x_count - w)); *window_x = clip_range(new_win_x, 0, (world->map.x_count - w));
*window_y = clip_range(new_win_y, 0, (world->map.y_count - h)); *window_y = clip_range(new_win_y, 0, (world->map.y_count - h));
*window_z = clip_range(new_win_z, 0, (world->map.z_count - 1)); *window_z = clip_range(new_win_z, 0, (world->map.z_count - 1));
ui_sidebar_menus->minimap.need_render = true; game->minimap.need_render = true;
ui_sidebar_menus->minimap.need_scan = true; game->minimap.need_scan = true;
return true; return true;
} }
@ -2058,10 +2058,10 @@ bool Gui::refreshSidebar()
bool Gui::inRenameBuilding() bool Gui::inRenameBuilding()
{ {
if (!ui_sidebar_menus) if (!game)
return false; return false;
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
return ui_sidebar_menus->barracks.in_rename; return game->barracks.in_rename;
*/ */
return false; return false;
} }

@ -87,7 +87,7 @@ using namespace std;
#include "df/reaction_product_itemst.h" #include "df/reaction_product_itemst.h"
#include "df/tool_uses.h" #include "df/tool_uses.h"
#include "df/trapcomp_flags.h" #include "df/trapcomp_flags.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/vehicle.h" #include "df/vehicle.h"
@ -100,7 +100,7 @@ using namespace std;
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_selected_unit; using df::global::ui_selected_unit;
using df::global::proj_next_id; using df::global::proj_next_id;
@ -924,7 +924,7 @@ static bool detachItem(MapExtras::MapCache &mc, df::item *item)
{ {
/* TODO: understand how this changes for v50 /* TODO: understand how this changes for v50
// Unit view sidebar holds inventory item pointers // Unit view sidebar holds inventory item pointers
if (ui->main.mode == ui_sidebar_mode::ViewUnits && if (plotinfo->main.mode == ui_sidebar_mode::ViewUnits &&
(!ui_selected_unit || (!ui_selected_unit ||
vector_get(world->units.active, *ui_selected_unit) == unit)) vector_get(world->units.active, *ui_selected_unit) == unit))
return false; return false;
@ -1534,7 +1534,7 @@ int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t
df::enums::game_type::game_type type = *df::global::gametype; df::enums::game_type::game_type type = *df::global::gametype;
prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE, prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
0, df::historical_entity::find(unit->civ_id), 0, df::historical_entity::find(unit->civ_id),
((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::ui->site_id) : NULL, ((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::plotinfo->site_id) : NULL,
NULL); NULL);
if ( out_items.size() != 1 ) if ( out_items.size() != 1 )
return -1; return -1;
@ -1643,9 +1643,9 @@ bool Items::isRouteVehicle(df::item *item)
bool Items::isSquadEquipment(df::item *item) bool Items::isSquadEquipment(df::item *item)
{ {
CHECK_NULL_POINTER(item); CHECK_NULL_POINTER(item);
if (!ui) if (!plotinfo)
return false; return false;
auto &vec = ui->equipment.items_assigned[item->getType()]; auto &vec = plotinfo->equipment.items_assigned[item->getType()];
return binsearch_index(vec, &df::item::id, item->id) >= 0; return binsearch_index(vec, &df::item::id, item->id) >= 0;
} }

@ -43,7 +43,7 @@ using namespace std;
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/building.h" #include "df/building.h"
#include "df/job.h" #include "df/job.h"

@ -20,13 +20,13 @@ using namespace DFHack;
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/item_type.h" #include "df/item_type.h"
#include "df/plant_raw.h" #include "df/plant_raw.h"
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
// Special values used by "seedwatch" plugin to store seed limits // Special values used by "seedwatch" plugin to store seed limits
const df::enums::item_type::item_type SEEDLIMIT_ITEMTYPE = df::enums::item_type::BAR; const df::enums::item_type::item_type SEEDLIMIT_ITEMTYPE = df::enums::item_type::BAR;
@ -41,12 +41,12 @@ void Kitchen::debug_print(color_ostream &out)
{ {
out.print("%2zu: IT:%2i IS:%i MT:%3i MI:%2i ET:%i %s\n", out.print("%2zu: IT:%2i IS:%i MT:%3i MI:%2i ET:%i %s\n",
i, i,
ui->kitchen.item_types[i], plotinfo->kitchen.item_types[i],
ui->kitchen.item_subtypes[i], plotinfo->kitchen.item_subtypes[i],
ui->kitchen.mat_types[i], plotinfo->kitchen.mat_types[i],
ui->kitchen.mat_indices[i], plotinfo->kitchen.mat_indices[i],
ui->kitchen.exc_types[i], plotinfo->kitchen.exc_types[i],
(ui->kitchen.mat_types[i] >= 419 && ui->kitchen.mat_types[i] <= 618) ? world->raws.plants.all[ui->kitchen.mat_indices[i]]->id.c_str() : "n/a" (plotinfo->kitchen.mat_types[i] >= 419 && plotinfo->kitchen.mat_types[i] <= 618) ? world->raws.plants.all[plotinfo->kitchen.mat_indices[i]]->id.c_str() : "n/a"
); );
} }
out.print("\n"); out.print("\n");
@ -83,11 +83,11 @@ void Kitchen::fillWatchMap(std::map<int32_t, int16_t>& watchMap)
watchMap.clear(); watchMap.clear();
for (std::size_t i = 0; i < size(); ++i) for (std::size_t i = 0; i < size(); ++i)
{ {
if (ui->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMTYPE && if (plotinfo->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMTYPE &&
ui->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE && plotinfo->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE &&
ui->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE) plotinfo->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE)
{ {
watchMap[ui->kitchen.mat_indices[i]] = ui->kitchen.mat_types[i]; watchMap[plotinfo->kitchen.mat_indices[i]] = plotinfo->kitchen.mat_types[i];
} }
} }
} }
@ -96,10 +96,10 @@ int Kitchen::findLimit(int32_t plant_id)
{ {
for (size_t i = 0; i < size(); ++i) for (size_t i = 0; i < size(); ++i)
{ {
if (ui->kitchen.item_types[i] == SEEDLIMIT_ITEMTYPE && if (plotinfo->kitchen.item_types[i] == SEEDLIMIT_ITEMTYPE &&
ui->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE && plotinfo->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE &&
ui->kitchen.mat_indices[i] == plant_id && plotinfo->kitchen.mat_indices[i] == plant_id &&
ui->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE) plotinfo->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE)
{ {
return int(i); return int(i);
} }
@ -113,11 +113,11 @@ bool Kitchen::removeLimit(int32_t plant_id)
if (i < 0) if (i < 0)
return false; return false;
ui->kitchen.item_types.erase(ui->kitchen.item_types.begin() + i); plotinfo->kitchen.item_types.erase(plotinfo->kitchen.item_types.begin() + i);
ui->kitchen.item_subtypes.erase(ui->kitchen.item_subtypes.begin() + i); plotinfo->kitchen.item_subtypes.erase(plotinfo->kitchen.item_subtypes.begin() + i);
ui->kitchen.mat_types.erase(ui->kitchen.mat_types.begin() + i); plotinfo->kitchen.mat_types.erase(plotinfo->kitchen.mat_types.begin() + i);
ui->kitchen.mat_indices.erase(ui->kitchen.mat_indices.begin() + i); plotinfo->kitchen.mat_indices.erase(plotinfo->kitchen.mat_indices.begin() + i);
ui->kitchen.exc_types.erase(ui->kitchen.exc_types.begin() + i); plotinfo->kitchen.exc_types.erase(plotinfo->kitchen.exc_types.begin() + i);
return true; return true;
} }
@ -129,15 +129,15 @@ bool Kitchen::setLimit(int32_t plant_id, int16_t limit)
int i = findLimit(plant_id); int i = findLimit(plant_id);
if (i < 0) if (i < 0)
{ {
ui->kitchen.item_types.push_back(SEEDLIMIT_ITEMTYPE); plotinfo->kitchen.item_types.push_back(SEEDLIMIT_ITEMTYPE);
ui->kitchen.item_subtypes.push_back(SEEDLIMIT_ITEMSUBTYPE); plotinfo->kitchen.item_subtypes.push_back(SEEDLIMIT_ITEMSUBTYPE);
ui->kitchen.mat_types.push_back(limit); plotinfo->kitchen.mat_types.push_back(limit);
ui->kitchen.mat_indices.push_back(plant_id); plotinfo->kitchen.mat_indices.push_back(plant_id);
ui->kitchen.exc_types.push_back(SEEDLIMIT_EXCTYPE); plotinfo->kitchen.exc_types.push_back(SEEDLIMIT_EXCTYPE);
} }
else else
{ {
ui->kitchen.mat_types[i] = limit; plotinfo->kitchen.mat_types[i] = limit;
} }
return true; return true;
} }
@ -146,11 +146,11 @@ void Kitchen::clearLimits()
{ {
for (size_t i = 0; i < size(); ++i) for (size_t i = 0; i < size(); ++i)
{ {
if (ui->kitchen.item_types[i] == SEEDLIMIT_ITEMTYPE && if (plotinfo->kitchen.item_types[i] == SEEDLIMIT_ITEMTYPE &&
ui->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE && plotinfo->kitchen.item_subtypes[i] == SEEDLIMIT_ITEMSUBTYPE &&
ui->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE) plotinfo->kitchen.exc_types[i] == SEEDLIMIT_EXCTYPE)
{ {
removeLimit(ui->kitchen.mat_indices[i]); removeLimit(plotinfo->kitchen.mat_indices[i]);
--i; --i;
} }
} }
@ -158,7 +158,7 @@ void Kitchen::clearLimits()
size_t Kitchen::size() size_t Kitchen::size()
{ {
return ui->kitchen.item_types.size(); return plotinfo->kitchen.item_types.size();
} }
int Kitchen::findExclusion(df::kitchen_exc_type type, int Kitchen::findExclusion(df::kitchen_exc_type type,
@ -167,11 +167,11 @@ int Kitchen::findExclusion(df::kitchen_exc_type type,
{ {
for (size_t i = 0; i < size(); i++) for (size_t i = 0; i < size(); i++)
{ {
if (ui->kitchen.item_types[i] == item_type && if (plotinfo->kitchen.item_types[i] == item_type &&
ui->kitchen.item_subtypes[i] == item_subtype && plotinfo->kitchen.item_subtypes[i] == item_subtype &&
ui->kitchen.mat_types[i] == mat_type && plotinfo->kitchen.mat_types[i] == mat_type &&
ui->kitchen.mat_indices[i] == mat_index && plotinfo->kitchen.mat_indices[i] == mat_index &&
ui->kitchen.exc_types[i] == type) plotinfo->kitchen.exc_types[i] == type)
{ {
return int(i); return int(i);
} }
@ -186,11 +186,11 @@ bool Kitchen::addExclusion(df::kitchen_exc_type type,
if (findExclusion(type, item_type, item_subtype, mat_type, mat_index) >= 0) if (findExclusion(type, item_type, item_subtype, mat_type, mat_index) >= 0)
return false; return false;
ui->kitchen.item_types.push_back(item_type); plotinfo->kitchen.item_types.push_back(item_type);
ui->kitchen.item_subtypes.push_back(item_subtype); plotinfo->kitchen.item_subtypes.push_back(item_subtype);
ui->kitchen.mat_types.push_back(mat_type); plotinfo->kitchen.mat_types.push_back(mat_type);
ui->kitchen.mat_indices.push_back(mat_index); plotinfo->kitchen.mat_indices.push_back(mat_index);
ui->kitchen.exc_types.push_back(type); plotinfo->kitchen.exc_types.push_back(type);
return true; return true;
} }
@ -202,10 +202,10 @@ bool Kitchen::removeExclusion(df::kitchen_exc_type type,
if (i < 0) if (i < 0)
return false; return false;
ui->kitchen.item_types.erase(ui->kitchen.item_types.begin() + i); plotinfo->kitchen.item_types.erase(plotinfo->kitchen.item_types.begin() + i);
ui->kitchen.item_subtypes.erase(ui->kitchen.item_subtypes.begin() + i); plotinfo->kitchen.item_subtypes.erase(plotinfo->kitchen.item_subtypes.begin() + i);
ui->kitchen.mat_types.erase(ui->kitchen.mat_types.begin() + i); plotinfo->kitchen.mat_types.erase(plotinfo->kitchen.mat_types.begin() + i);
ui->kitchen.mat_indices.erase(ui->kitchen.mat_indices.begin() + i); plotinfo->kitchen.mat_indices.erase(plotinfo->kitchen.mat_indices.begin() + i);
ui->kitchen.exc_types.erase(ui->kitchen.exc_types.begin() + i); plotinfo->kitchen.exc_types.erase(plotinfo->kitchen.exc_types.begin() + i);
return true; return true;
} }

@ -42,7 +42,7 @@ using namespace std;
#include "MiscUtils.h" #include "MiscUtils.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/item.h" #include "df/item.h"
#include "df/creature_raw.h" #include "df/creature_raw.h"
#include "df/caste_raw.h" #include "df/caste_raw.h"
@ -68,7 +68,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
bool MaterialInfo::decode(df::item *item) bool MaterialInfo::decode(df::item *item)
{ {
@ -516,7 +516,7 @@ void MaterialInfo::getMatchBits(df::job_item_flags2 &ok, df::job_item_flags2 &ma
TEST(fire_safe, material->heat.melting_point > 11000); TEST(fire_safe, material->heat.melting_point > 11000);
TEST(magma_safe, material->heat.melting_point > 12000); TEST(magma_safe, material->heat.melting_point > 12000);
TEST(deep_material, FLAG(inorganic, inorganic_flags::SPECIAL)); TEST(deep_material, FLAG(inorganic, inorganic_flags::SPECIAL));
TEST(non_economic, !inorganic || !(ui && vector_get(ui->economic_stone, index))); TEST(non_economic, !inorganic || !(plotinfo && vector_get(plotinfo->economic_stone, index)));
TEST(plant, plant); TEST(plant, plant);
TEST(silk, MAT_FLAG(SILK)); TEST(silk, MAT_FLAG(SILK));

@ -83,7 +83,7 @@ namespace DFHack {
* Screen painting API. * Screen painting API.
*/ */
// returns ui grid coordinates, even if the game map is scaled differently // returns plotinfo grid coordinates, even if the game map is scaled differently
df::coord2d Screen::getMousePos() df::coord2d Screen::getMousePos()
{ {
if (!gps) if (!gps)

@ -73,7 +73,7 @@ using namespace std;
#include "df/nemesis_record.h" #include "df/nemesis_record.h"
#include "df/squad.h" #include "df/squad.h"
#include "df/tile_occupancy.h" #include "df/tile_occupancy.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/unit_misc_trait.h" #include "df/unit_misc_trait.h"
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
@ -87,7 +87,7 @@ using namespace std;
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
using df::global::gamemode; using df::global::gamemode;
using df::global::gametype; using df::global::gametype;
@ -178,7 +178,7 @@ bool Units::isFortControlled(df::unit *unit)
unit->flags2.bits.resident) unit->flags2.bits.resident)
return false; return false;
return unit->civ_id != -1 && unit->civ_id == ui->civ_id; return unit->civ_id != -1 && unit->civ_id == plotinfo->civ_id;
} }
// check if creature belongs to the player's civilization // check if creature belongs to the player's civilization
@ -186,7 +186,7 @@ bool Units::isFortControlled(df::unit *unit)
bool Units::isOwnCiv(df::unit* unit) bool Units::isOwnCiv(df::unit* unit)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
return unit->civ_id == ui->civ_id; return unit->civ_id == plotinfo->civ_id;
} }
// check if creature belongs to the player's group // check if creature belongs to the player's group
@ -199,7 +199,7 @@ bool Units::isOwnGroup(df::unit* unit)
for (size_t i = 0; i < histfig->entity_links.size(); i++) for (size_t i = 0; i < histfig->entity_links.size(); i++)
{ {
auto link = histfig->entity_links[i]; auto link = histfig->entity_links[i];
if (link->entity_id == ui->group_id && link->getType() == df::histfig_entity_link_type::MEMBER) if (link->entity_id == plotinfo->group_id && link->getType() == df::histfig_entity_link_type::MEMBER)
return true; return true;
} }
return false; return false;
@ -210,7 +210,7 @@ bool Units::isOwnGroup(df::unit* unit)
bool Units::isOwnRace(df::unit* unit) bool Units::isOwnRace(df::unit* unit)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
return unit->race == ui->race_id; return unit->race == plotinfo->race_id;
} }
@ -622,8 +622,8 @@ bool Units::isDwarf(df::unit *unit)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
return unit->race == ui->race_id || return unit->race == plotinfo->race_id ||
unit->enemy.normal_race == ui->race_id; unit->enemy.normal_race == plotinfo->race_id;
} }
bool Units::isAnimal(df::unit* unit) { bool Units::isAnimal(df::unit* unit) {
@ -1301,7 +1301,7 @@ bool Units::setLaborValidity(df::unit_labor labor, bool isValid)
return false; return false;
if (labor == df::unit_labor::NONE) if (labor == df::unit_labor::NONE)
return false; return false;
df::historical_entity *entity = df::historical_entity::find(ui->civ_id); df::historical_entity *entity = df::historical_entity::find(plotinfo->civ_id);
if (!entity || !entity->entity_raw) if (!entity || !entity->entity_raw)
return false; return false;
entity->entity_raw->jobs.permitted_labor[labor] = isValid; entity->entity_raw->jobs.permitted_labor[labor] = isValid;
@ -1704,7 +1704,7 @@ std::string Units::getCasteProfessionName(int race, int casteid, df::profession
if (pid < (df::profession)0 || !is_valid_enum_item(pid)) if (pid < (df::profession)0 || !is_valid_enum_item(pid))
return ""; return "";
int16_t current_race = df::global::ui->race_id; int16_t current_race = df::global::plotinfo->race_id;
if (df::global::gamemode && *df::global::gamemode == df::game_mode::ADVENTURE) if (df::global::gamemode && *df::global::gamemode == df::game_mode::ADVENTURE)
current_race = world->units.active[0]->race; current_race = world->units.active[0]->race;
bool use_race_prefix = (race >= 0 && race != current_race); bool use_race_prefix = (race >= 0 && race != current_race);

@ -0,0 +1 @@
!buildingplan/

@ -24,7 +24,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/job_item.h" #include "df/job_item.h"
#include "df/job_item_ref.h" #include "df/job_item_ref.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/report.h" #include "df/report.h"
#include "df/reaction.h" #include "df/reaction.h"
#include "df/reaction_reagent_itemst.h" #include "df/reaction_reagent_itemst.h"
@ -45,7 +45,7 @@ DFHACK_PLUGIN("add-spatter");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
typedef df::reaction_product_item_improvementst improvement_product; typedef df::reaction_product_item_improvementst improvement_product;

@ -22,7 +22,7 @@
#include "df/plant_tree_tile.h" #include "df/plant_tree_tile.h"
#include "df/plant_raw.h" #include "df/plant_raw.h"
#include "df/tile_dig_designation.h" #include "df/tile_dig_designation.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/world.h" #include "df/world.h"
@ -45,7 +45,7 @@ using namespace df::enums;
#define PLUGIN_VERSION 0.3 #define PLUGIN_VERSION 0.3
DFHACK_PLUGIN("autochop"); DFHACK_PLUGIN("autochop");
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
static int get_log_count(); static int get_log_count();
@ -499,7 +499,7 @@ public:
burrows_column.clear(); burrows_column.clear();
for (df::burrow *burrow : ui->burrows.list) for (df::burrow *burrow : plotinfo->burrows.list)
{ {
string name = burrow->name; string name = burrow->name;
if (name.empty()) if (name.empty())
@ -820,7 +820,7 @@ struct autochop_hook : public df::viewscreen_dwarfmodest
bool isInDesignationMenu() bool isInDesignationMenu()
{ {
using namespace df::enums::ui_sidebar_mode; using namespace df::enums::ui_sidebar_mode;
return (ui->main.mode == DesignateChopTrees); return (plotinfo->main.mode == DesignateChopTrees);
} }
void sendKey(const df::interface_key &key) void sendKey(const df::interface_key &key)

@ -5,7 +5,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/building_type.h" #include "df/building_type.h"
#include "df/building_farmplotst.h" #include "df/building_farmplotst.h"
#include "df/buildings_other_id.h" #include "df/buildings_other_id.h"
@ -30,7 +30,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
static command_result autofarm(color_ostream& out, std::vector<std::string>& parameters); static command_result autofarm(color_ostream& out, std::vector<std::string>& parameters);
@ -348,7 +348,7 @@ static std::unique_ptr<AutoFarm> autofarmInstance;
DFhackCExport command_result plugin_init(color_ostream& out, std::vector <PluginCommand>& commands) DFhackCExport command_result plugin_init(color_ostream& out, std::vector <PluginCommand>& commands)
{ {
if (world && ui) { if (world && plotinfo) {
commands.push_back( commands.push_back(
PluginCommand("autofarm", PluginCommand("autofarm",
"Automatically manage farm crop selection.", "Automatically manage farm crop selection.",

@ -33,7 +33,7 @@ using namespace DFHack;
DFHACK_PLUGIN("autogems"); DFHACK_PLUGIN("autogems");
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
typedef int32_t item_id; typedef int32_t item_id;
@ -242,7 +242,7 @@ struct autogem_hook : public df::viewscreen_dwarfmodest {
bool in_menu() { bool in_menu() {
// Determines whether we're looking at the Workshop Orders screen. // Determines whether we're looking at the Workshop Orders screen.
return ui->main.mode == ui_sidebar_mode::OrdersWorkshop; return plotinfo->main.mode == ui_sidebar_mode::OrdersWorkshop;
} }
bool handleInput(std::set<df::interface_key> *input) { bool handleInput(std::set<df::interface_key> *input) {

@ -12,7 +12,7 @@
// DF data structure definition headers // DF data structure definition headers
#include "DataDefs.h" #include "DataDefs.h"
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/world.h> #include <df/world.h>
#include <df/unit.h> #include <df/unit.h>
#include <df/unit_soul.h> #include <df/unit_soul.h>
@ -32,7 +32,7 @@
#include <df/building_tradedepotst.h> #include <df/building_tradedepotst.h>
#include <df/building_stockpilest.h> #include <df/building_stockpilest.h>
#include <df/items_other_id.h> #include <df/items_other_id.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/activity_info.h> #include <df/activity_info.h>
#include <MiscUtils.h> #include <MiscUtils.h>
@ -47,7 +47,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
DFHACK_PLUGIN("autohauler"); DFHACK_PLUGIN("autohauler");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
#define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0])) #define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))

@ -12,7 +12,7 @@
// DF data structure definition headers // DF data structure definition headers
#include "DataDefs.h" #include "DataDefs.h"
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/world.h> #include <df/world.h>
#include <df/unit.h> #include <df/unit.h>
#include <df/unit_soul.h> #include <df/unit_soul.h>
@ -32,7 +32,7 @@
#include <df/building_tradedepotst.h> #include <df/building_tradedepotst.h>
#include <df/building_stockpilest.h> #include <df/building_stockpilest.h>
#include <df/items_other_id.h> #include <df/items_other_id.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/activity_info.h> #include <df/activity_info.h>
#include <MiscUtils.h> #include <MiscUtils.h>
@ -47,7 +47,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
DFHACK_PLUGIN("autolabor"); DFHACK_PLUGIN("autolabor");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
#define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0])) #define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))
@ -813,7 +813,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// identify dwarfs who are needed for meetings and mark them for exclusion // identify dwarfs who are needed for meetings and mark them for exclusion
for (auto& act : ui->activities) for (auto& act : plotinfo->activities)
{ {
if (!act) continue; if (!act) continue;
bool p1 = act->unit_actor == dwarfs[dwarf]; bool p1 = act->unit_actor == dwarfs[dwarf];

@ -56,7 +56,7 @@ using std::string;
using std::endl; using std::endl;
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
using df::global::world; using df::global::world;
#include "labormanager.h" #include "labormanager.h"

@ -25,7 +25,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include <MiscUtils.h> #include <MiscUtils.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/world.h> #include <df/world.h>
#include <df/unit.h> #include <df/unit.h>
#include <df/unit_relationship_type.h> #include <df/unit_relationship_type.h>
@ -46,7 +46,7 @@
#include <df/building_tradedepotst.h> #include <df/building_tradedepotst.h>
#include <df/building_stockpilest.h> #include <df/building_stockpilest.h>
#include <df/items_other_id.h> #include <df/items_other_id.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/activity_info.h> #include <df/activity_info.h>
#include <df/tile_dig_designation.h> #include <df/tile_dig_designation.h>
#include <df/item_weaponst.h> #include <df/item_weaponst.h>
@ -64,7 +64,7 @@
#include <df/building_design.h> #include <df/building_design.h>
#include <df/vehicle.h> #include <df/vehicle.h>
#include <df/units_other_id.h> #include <df/units_other_id.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/training_assignment.h> #include <df/training_assignment.h>
#include <df/general_ref_contains_itemst.h> #include <df/general_ref_contains_itemst.h>
#include <df/personality_facet_type.h> #include <df/personality_facet_type.h>
@ -82,7 +82,7 @@ using std::string;
using std::endl; using std::endl;
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
using df::global::world; using df::global::world;
#define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0])) #define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))
@ -948,9 +948,9 @@ private:
// identify dwarfs who are needed for meetings and mark them for exclusion // identify dwarfs who are needed for meetings and mark them for exclusion
for (size_t i = 0; i < ui->activities.size(); ++i) for (size_t i = 0; i < plotinfo->activities.size(); ++i)
{ {
df::activity_info *act = ui->activities[i]; df::activity_info *act = plotinfo->activities[i];
if (!act) continue; if (!act) continue;
bool p1 = act->unit_actor == dwarf->dwarf; bool p1 = act->unit_actor == dwarf->dwarf;
@ -996,11 +996,11 @@ private:
for (size_t j = 0; j < dwarf->dwarf->inventory.size(); j++) for (size_t j = 0; j < dwarf->dwarf->inventory.size(); j++)
{ {
df::unit_inventory_item* ui = dwarf->dwarf->inventory[j]; df::unit_inventory_item* plotinfo = dwarf->dwarf->inventory[j];
if (ui->mode == df::unit_inventory_item::Weapon && ui->item->isWeapon()) if (plotinfo->mode == df::unit_inventory_item::Weapon && plotinfo->item->isWeapon())
{ {
dwarf->armed = true; dwarf->armed = true;
df::itemdef_weaponst* weapondef = ((df::item_weaponst*)(ui->item))->subtype; df::itemdef_weaponst* weapondef = ((df::item_weaponst*)(plotinfo->item))->subtype;
df::job_skill weaponsk = (df::job_skill) weapondef->skill_melee; df::job_skill weaponsk = (df::job_skill) weapondef->skill_melee;
df::job_skill rangesk = (df::job_skill) weapondef->skill_ranged; df::job_skill rangesk = (df::job_skill) weapondef->skill_ranged;
if (weaponsk == df::job_skill::AXE) if (weaponsk == df::job_skill::AXE)
@ -1408,8 +1408,8 @@ public:
(isOptionEnabled(CF_ALLOW_HUNTING) && has_butchers) ? 1 : 0; (isOptionEnabled(CF_ALLOW_HUNTING) && has_butchers) ? 1 : 0;
/* add animal trainers */ /* add animal trainers */
for (auto a = df::global::ui->equipment.training_assignments.begin(); for (auto a = df::global::plotinfo->equipment.training_assignments.begin();
a != df::global::ui->equipment.training_assignments.end(); a != df::global::plotinfo->equipment.training_assignments.end();
a++) a++)
{ {
labor_needed[df::unit_labor::ANIMALTRAIN]++; labor_needed[df::unit_labor::ANIMALTRAIN]++;

@ -21,8 +21,8 @@
#include "df/build_req_choice_specst.h" #include "df/build_req_choice_specst.h"
#include "df/construction_type.h" #include "df/construction_type.h"
#include "df/item.h" #include "df/item.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/items_other_id.h" #include "df/items_other_id.h"
#include "df/job.h" #include "df/job.h"
@ -50,7 +50,7 @@ using namespace df::enums;
DFHACK_PLUGIN("automaterial"); DFHACK_PLUGIN("automaterial");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
namespace DFHack { namespace DFHack {
@ -115,14 +115,14 @@ static inline bool in_material_choice_stage()
{ {
return Gui::build_selector_hotkey(Core::getTopViewscreen()) && return Gui::build_selector_hotkey(Core::getTopViewscreen()) &&
ui_build_selector->building_type == df::building_type::Construction && ui_build_selector->building_type == df::building_type::Construction &&
ui->main.mode == ui_sidebar_mode::Build && plotinfo->main.mode == ui_sidebar_mode::Build &&
ui_build_selector->stage == 2; ui_build_selector->stage == 2;
} }
static inline bool in_placement_stage() static inline bool in_placement_stage()
{ {
return Gui::dwarfmode_hotkey(Core::getTopViewscreen()) && return Gui::dwarfmode_hotkey(Core::getTopViewscreen()) &&
ui->main.mode == ui_sidebar_mode::Build && plotinfo->main.mode == ui_sidebar_mode::Build &&
ui_build_selector && ui_build_selector &&
ui_build_selector->building_type == df::building_type::Construction && ui_build_selector->building_type == df::building_type::Construction &&
ui_build_selector->stage == 1; ui_build_selector->stage == 1;
@ -131,7 +131,7 @@ static inline bool in_placement_stage()
static inline bool in_type_choice_stage() static inline bool in_type_choice_stage()
{ {
return Gui::dwarfmode_hotkey(Core::getTopViewscreen()) && return Gui::dwarfmode_hotkey(Core::getTopViewscreen()) &&
ui->main.mode == ui_sidebar_mode::Build && plotinfo->main.mode == ui_sidebar_mode::Build &&
ui_build_selector && ui_build_selector &&
ui_build_selector->building_type < 0; ui_build_selector->building_type < 0;
} }
@ -713,7 +713,7 @@ struct jobutils_hook : public df::viewscreen_dwarfmodest
if (!box_select_enabled) if (!box_select_enabled)
return; return;
if (ui->main.mode != df::ui_sidebar_mode::Build || if (plotinfo->main.mode != df::ui_sidebar_mode::Build ||
ui_build_selector->building_type != df::building_type::Construction) ui_build_selector->building_type != df::building_type::Construction)
return; return;

@ -9,7 +9,7 @@
#include "df/building_stockpilest.h" #include "df/building_stockpilest.h"
#include "modules/Buildings.h" #include "modules/Buildings.h"
#include "modules/Items.h" #include "modules/Items.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "modules/Maps.h" #include "modules/Maps.h"
#include "modules/World.h" #include "modules/World.h"
#include "df/item_quality.h" #include "df/item_quality.h"
@ -21,7 +21,7 @@ DFHACK_PLUGIN("automelt");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(cursor); REQUIRE_GLOBAL(cursor);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
static const string PERSISTENCE_KEY = "automelt/stockpiles"; static const string PERSISTENCE_KEY = "automelt/stockpiles";

@ -15,7 +15,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/job_item_ref.h" #include "df/job_item_ref.h"
#include "modules/Job.h" #include "modules/Job.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/mandate.h" #include "df/mandate.h"
#include "modules/Maps.h" #include "modules/Maps.h"
@ -25,7 +25,7 @@ DFHACK_PLUGIN("autotrade");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(cursor); REQUIRE_GLOBAL(cursor);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
static const string PERSISTENCE_KEY = "autotrade/stockpiles"; static const string PERSISTENCE_KEY = "autotrade/stockpiles";

@ -6,7 +6,7 @@
#include "df/building_type.h" #include "df/building_type.h"
#include "df/general_ref_building_holderst.h" #include "df/general_ref_building_holderst.h"
#include "df/job_item.h" #include "df/job_item.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "modules/Buildings.h" #include "modules/Buildings.h"
#include "modules/Gui.h" #include "modules/Gui.h"

@ -1,7 +1,7 @@
#include "df/construction_type.h" #include "df/construction_type.h"
#include "df/entity_position.h" #include "df/entity_position.h"
#include "df/interface_key.h" #include "df/interface_key.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "modules/Gui.h" #include "modules/Gui.h"
@ -18,7 +18,7 @@
DFHACK_PLUGIN("buildingplan"); DFHACK_PLUGIN("buildingplan");
#define PLUGIN_VERSION "2.0" #define PLUGIN_VERSION "2.0"
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(world); // used in buildingplan library REQUIRE_GLOBAL(world); // used in buildingplan library
@ -455,8 +455,8 @@ struct buildingplan_query_hook : public df::viewscreen_dwarfmodest
bool isInPlannedBuildingQueryMode() bool isInPlannedBuildingQueryMode()
{ {
return (ui->main.mode == df::ui_sidebar_mode::QueryBuilding || return (plotinfo->main.mode == df::ui_sidebar_mode::QueryBuilding ||
ui->main.mode == df::ui_sidebar_mode::BuildingItems) && plotinfo->main.mode == df::ui_sidebar_mode::BuildingItems) &&
planner.getPlannedBuilding(world->selected_building); planner.getPlannedBuilding(world->selected_building);
} }
@ -595,7 +595,7 @@ struct buildingplan_place_hook : public df::viewscreen_dwarfmodest
bool isInPlannedBuildingPlacementMode() bool isInPlannedBuildingPlacementMode()
{ {
return ui->main.mode == ui_sidebar_mode::Build && return plotinfo->main.mode == ui_sidebar_mode::Build &&
df::global::ui_build_selector && df::global::ui_build_selector &&
df::global::ui_build_selector->stage < 2 && df::global::ui_build_selector->stage < 2 &&
planner.isPlannableBuilding(toBuildingTypeKey(ui_build_selector)); planner.isPlannableBuilding(toBuildingTypeKey(ui_build_selector));
@ -861,7 +861,7 @@ struct buildingplan_room_hook : public df::viewscreen_dwarfmodest
std::vector<Units::NoblePosition> getNoblePositionOfSelectedBuildingOwner() std::vector<Units::NoblePosition> getNoblePositionOfSelectedBuildingOwner()
{ {
std::vector<Units::NoblePosition> np; std::vector<Units::NoblePosition> np;
if (ui->main.mode != df::ui_sidebar_mode::QueryBuilding || if (plotinfo->main.mode != df::ui_sidebar_mode::QueryBuilding ||
!world->selected_building || !world->selected_building ||
!world->selected_building->owner) !world->selected_building->owner)
{ {
@ -1084,7 +1084,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
static bool is_paused() static bool is_paused()
{ {
return World::ReadPauseState() || return World::ReadPauseState() ||
ui->main.mode > df::ui_sidebar_mode::Squads || plotinfo->main.mode > df::ui_sidebar_mode::Squads ||
!strict_virtual_cast<df::viewscreen_dwarfmodest>(Gui::getCurViewscreen(true)); !strict_virtual_cast<df::viewscreen_dwarfmodest>(Gui::getCurViewscreen(true));
} }

@ -17,7 +17,7 @@
#include "TileTypes.h" #include "TileTypes.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/burrow.h" #include "df/burrow.h"
@ -38,7 +38,7 @@ using namespace df::enums;
using namespace dfproto; using namespace dfproto;
DFHACK_PLUGIN("burrows"); DFHACK_PLUGIN("burrows");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(gamemode); REQUIRE_GLOBAL(gamemode);
@ -102,11 +102,11 @@ DEFINE_LUA_EVENT_1(onBurrowRename, handle_burrow_rename, df::burrow*);
static void detect_burrow_renames(color_ostream &out) static void detect_burrow_renames(color_ostream &out)
{ {
if (ui->main.mode == ui_sidebar_mode::Burrows && if (plotinfo->main.mode == ui_sidebar_mode::Burrows &&
ui->burrows.in_edit_name_mode && plotinfo->burrows.in_edit_name_mode &&
ui->burrows.sel_id >= 0) plotinfo->burrows.sel_id >= 0)
{ {
name_burrow_id = ui->burrows.sel_id; name_burrow_id = plotinfo->burrows.sel_id;
} }
else if (name_burrow_id >= 0) else if (name_burrow_id >= 0)
{ {
@ -222,7 +222,7 @@ static std::map<std::string,int> name_lookup;
static void parse_names() static void parse_names()
{ {
auto &list = ui->burrows.list; auto &list = plotinfo->burrows.list;
grow_burrows.clear(); grow_burrows.clear();
name_lookup.clear(); name_lookup.clear();

@ -36,7 +36,7 @@ using std::vector;
DFHACK_PLUGIN("confirm"); DFHACK_PLUGIN("confirm");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
typedef std::set<df::interface_key> ikey_set; typedef std::set<df::interface_key> ikey_set;
command_result df_confirm (color_ostream &out, vector <string> & parameters); command_result df_confirm (color_ostream &out, vector <string> & parameters);

@ -16,7 +16,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/game_type.h" #include "df/game_type.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/historical_entity.h" #include "df/historical_entity.h"
#include "df/world_site.h" #include "df/world_site.h"
@ -38,7 +38,7 @@ using namespace df::enums;
DFHACK_PLUGIN("createitem"); DFHACK_PLUGIN("createitem");
REQUIRE_GLOBAL(cursor); REQUIRE_GLOBAL(cursor);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(gametype); REQUIRE_GLOBAL(gametype);
REQUIRE_GLOBAL(cur_year_tick); REQUIRE_GLOBAL(cur_year_tick);
@ -78,7 +78,7 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it
prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE, prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
0, df::historical_entity::find(unit->civ_id), 0, df::historical_entity::find(unit->civ_id),
(World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL, NULL); (World::isFortressMode()) ? df::world_site::find(plotinfo->site_id) : NULL, NULL);
if (!out_items.size()) if (!out_items.size())
return false; return false;
// if we asked to make shoes and we got twice as many as we asked, then we're okay // if we asked to make shoes and we got twice as many as we asked, then we're okay

@ -43,7 +43,7 @@ namespace DFHack {
DBG_DECLARE(debug,filter); DBG_DECLARE(debug,filter);
DBG_DECLARE(debug,init); DBG_DECLARE(debug,init);
DBG_DECLARE(debug,command); DBG_DECLARE(debug,command);
DBG_DECLARE(debug,ui); DBG_DECLARE(debug,plotinfo);
DBG_DECLARE(debug,example,DebugCategory::LINFO); DBG_DECLARE(debug,example,DebugCategory::LINFO);
} }

@ -33,7 +33,7 @@ using namespace DFHack;
DFHACK_PLUGIN("kittens"); DFHACK_PLUGIN("kittens");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
namespace DFHack { namespace DFHack {
@ -119,9 +119,9 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
} }
if(trackmenu_flg) if(trackmenu_flg)
{ {
if (last_menu != ui->main.mode) if (last_menu != plotinfo->main.mode)
{ {
last_menu = ui->main.mode; last_menu = plotinfo->main.mode;
out.print("Menu: %d\n",last_menu); out.print("Menu: %d\n",last_menu);
} }
} }
@ -157,7 +157,7 @@ command_result trackmenu (color_ostream &out, vector <string> & parameters)
else else
{ {
is_enabled = true; is_enabled = true;
last_menu = ui->main.mode; last_menu = plotinfo->main.mode;
out.print("Menu: %d\n",last_menu); out.print("Menu: %d\n",last_menu);
trackmenu_flg = true; trackmenu_flg = true;
return CR_OK; return CR_OK;

@ -5,7 +5,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/building_stockpilest.h" #include "df/building_stockpilest.h"
#include "df/global_objects.h" #include "df/global_objects.h"
#include "df/item.h" #include "df/item.h"
@ -24,7 +24,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
using df::global::selection_rect; using df::global::selection_rect;
using df::building_stockpilest; using df::building_stockpilest;
@ -35,7 +35,7 @@ DFHACK_PLUGIN("stockcheck");
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{ {
if (world && ui) { if (world && plotinfo) {
commands.push_back( commands.push_back(
PluginCommand("stockcheck", "Check for unprotected rottable items.", PluginCommand("stockcheck", "Check for unprotected rottable items.",
stockcheck, false, stockcheck, false,

@ -20,7 +20,7 @@ using namespace std;
#include "modules/World.h" #include "modules/World.h"
#include "MiscUtils.h" #include "MiscUtils.h"
#include <df/ui.h> #include <df/plotinfost.h>
#include "df/world.h" #include "df/world.h"
#include "df/world_raws.h" #include "df/world_raws.h"
#include "df/building_def.h" #include "df/building_def.h"
@ -34,7 +34,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::cursor; using df::global::cursor;
using df::global::ui; using df::global::plotinfo;
using namespace DFHack::Gui; using namespace DFHack::Gui;

@ -20,14 +20,14 @@
#include <df/reaction_product_itemst.h> #include <df/reaction_product_itemst.h>
#include <df/tile_designation.h> #include <df/tile_designation.h>
#include <df/tile_occupancy.h> #include <df/tile_occupancy.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <df/unit.h> #include <df/unit.h>
#include <df/vermin.h> #include <df/vermin.h>
#include <df/world.h> #include <df/world.h>
#include <df/world_site.h> #include <df/world_site.h>
DFHACK_PLUGIN("dig-now"); DFHACK_PLUGIN("dig-now");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
using namespace DFHack; using namespace DFHack;
@ -678,7 +678,7 @@ static void create_boulders(color_ostream &out,
df::unit *unit = world->units.active[0]; df::unit *unit = world->units.active[0];
df::historical_entity *civ = df::historical_entity::find(unit->civ_id); df::historical_entity *civ = df::historical_entity::find(unit->civ_id);
df::world_site *site = World::isFortressMode() ? df::world_site *site = World::isFortressMode() ?
df::world_site::find(ui->site_id) : NULL; df::world_site::find(plotinfo->site_id) : NULL;
std::vector<df::reaction_reagent *> in_reag; std::vector<df::reaction_reagent *> in_reag;
std::vector<df::item *> in_items; std::vector<df::item *> in_items;

@ -16,7 +16,7 @@
#include "modules/Maps.h" #include "modules/Maps.h"
#include "modules/Materials.h" #include "modules/Materials.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
using std::vector; using std::vector;
using std::string; using std::string;
@ -33,7 +33,7 @@ command_result digcircle (color_ostream &out, vector <string> & parameters);
command_result digtype (color_ostream &out, vector <string> & parameters); command_result digtype (color_ostream &out, vector <string> & parameters);
DFHACK_PLUGIN("dig"); DFHACK_PLUGIN("dig");
REQUIRE_GLOBAL(ui_sidebar_menus); REQUIRE_GLOBAL(game);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(window_z); REQUIRE_GLOBAL(window_z);
@ -213,7 +213,7 @@ bool lineY (MapExtras::MapCache & MCache,
int32_t parse_priority(color_ostream &out, vector<string> &parameters) int32_t parse_priority(color_ostream &out, vector<string> &parameters)
{ {
int32_t default_priority = ui_sidebar_menus->designation.priority; int32_t default_priority = game->designation.priority;
for (auto it = parameters.begin(); it != parameters.end(); ++it) for (auto it = parameters.begin(); it != parameters.end(); ++it)
{ {

@ -25,7 +25,7 @@
#include "df/job_type.h" #include "df/job_type.h"
#include "df/reaction_product_itemst.h" #include "df/reaction_product_itemst.h"
#include "df/reaction_reagent.h" #include "df/reaction_reagent.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/world.h" #include "df/world.h"
@ -252,7 +252,7 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
vector<df::item*> in_items; vector<df::item*> in_items;
prod->produce(firstInvader, &out_products, &out_items, &in_reag, &in_items, 1, df::job_skill::NONE, prod->produce(firstInvader, &out_products, &out_items, &in_reag, &in_items, 1, df::job_skill::NONE,
0, df::historical_entity::find(firstInvader->civ_id), 0, df::historical_entity::find(firstInvader->civ_id),
df::world_site::find(df::global::ui->site_id), NULL); df::world_site::find(df::global::plotinfo->site_id), NULL);
if ( out_items.size() != 1 ) { if ( out_items.size() != 1 ) {
out.print("%s, %d: wrong size: %zu.\n", __FILE__, __LINE__, out_items.size()); out.print("%s, %d: wrong size: %zu.\n", __FILE__, __LINE__, out_items.size());

@ -47,7 +47,7 @@
#include "df/tiletype_material.h" #include "df/tiletype_material.h"
#include "df/tiletype_shape.h" #include "df/tiletype_shape.h"
#include "df/tiletype_shape_basic.h" #include "df/tiletype_shape_basic.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/world.h" #include "df/world.h"

@ -4,7 +4,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/job.h" #include "df/job.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/world.h" #include "df/world.h"
@ -53,7 +53,7 @@ using std::deque;
DFHACK_PLUGIN("dwarfmonitor"); DFHACK_PLUGIN("dwarfmonitor");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
typedef int16_t activity_type; typedef int16_t activity_type;

@ -39,7 +39,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/general_ref_unit_workerst.h" #include "df/general_ref_unit_workerst.h"
#include "df/profession.h" #include "df/profession.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_health_info.h" #include "df/unit_health_info.h"
#include "df/unit_health_flags.h" #include "df/unit_health_flags.h"
@ -58,7 +58,7 @@ using namespace std;
DFHACK_PLUGIN("dwarfvet"); DFHACK_PLUGIN("dwarfvet");
DFHACK_PLUGIN_IS_ENABLED(dwarfvet_enabled); DFHACK_PLUGIN_IS_ENABLED(dwarfvet_enabled);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
static unordered_set<int32_t> tracked_units; static unordered_set<int32_t> tracked_units;
@ -407,7 +407,7 @@ void tickHandler(color_ostream& out, void* data) {
if ( !dwarfvet_enabled ) if ( !dwarfvet_enabled )
return; return;
CoreSuspender suspend; CoreSuspender suspend;
int32_t own_race_id = df::global::ui->race_id; int32_t own_race_id = df::global::plotinfo->race_id;
/** /**
* Generate a list of animal hospitals on the map * Generate a list of animal hospitals on the map

@ -123,7 +123,7 @@ namespace embark_assist {
struct states { struct states {
embark_assist::defs::find_callbacks find_callback; embark_assist::defs::find_callbacks find_callback;
uis ui; uis plotinfo;
display_maps finder_list; // Don't need the element key, but it's easier to use the same type. display_maps finder_list; // Don't need the element key, but it's easier to use the same type.
uint16_t finder_list_focus; uint16_t finder_list_focus;
bool finder_list_active; bool finder_list_active;
@ -171,13 +171,13 @@ namespace embark_assist {
size_t civ = 0; size_t civ = 0;
while (true) { while (true) {
for (size_t k = 0; k < state->ui[static_cast<int8_t>(i)]->list.size(); k++) { for (size_t k = 0; k < state->plotinfo[static_cast<int8_t>(i)]->list.size(); k++) {
if (state->ui[static_cast<int8_t>(i) + civ]->current_value == state->ui[static_cast<int8_t>(i) + civ]->list[k].key) { if (state->plotinfo[static_cast<int8_t>(i) + civ]->current_value == state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].key) {
fprintf(outfile, "[%s:%s]\n", state->finder_list[static_cast<int8_t>(i) + civ].text.c_str(), state->ui[static_cast<int8_t>(i) + civ]->list[k].text.c_str()); fprintf(outfile, "[%s:%s]\n", state->finder_list[static_cast<int8_t>(i) + civ].text.c_str(), state->plotinfo[static_cast<int8_t>(i) + civ]->list[k].text.c_str());
break; break;
} }
} }
// fprintf(outfile, "[%s:%i]\n", state->finder_list[static_cast<int8_t>(i)].text.c_str(), state->ui[static_cast<int8_t>(i)]->current_value); // fprintf(outfile, "[%s:%i]\n", state->finder_list[static_cast<int8_t>(i)].text.c_str(), state->plotinfo[static_cast<int8_t>(i)]->current_value);
if (i == last_fields) { if (i == last_fields) {
civ++; civ++;
@ -229,10 +229,10 @@ namespace embark_assist {
found = false; found = false;
for (size_t l = 0; l < state->ui[static_cast<int8_t>(i) + civ]->list.size(); l++) { for (size_t l = 0; l < state->plotinfo[static_cast<int8_t>(i) + civ]->list.size(); l++) {
for (int m = k + 1; m < count; m++) { for (int m = k + 1; m < count; m++) {
if (state->ui[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) { if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) {
if (state->ui[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' && if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' &&
line[m] == ']') { line[m] == ']') {
found = true; found = true;
} }
@ -291,13 +291,13 @@ namespace embark_assist {
found = false; found = false;
for (size_t l = 0; l < state->ui[static_cast<int8_t>(i) + civ]->list.size(); l++) { for (size_t l = 0; l < state->plotinfo[static_cast<int8_t>(i) + civ]->list.size(); l++) {
for (int m = k + 1; m < count; m++) { for (int m = k + 1; m < count; m++) {
if (state->ui[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) { if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] != line[m]) {
if (state->ui[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' && if (state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].text.c_str()[m - (k + 1)] == '\0' &&
line[m] == ']') { line[m] == ']') {
state->ui[static_cast<int8_t>(i) + civ]->current_value = state->ui[static_cast<int8_t>(i) + civ]->list[l].key; state->plotinfo[static_cast<int8_t>(i) + civ]->current_value = state->plotinfo[static_cast<int8_t>(i) + civ]->list[l].key;
state->ui[static_cast<int8_t>(i) + civ]->current_display_value = l; state->plotinfo[static_cast<int8_t>(i) + civ]->current_display_value = l;
found = true; found = true;
} }
@ -1095,7 +1095,7 @@ namespace embark_assist {
if (l < state->civs.size() - 1) { if (l < state->civs.size() - 1) {
element->current_value = element->list[0].key; element->current_value = element->list[0].key;
state->ui.push_back(element); state->plotinfo.push_back(element);
element = new ui_lists; element = new ui_lists;
element->current_display_value = 0; element->current_display_value = 0;
element->current_index = 0; element->current_index = 0;
@ -1108,7 +1108,7 @@ namespace embark_assist {
} }
element->current_value = element->list[0].key; element->current_value = element->list[0].key;
state->ui.push_back(element); state->plotinfo.push_back(element);
switch (i) { switch (i) {
case fields::x_dim: case fields::x_dim:
@ -1333,21 +1333,21 @@ namespace embark_assist {
// off to compensate for the list starting with 1 at index 0. // off to compensate for the list starting with 1 at index 0.
// //
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0); auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value = state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value =
screen->location.embark_pos_max.x - screen->location.embark_pos_max.x -
screen->location.embark_pos_min.x; screen->location.embark_pos_min.x;
state->ui[static_cast<int8_t>(fields::x_dim)]->current_index = state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_index =
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value; state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value;
state->ui[static_cast<int8_t>(fields::x_dim)]->current_value = state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_value =
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value + 1; state->plotinfo[static_cast<int8_t>(fields::x_dim)]->current_display_value + 1;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value = state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value =
screen->location.embark_pos_max.y - screen->location.embark_pos_max.y -
screen->location.embark_pos_min.y; screen->location.embark_pos_min.y;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_index = state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_index =
state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value; state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_value = state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_value =
state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value + 1; state->plotinfo[static_cast<int8_t>(fields::y_dim)]->current_display_value + 1;
} }
//========================================================================================================== //==========================================================================================================
@ -1360,234 +1360,234 @@ namespace embark_assist {
while (true) { while (true) {
switch (i) { switch (i) {
case fields::x_dim: case fields::x_dim:
finder.x_dim = state->ui[static_cast<uint8_t>(i)]->current_value; finder.x_dim = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::y_dim: case fields::y_dim:
finder.y_dim = state->ui[static_cast<uint8_t>(i)]->current_value; finder.y_dim = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::savagery_calm: case fields::savagery_calm:
finder.savagery[0] = finder.savagery[0] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::savagery_medium: case fields::savagery_medium:
finder.savagery[1] = finder.savagery[1] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::savagery_savage: case fields::savagery_savage:
finder.savagery[2] = finder.savagery[2] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::good: case fields::good:
finder.evilness[0] = finder.evilness[0] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::neutral: case fields::neutral:
finder.evilness[1] = finder.evilness[1] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::evil: case fields::evil:
finder.evilness[2] = finder.evilness[2] =
static_cast<embark_assist::defs::evil_savagery_values>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::evil_savagery_values>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::aquifer: case fields::aquifer:
finder.aquifer = finder.aquifer =
static_cast<embark_assist::defs::aquifer_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::aquifer_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::min_river: case fields::min_river:
finder.min_river = finder.min_river =
static_cast<embark_assist::defs::river_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::river_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::max_river: case fields::max_river:
finder.max_river = finder.max_river =
static_cast<embark_assist::defs::river_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::river_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::min_waterfall: case fields::min_waterfall:
finder.min_waterfall = state->ui[static_cast<uint8_t>(i)]->current_value; finder.min_waterfall = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::flat: case fields::flat:
finder.flat = finder.flat =
static_cast<embark_assist::defs::yes_no_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::yes_no_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::soil_min_everywhere: case fields::soil_min_everywhere:
finder.soil_min_everywhere = finder.soil_min_everywhere =
static_cast<embark_assist::defs::all_present_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::all_present_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::freezing: case fields::freezing:
finder.freezing = finder.freezing =
static_cast<embark_assist::defs::freezing_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::freezing_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::blood_rain: case fields::blood_rain:
finder.blood_rain = finder.blood_rain =
static_cast<embark_assist::defs::yes_no_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::yes_no_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::syndrome_rain: case fields::syndrome_rain:
finder.syndrome_rain = finder.syndrome_rain =
static_cast<embark_assist::defs::syndrome_rain_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::syndrome_rain_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::reanimation: case fields::reanimation:
finder.reanimation = finder.reanimation =
static_cast<embark_assist::defs::reanimation_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::reanimation_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::clay: case fields::clay:
finder.clay = finder.clay =
static_cast<embark_assist::defs::present_absent_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::sand: case fields::sand:
finder.sand = finder.sand =
static_cast<embark_assist::defs::present_absent_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::flux: case fields::flux:
finder.flux = finder.flux =
static_cast<embark_assist::defs::present_absent_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::coal: case fields::coal:
finder.coal = finder.coal =
static_cast<embark_assist::defs::present_absent_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::soil_min: case fields::soil_min:
finder.soil_min = finder.soil_min =
static_cast<embark_assist::defs::soil_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::soil_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::soil_max: case fields::soil_max:
finder.soil_max = finder.soil_max =
static_cast<embark_assist::defs::soil_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::soil_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::spire_count_min: case fields::spire_count_min:
finder.spire_count_min = state->ui[static_cast<uint8_t>(i)]->current_value; finder.spire_count_min = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::spire_count_max: case fields::spire_count_max:
finder.spire_count_max = state->ui[static_cast<uint8_t>(i)]->current_value; finder.spire_count_max = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::magma_min: case fields::magma_min:
finder.magma_min = finder.magma_min =
static_cast<embark_assist::defs::magma_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::magma_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::magma_max: case fields::magma_max:
finder.magma_max = finder.magma_max =
static_cast<embark_assist::defs::magma_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); static_cast<embark_assist::defs::magma_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::biome_count_min: case fields::biome_count_min:
finder.biome_count_min = state->ui[static_cast<uint8_t>(i)]->current_value; finder.biome_count_min = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::biome_count_max: case fields::biome_count_max:
finder.biome_count_max = state->ui[static_cast<uint8_t>(i)]->current_value; finder.biome_count_max = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::region_type_1: case fields::region_type_1:
finder.region_type_1 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.region_type_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::region_type_2: case fields::region_type_2:
finder.region_type_2 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.region_type_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::region_type_3: case fields::region_type_3:
finder.region_type_3 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.region_type_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::biome_1: case fields::biome_1:
finder.biome_1 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.biome_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::biome_2: case fields::biome_2:
finder.biome_2 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.biome_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::biome_3: case fields::biome_3:
finder.biome_3 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.biome_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::min_trees: case fields::min_trees:
finder.min_trees = static_cast<embark_assist::defs::tree_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); finder.min_trees = static_cast<embark_assist::defs::tree_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::max_trees: case fields::max_trees:
finder.max_trees = static_cast<embark_assist::defs::tree_ranges>(state->ui[static_cast<uint8_t>(i)]->current_value); finder.max_trees = static_cast<embark_assist::defs::tree_ranges>(state->plotinfo[static_cast<uint8_t>(i)]->current_value);
break; break;
case fields::metal_1: case fields::metal_1:
finder.metal_1 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.metal_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::metal_2: case fields::metal_2:
finder.metal_2 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.metal_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::metal_3: case fields::metal_3:
finder.metal_3 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.metal_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::economic_1: case fields::economic_1:
finder.economic_1 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.economic_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::economic_2: case fields::economic_2:
finder.economic_2 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.economic_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::economic_3: case fields::economic_3:
finder.economic_3 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.economic_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::mineral_1: case fields::mineral_1:
finder.mineral_1 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.mineral_1 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::mineral_2: case fields::mineral_2:
finder.mineral_2 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.mineral_2 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::mineral_3: case fields::mineral_3:
finder.mineral_3 = state->ui[static_cast<uint8_t>(i)]->current_value; finder.mineral_3 = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::min_necro_neighbors: case fields::min_necro_neighbors:
finder.min_necro_neighbors = state->ui[static_cast<uint8_t>(i)]->current_value; finder.min_necro_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::max_necro_neighbors: case fields::max_necro_neighbors:
finder.max_necro_neighbors = state->ui[static_cast<uint8_t>(i)]->current_value; finder.max_necro_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::min_civ_neighbors: case fields::min_civ_neighbors:
finder.min_civ_neighbors = state->ui[static_cast<uint8_t>(i)]->current_value; finder.min_civ_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::max_civ_neighbors: case fields::max_civ_neighbors:
finder.max_civ_neighbors = state->ui[static_cast<uint8_t>(i)]->current_value; finder.max_civ_neighbors = state->plotinfo[static_cast<uint8_t>(i)]->current_value;
break; break;
case fields::neighbors: case fields::neighbors:
for (size_t k = 0; k < state->civs.size(); k++) { for (size_t k = 0; k < state->civs.size(); k++) {
finder.neighbors.push_back({ state->civs[k].id, static_cast<embark_assist::defs::present_absent_ranges>(state->ui[static_cast<uint8_t>(i) + k]->current_value) }); finder.neighbors.push_back({ state->civs[k].id, static_cast<embark_assist::defs::present_absent_ranges>(state->plotinfo[static_cast<uint8_t>(i) + k]->current_value) });
} }
break; break;
} }
@ -1641,10 +1641,10 @@ namespace embark_assist {
} }
} }
else { else {
if (state->ui[state->finder_list_focus]->current_index > 0) { if (state->plotinfo[state->finder_list_focus]->current_index > 0) {
state->ui[state->finder_list_focus]->current_index--; state->plotinfo[state->finder_list_focus]->current_index--;
} else { } else {
state->ui[state->finder_list_focus]->current_index = static_cast<uint16_t>(state->ui[state->finder_list_focus]->list.size()) - 1; state->plotinfo[state->finder_list_focus]->current_index = static_cast<uint16_t>(state->plotinfo[state->finder_list_focus]->list.size()) - 1;
} }
} }
@ -1657,17 +1657,17 @@ namespace embark_assist {
} }
} }
else { else {
if (state->ui[state->finder_list_focus]->current_index < state->ui[state->finder_list_focus]->list.size() - 1) { if (state->plotinfo[state->finder_list_focus]->current_index < state->plotinfo[state->finder_list_focus]->list.size() - 1) {
state->ui[state->finder_list_focus]->current_index++; state->plotinfo[state->finder_list_focus]->current_index++;
} else { } else {
state->ui[state->finder_list_focus]->current_index = 0; state->plotinfo[state->finder_list_focus]->current_index = 0;
} }
} }
} else if (input->count(df::interface_key::SELECT)) { } else if (input->count(df::interface_key::SELECT)) {
if (!state->finder_list_active) { if (!state->finder_list_active) {
state->ui[state->finder_list_focus]->current_display_value = state->ui[state->finder_list_focus]->current_index; state->plotinfo[state->finder_list_focus]->current_display_value = state->plotinfo[state->finder_list_focus]->current_index;
state->ui[state->finder_list_focus]->current_value = state->ui[state->finder_list_focus]->list[state->ui[state->finder_list_focus]->current_index].key; state->plotinfo[state->finder_list_focus]->current_value = state->plotinfo[state->finder_list_focus]->list[state->plotinfo[state->finder_list_focus]->current_index].key;
state->finder_list_active = true; state->finder_list_active = true;
} }
@ -1743,7 +1743,7 @@ namespace embark_assist {
embark_assist::screen::paintString(active_pen, embark_assist::screen::paintString(active_pen,
21, 21,
top_row + i - offset, top_row + i - offset,
state->ui[i]->list[state->ui[i]->current_display_value].text); state->plotinfo[i]->list[state->plotinfo[i]->current_display_value].text);
} }
else { else {
embark_assist::screen::paintString(normal_pen, 1, top_row + i - offset, state->finder_list[i].text); embark_assist::screen::paintString(normal_pen, 1, top_row + i - offset, state->finder_list[i].text);
@ -1751,38 +1751,38 @@ namespace embark_assist {
embark_assist::screen::paintString(white_pen, embark_assist::screen::paintString(white_pen,
21, 21,
top_row + i - offset, top_row + i - offset,
state->ui[i]->list[state->ui[i]->current_display_value].text); state->plotinfo[i]->list[state->plotinfo[i]->current_display_value].text);
} }
} }
// Implement scrolling lists if they don't fit on the screen. // Implement scrolling lists if they don't fit on the screen.
offset = 0; offset = 0;
if (int32_t(state->ui[state->finder_list_focus]->list.size()) > screen_size.y - top_row - 1) { if (int32_t(state->plotinfo[state->finder_list_focus]->list.size()) > screen_size.y - top_row - 1) {
offset = (screen_size.y - top_row - 1) / 2; offset = (screen_size.y - top_row - 1) / 2;
if (state->ui[state->finder_list_focus]->current_index < offset) { if (state->plotinfo[state->finder_list_focus]->current_index < offset) {
offset = 0; offset = 0;
} }
else { else {
offset = state->ui[state->finder_list_focus]->current_index - offset; offset = state->plotinfo[state->finder_list_focus]->current_index - offset;
} }
if (int32_t(state->ui[state->finder_list_focus]->list.size() - offset) < screen_size.y - top_row - 1) { if (int32_t(state->plotinfo[state->finder_list_focus]->list.size() - offset) < screen_size.y - top_row - 1) {
offset = static_cast<uint16_t>(state->ui[state->finder_list_focus]->list.size()) - (screen_size.y - top_row - 1); offset = static_cast<uint16_t>(state->plotinfo[state->finder_list_focus]->list.size()) - (screen_size.y - top_row - 1);
} }
} }
for (uint16_t i = offset; i < state->ui[state->finder_list_focus]->list.size(); i++) { for (uint16_t i = offset; i < state->plotinfo[state->finder_list_focus]->list.size(); i++) {
if (i == state->ui[state->finder_list_focus]->current_index) { if (i == state->plotinfo[state->finder_list_focus]->current_index) {
if (!state->finder_list_active) { // Negated expression to get the display lines in the same order as above. if (!state->finder_list_active) { // Negated expression to get the display lines in the same order as above.
embark_assist::screen::paintString(active_pen, list_column, top_row + i - offset, state->ui[state->finder_list_focus]->list[i].text); embark_assist::screen::paintString(active_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
} }
else { else {
embark_assist::screen::paintString(passive_pen, list_column, top_row + i - offset, state->ui[state->finder_list_focus]->list[i].text); embark_assist::screen::paintString(passive_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
} }
} }
else { else {
embark_assist::screen::paintString(normal_pen, list_column, top_row + i - offset, state->ui[state->finder_list_focus]->list[i].text); embark_assist::screen::paintString(normal_pen, list_column, top_row + i - offset, state->plotinfo[state->finder_list_focus]->list[i].text);
} }
} }
@ -1823,8 +1823,8 @@ void embark_assist::finder_ui::activate() {
void embark_assist::finder_ui::shutdown() { void embark_assist::finder_ui::shutdown() {
if (embark_assist::finder_ui::state) { if (embark_assist::finder_ui::state) {
for (uint16_t i = 0; i < embark_assist::finder_ui::state->ui.size(); i++) { for (uint16_t i = 0; i < embark_assist::finder_ui::state->plotinfo.size(); i++) {
delete embark_assist::finder_ui::state->ui[i]; delete embark_assist::finder_ui::state->plotinfo[i];
} }
delete embark_assist::finder_ui::state; delete embark_assist::finder_ui::state;

@ -39,7 +39,7 @@ using namespace df::enums;
DFHACK_PLUGIN("eventful"); DFHACK_PLUGIN("eventful");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
typedef df::reaction_product_itemst item_product; typedef df::reaction_product_itemst item_product;

@ -14,7 +14,7 @@
#include "df/plant_growth.h" #include "df/plant_growth.h"
#include "df/plant_raw.h" #include "df/plant_raw.h"
#include "df/tile_dig_designation.h" #include "df/tile_dig_designation.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
#include "df/world_data.h" #include "df/world_data.h"
#include "df/world_object_data.h" #include "df/world_object_data.h"
@ -32,7 +32,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
DFHACK_PLUGIN("getplants"); DFHACK_PLUGIN("getplants");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(cur_year); REQUIRE_GLOBAL(cur_year);
REQUIRE_GLOBAL(cur_year_tick); REQUIRE_GLOBAL(cur_year_tick);
@ -242,7 +242,7 @@ bool ripe(int32_t x, int32_t y, int32_t start, int32_t end) {
// Looks in the picked growths vector to see if a matching growth has been marked as picked. // Looks in the picked growths vector to see if a matching growth has been marked as picked.
bool picked(const df::plant *plant, int32_t growth_subtype) { bool picked(const df::plant *plant, int32_t growth_subtype) {
df::world_data *world_data = world->world_data; df::world_data *world_data = world->world_data;
df::world_site *site = df::world_site::find(ui->site_id); df::world_site *site = df::world_site::find(plotinfo->site_id);
int32_t pos_x = site->global_min_x + plant->pos.x / 48; int32_t pos_x = site->global_min_x + plant->pos.x / 48;
int32_t pos_y = site->global_min_y + plant->pos.y / 48; int32_t pos_y = site->global_min_y + plant->pos.y / 48;
size_t id = pos_x + pos_y * 16 * world_data->world_width; size_t id = pos_x + pos_y * 16 * world_data->world_width;

@ -11,8 +11,8 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/ui_build_item_req.h" #include "df/ui_build_item_req.h"
#include "df/build_req_choice_genst.h" #include "df/build_req_choice_genst.h"
#include "df/build_req_choice_specst.h" #include "df/build_req_choice_specst.h"
@ -33,7 +33,7 @@ using namespace df::enums;
DFHACK_PLUGIN("jobutils"); DFHACK_PLUGIN("jobutils");
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(ui_workshop_job_cursor); REQUIRE_GLOBAL(ui_workshop_job_cursor);
REQUIRE_GLOBAL(job_next_id); REQUIRE_GLOBAL(job_next_id);
@ -48,7 +48,7 @@ static command_result job_cmd(color_ostream &out, vector <string> & parameters);
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{ {
if (!world || !ui) if (!world || !plotinfo)
return CR_FAILURE; return CR_FAILURE;
commands.push_back( commands.push_back(
@ -232,9 +232,9 @@ static command_result job_material(color_ostream &out, vector <string> & paramet
else else
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
if (ui->main.mode == ui_sidebar_mode::QueryBuilding) if (plotinfo->main.mode == ui_sidebar_mode::QueryBuilding)
return job_material_in_job(out, new_mat); return job_material_in_job(out, new_mat);
if (ui->main.mode == ui_sidebar_mode::Build) if (plotinfo->main.mode == ui_sidebar_mode::Build)
return job_material_in_build(out, new_mat); return job_material_in_build(out, new_mat);
return CR_WRONG_USAGE; return CR_WRONG_USAGE;

@ -19,7 +19,7 @@
#include "df/activity_event.h" #include "df/activity_event.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/graphic.h" #include "df/graphic.h"
#include "df/enabler.h" #include "df/enabler.h"
#include "df/viewscreen_unitlistst.h" #include "df/viewscreen_unitlistst.h"
@ -49,7 +49,7 @@ using namespace df::enums;
DFHACK_PLUGIN("manipulator"); DFHACK_PLUGIN("manipulator");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(enabler);
@ -1972,9 +1972,9 @@ void viewscreen_unitlaborsst::render()
Screen::paintTile(Screen::Pen(columns[col_offset].label[0], fg, bg), col_offsets[DISP_COLUMN_LABORS] + col, 1); Screen::paintTile(Screen::Pen(columns[col_offset].label[0], fg, bg), col_offsets[DISP_COLUMN_LABORS] + col, 1);
Screen::paintTile(Screen::Pen(columns[col_offset].label[1], fg, bg), col_offsets[DISP_COLUMN_LABORS] + col, 2); Screen::paintTile(Screen::Pen(columns[col_offset].label[1], fg, bg), col_offsets[DISP_COLUMN_LABORS] + col, 2);
df::profession profession = columns[col_offset].profession; df::profession profession = columns[col_offset].profession;
if ((profession != profession::NONE) && (ui->race_id != -1)) if ((profession != profession::NONE) && (plotinfo->race_id != -1))
{ {
auto graphics = world->raws.creatures.all[ui->race_id]->graphics; auto graphics = world->raws.creatures.all[plotinfo->race_id]->graphics;
Screen::paintTile( Screen::paintTile(
Screen::Pen(' ', fg, 0, Screen::Pen(' ', fg, 0,
graphics.profession_add_color[creature_graphics_role::DEFAULT][profession], graphics.profession_add_color[creature_graphics_role::DEFAULT][profession],

@ -10,7 +10,7 @@
#include "modules/Units.h" #include "modules/Units.h"
#include "df/emotion_type.h" #include "df/emotion_type.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_personality.h" #include "df/unit_personality.h"
#include "df/unit_soul.h" #include "df/unit_soul.h"
@ -24,7 +24,7 @@ DFHACK_PLUGIN("misery");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(cur_year); REQUIRE_GLOBAL(cur_year);
REQUIRE_GLOBAL(cur_year_tick); REQUIRE_GLOBAL(cur_year_tick);

@ -6,8 +6,8 @@
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/world.h" #include "df/world.h"
#include "df/items_other_id.h" #include "df/items_other_id.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "modules/Gui.h" #include "modules/Gui.h"
#include "modules/World.h" #include "modules/World.h"
@ -26,7 +26,7 @@ DFHACK_PLUGIN("mousequery");
REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(enabler);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
using namespace df::enums::ui_sidebar_mode; using namespace df::enums::ui_sidebar_mode;
@ -196,7 +196,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
bool isInDesignationMenu() bool isInDesignationMenu()
{ {
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case DesignateMine: case DesignateMine:
case DesignateRemoveRamps: case DesignateRemoveRamps:
@ -230,7 +230,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
return true; return true;
case Burrows: case Burrows:
return ui->burrows.in_define_mode; return plotinfo->burrows.in_define_mode;
default: default:
return false; return false;
@ -242,7 +242,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
if (isInDesignationMenu()) if (isInDesignationMenu())
return box_designation_enabled; return box_designation_enabled;
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case DesignateItemsClaim: case DesignateItemsClaim:
case DesignateItemsForbid: case DesignateItemsForbid:
@ -281,8 +281,8 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
{ {
bool selectableMode = bool selectableMode =
isInDesignationMenu() || isInDesignationMenu() ||
ui->main.mode == Stockpiles || plotinfo->main.mode == Stockpiles ||
ui->main.mode == Zones; plotinfo->main.mode == Zones;
if (selectableMode) if (selectableMode)
{ {
@ -314,7 +314,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
} }
else else
{ {
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case QueryBuilding: case QueryBuilding:
if (cursor_still_here) if (cursor_still_here)
@ -369,8 +369,8 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
if (mx < 1 || mx > dims.map_x2 || my < 1 || my > dims.map_y2) if (mx < 1 || mx > dims.map_x2 || my < 1 || my > dims.map_y2)
return false; return false;
if (ui->main.mode == df::ui_sidebar_mode::Zones || if (plotinfo->main.mode == df::ui_sidebar_mode::Zones ||
ui->main.mode == df::ui_sidebar_mode::Stockpiles) plotinfo->main.mode == df::ui_sidebar_mode::Stockpiles)
{ {
int32_t x, y, z; int32_t x, y, z;
if (Gui::getDesignationCoords(x, y, z)) if (Gui::getDesignationCoords(x, y, z))
@ -417,8 +417,8 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
enabler->mouse_rbut = 0; enabler->mouse_rbut = 0;
using namespace df::enums::ui_sidebar_mode; using namespace df::enums::ui_sidebar_mode;
if ((ui->main.mode == QueryBuilding || ui->main.mode == BuildingItems || if ((plotinfo->main.mode == QueryBuilding || plotinfo->main.mode == BuildingItems ||
ui->main.mode == ViewUnits || ui->main.mode == LookAround) || plotinfo->main.mode == ViewUnits || plotinfo->main.mode == LookAround) ||
(isInTrackableMode() && tracking_enabled)) (isInTrackableMode() && tracking_enabled))
{ {
sendKey(df::interface_key::LEAVESCREEN); sendKey(df::interface_key::LEAVESCREEN);
@ -707,8 +707,8 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
if (Gui::getDesignationCoords(x, y, z)) if (Gui::getDesignationCoords(x, y, z))
{ {
color = COLOR_WHITE; color = COLOR_WHITE;
if (ui->main.mode == df::ui_sidebar_mode::Zones || if (plotinfo->main.mode == df::ui_sidebar_mode::Zones ||
ui->main.mode == df::ui_sidebar_mode::Stockpiles) plotinfo->main.mode == df::ui_sidebar_mode::Stockpiles)
{ {
auto dX = abs(x - mpos.x); auto dX = abs(x - mpos.x);
if (dX > 30) if (dX > 30)

@ -5,7 +5,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/building_nest_boxst.h" #include "df/building_nest_boxst.h"
#include "df/building_type.h" #include "df/building_type.h"
#include "df/buildings_other_id.h" #include "df/buildings_other_id.h"
@ -26,7 +26,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
static command_result nestboxes(color_ostream &out, vector <string> & parameters); static command_result nestboxes(color_ostream &out, vector <string> & parameters);
@ -67,7 +67,7 @@ static void eggscan(color_ostream &out)
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{ {
if (world && ui) { if (world && plotinfo) {
commands.push_back( commands.push_back(
PluginCommand( PluginCommand(
"nestboxes", "nestboxes",

@ -29,8 +29,8 @@
#include "df/machine_info.h" #include "df/machine_info.h"
#include "df/report.h" #include "df/report.h"
#include "df/tile_designation.h" #include "df/tile_designation.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/world.h" #include "df/world.h"
@ -43,7 +43,7 @@ using namespace df::enums;
DFHACK_PLUGIN("power-meter"); DFHACK_PLUGIN("power-meter");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
static const uint32_t METER_BIT = 0x80000000U; static const uint32_t METER_BIT = 0x80000000U;

@ -7,7 +7,7 @@
#include "df/adventure_movement_hold_itemst.h" #include "df/adventure_movement_hold_itemst.h"
#include "df/adventure_movement_hold_tilest.h" #include "df/adventure_movement_hold_tilest.h"
#include "df/adventure_movement_optionst.h" #include "df/adventure_movement_optionst.h"
#include "df/ui_advmode.h" #include "df/adventurest.h"
#include "df/viewscreen.h" #include "df/viewscreen.h"
#include "modules/Gui.h" #include "modules/Gui.h"
@ -42,7 +42,7 @@ command_result MoveCommand(DFHack::color_ostream &stream, const MoveCommandParam
auto viewScreen = getCurViewscreen(); auto viewScreen = getCurViewscreen();
if (!in->has_direction()) if (!in->has_direction())
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
if (!df::global::ui_advmode->menu == ui_advmode_menu::Default) if (!df::global::adventure->menu == ui_advmode_menu::Default)
return CR_OK; return CR_OK;
auto dir = in->direction(); auto dir = in->direction();
switch (dir.x()) switch (dir.x())
@ -193,7 +193,7 @@ command_result JumpCommand(DFHack::color_ostream &stream, const MoveCommandParam
{ {
if (!in->has_direction()) if (!in->has_direction())
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
if (!df::global::ui_advmode->menu == ui_advmode_menu::Default) if (!df::global::adventure->menu == ui_advmode_menu::Default)
return CR_OK; return CR_OK;
auto dir = in->direction(); auto dir = in->direction();
keyQueue.push(interface_key::A_JUMP); keyQueue.push(interface_key::A_JUMP);
@ -233,7 +233,7 @@ command_result JumpCommand(DFHack::color_ostream &stream, const MoveCommandParam
command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in, MenuContents *out) command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in, MenuContents *out)
{ {
auto advUi = df::global::ui_advmode; auto advUi = df::global::adventure;
if (advUi == NULL) if (advUi == NULL)
return CR_FAILURE; return CR_FAILURE;
@ -278,7 +278,7 @@ command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in,
command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in) command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in)
{ {
if (!(df::global::ui_advmode->menu == ui_advmode_menu::MoveCarefully)) if (!(df::global::adventure->menu == ui_advmode_menu::MoveCarefully))
return CR_OK; return CR_OK;
int choice = in->value(); int choice = in->value();
int page = choice / 5; int page = choice / 5;
@ -293,7 +293,7 @@ command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfprot
command_result MiscMoveCommand(DFHack::color_ostream &stream, const MiscMoveParams *in) command_result MiscMoveCommand(DFHack::color_ostream &stream, const MiscMoveParams *in)
{ {
if (!df::global::ui_advmode->menu == ui_advmode_menu::Default) if (!df::global::adventure->menu == ui_advmode_menu::Default)
return CR_OK; return CR_OK;
auto type = in->type(); auto type = in->type();

@ -12,9 +12,9 @@
#include "df/job_list_link.h" #include "df/job_list_link.h"
#include "df/interface_button_construction_building_selectorst.h" #include "df/interface_button_construction_building_selectorst.h"
#include "df/interface_button_construction_category_selectorst.h" #include "df/interface_button_construction_category_selectorst.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "df/viewscreen.h" #include "df/viewscreen.h"
#include "df/world.h" #include "df/world.h"
@ -233,7 +233,7 @@ command_result SetPauseState(color_ostream &stream, const SingleBool *in)
void CopyBuildMenu(DwarfControl::SidebarState * out) void CopyBuildMenu(DwarfControl::SidebarState * out)
{ {
auto menus = df::global::ui_sidebar_menus; auto menus = df::global::game;
auto build_selector = df::global::ui_build_selector; auto build_selector = df::global::ui_build_selector;
if (build_selector->building_type == -1) if (build_selector->building_type == -1)
for (size_t i = 0; i < menus->building.choices_visible.size(); i++) for (size_t i = 0; i < menus->building.choices_visible.size(); i++)
@ -303,9 +303,9 @@ void CopyBuildMenu(DwarfControl::SidebarState * out)
command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, DwarfControl::SidebarState *out) command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, DwarfControl::SidebarState *out)
{ {
auto ui = df::global::ui; auto plotinfo = df::global::plotinfo;
out->set_mode((proto::enums::ui_sidebar_mode::ui_sidebar_mode)ui->main.mode); out->set_mode((proto::enums::ui_sidebar_mode::ui_sidebar_mode)plotinfo->main.mode);
auto mode = ui->main.mode; auto mode = plotinfo->main.mode;
switch (mode) switch (mode)
{ {
case ui_sidebar_mode::Default: case ui_sidebar_mode::Default:
@ -427,25 +427,25 @@ command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto::EmptyMe
command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::SidebarCommand *in) command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::SidebarCommand *in)
{ {
auto ui = df::global::ui; auto plotinfo = df::global::plotinfo;
if (in->has_mode()) if (in->has_mode())
{ {
ui_sidebar_mode::ui_sidebar_mode set_mode = (ui_sidebar_mode::ui_sidebar_mode)in->mode(); ui_sidebar_mode::ui_sidebar_mode set_mode = (ui_sidebar_mode::ui_sidebar_mode)in->mode();
if (ui->main.mode != set_mode) if (plotinfo->main.mode != set_mode)
{ {
ui->main.mode = ui_sidebar_mode::Default; plotinfo->main.mode = ui_sidebar_mode::Default;
switch (set_mode) switch (set_mode)
{ {
case ui_sidebar_mode::Build: case ui_sidebar_mode::Build:
keyQueue.push(interface_key::D_BUILDING); keyQueue.push(interface_key::D_BUILDING);
break; break;
default: default:
ui->main.mode = set_mode; plotinfo->main.mode = set_mode;
break; break;
} }
} }
} }
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case ui_sidebar_mode::Build: case ui_sidebar_mode::Build:
if (in->has_action()) if (in->has_action())
@ -454,7 +454,7 @@ command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::Si
if (in->has_menu_index()) if (in->has_menu_index())
index = in->menu_index(); index = in->menu_index();
if(ui_build_selector->building_type == -1) if(ui_build_selector->building_type == -1)
df::global::ui_sidebar_menus->building.cursor = index; df::global::game->building.cursor = index;
if (ui_build_selector->stage == 2) if (ui_build_selector->stage == 2)
{ {
ui_build_selector->sel_index = index; ui_build_selector->sel_index = index;

@ -89,7 +89,7 @@
#endif #endif
#include "df/tissue.h" #include "df/tissue.h"
#include "df/tissue_style_raw.h" #include "df/tissue_style_raw.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/unit_wound.h" #include "df/unit_wound.h"
@ -135,9 +135,9 @@ using namespace df::global;
#else #else
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(gamemode); REQUIRE_GLOBAL(gamemode);
REQUIRE_GLOBAL(ui_advmode); REQUIRE_GLOBAL(adventure);
#endif #endif
// Here go all the command declarations... // Here go all the command declarations...
@ -1887,8 +1887,8 @@ static command_result GetViewInfo(color_ostream &stream, const EmptyMessage *in,
if (gamemode && *gamemode == GameMode::ADVENTURE) if (gamemode && *gamemode == GameMode::ADVENTURE)
out->set_follow_unit_id(world->units.active[0]->id); out->set_follow_unit_id(world->units.active[0]->id);
else else
out->set_follow_unit_id(ui->follow_unit); out->set_follow_unit_id(plotinfo->follow_unit);
out->set_follow_item_id(ui->follow_item); out->set_follow_item_id(plotinfo->follow_item);
return CR_OK; return CR_OK;
} }

@ -13,8 +13,8 @@
#include "modules/Screen.h" #include "modules/Screen.h"
#include <VTableInterpose.h> #include <VTableInterpose.h>
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "df/world.h" #include "df/world.h"
#include "df/squad.h" #include "df/squad.h"
#include "df/unit.h" #include "df/unit.h"
@ -49,8 +49,8 @@ using namespace dfproto;
DFHACK_PLUGIN("rename"); DFHACK_PLUGIN("rename");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_sidebar_menus); REQUIRE_GLOBAL(game);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event); DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event);
@ -59,7 +59,7 @@ static command_result rename(color_ostream &out, vector <string> & parameters);
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{ {
if (world && ui) { if (world && plotinfo) {
commands.push_back(PluginCommand( commands.push_back(PluginCommand(
"rename", "rename",
"Easily rename things.", "Easily rename things.",
@ -135,9 +135,9 @@ struct dwarf_render_zone_hook : df::viewscreen_dwarfmodest {
{ {
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
if (ui->main.mode == ui_sidebar_mode::Zones && if (plotinfo->main.mode == ui_sidebar_mode::Zones &&
ui_sidebar_menus && ui_sidebar_menus->zone.selected && game && game->zone.selected &&
!ui_sidebar_menus->zone.selected->name.empty()) !game->zone.selected->name.empty())
{ {
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
int width = dims.menu_x2 - dims.menu_x1 - 1; int width = dims.menu_x2 - dims.menu_x1 - 1;
@ -146,7 +146,7 @@ struct dwarf_render_zone_hook : df::viewscreen_dwarfmodest {
Screen::fillRect(pen, dims.menu_x1, dims.y1+1, dims.menu_x2, dims.y1+1); Screen::fillRect(pen, dims.menu_x1, dims.y1+1, dims.menu_x2, dims.y1+1);
std::string name; std::string name;
ui_sidebar_menus->zone.selected->getName(&name); game->zone.selected->getName(&name);
Screen::paintString(pen, dims.menu_x1+1, dims.y1+1, name.substr(0, width)); Screen::paintString(pen, dims.menu_x1+1, dims.y1+1, name.substr(0, width));
} }
} }
@ -258,7 +258,7 @@ static bool renameBuilding(df::building *bld, std::string name)
static df::squad *getSquadByIndex(unsigned idx) static df::squad *getSquadByIndex(unsigned idx)
{ {
auto entity = df::historical_entity::find(ui->group_id); auto entity = df::historical_entity::find(plotinfo->group_id);
if (!entity) if (!entity)
return NULL; return NULL;
@ -361,7 +361,7 @@ static command_result rename(color_ostream &out, vector <string> &parameters)
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
} }
ui->main.hotkeys[id-1].name = parameters[2]; plotinfo->main.hotkeys[id-1].name = parameters[2];
} }
else if (cmd == "unit") else if (cmd == "unit")
{ {

@ -94,7 +94,7 @@ rect2d getMapViewport()
{ {
view_rb=area_x2; view_rb=area_x2;
} }
if (menu_pos<area_pos || df::global::ui->main.mode!=0) if (menu_pos<area_pos || df::global::plotinfo->main.mode!=0)
{ {
if (menu_pos >= area_pos) if (menu_pos >= area_pos)
menu_pos = area_pos-1; menu_pos = area_pos-1;

@ -31,7 +31,7 @@ REQUIRE_GLOBAL(cursor);
REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(enabler);
REQUIRE_GLOBAL(gametype); REQUIRE_GLOBAL(gametype);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(window_x); REQUIRE_GLOBAL(window_x);
REQUIRE_GLOBAL(window_y); REQUIRE_GLOBAL(window_y);
REQUIRE_GLOBAL(window_z); REQUIRE_GLOBAL(window_z);

@ -52,7 +52,7 @@ DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(gview); REQUIRE_GLOBAL(gview);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_building_assign_units); REQUIRE_GLOBAL(ui_building_assign_units);
REQUIRE_GLOBAL(ui_building_in_assign); REQUIRE_GLOBAL(ui_building_in_assign);
REQUIRE_GLOBAL(ui_building_item_cursor); REQUIRE_GLOBAL(ui_building_item_cursor);
@ -1878,7 +1878,7 @@ class look_menu_search : public look_menu_search_base
public: public:
bool can_init(df::viewscreen_dwarfmodest *screen) bool can_init(df::viewscreen_dwarfmodest *screen)
{ {
if (ui->main.mode == df::ui_sidebar_mode::LookAround) if (plotinfo->main.mode == df::ui_sidebar_mode::LookAround)
{ {
return look_menu_search_base::can_init(screen); return look_menu_search_base::can_init(screen);
} }
@ -1986,7 +1986,7 @@ class burrow_search : public burrow_search_base
public: public:
bool can_init(df::viewscreen_dwarfmodest *screen) bool can_init(df::viewscreen_dwarfmodest *screen)
{ {
if (ui->main.mode == df::ui_sidebar_mode::Burrows && ui->burrows.in_add_units_mode) if (plotinfo->main.mode == df::ui_sidebar_mode::Burrows && plotinfo->burrows.in_add_units_mode)
{ {
return burrow_search_base::can_init(screen); return burrow_search_base::can_init(screen);
} }
@ -2011,17 +2011,17 @@ public:
vector<df::unit *> *get_primary_list() vector<df::unit *> *get_primary_list()
{ {
return &ui->burrows.list_units; return &plotinfo->burrows.list_units;
} }
vector<bool> *get_secondary_list() vector<bool> *get_secondary_list()
{ {
return &ui->burrows.sel_units; return &plotinfo->burrows.sel_units;
} }
virtual int32_t * get_viewscreen_cursor() virtual int32_t * get_viewscreen_cursor()
{ {
return &ui->burrows.unit_cursor_pos; return &plotinfo->burrows.unit_cursor_pos;
} }
@ -2055,7 +2055,7 @@ class room_assign_search : public room_assign_search_base
public: public:
bool can_init(df::viewscreen_dwarfmodest *screen) bool can_init(df::viewscreen_dwarfmodest *screen)
{ {
if (ui->main.mode == df::ui_sidebar_mode::QueryBuilding && *ui_building_in_assign) if (plotinfo->main.mode == df::ui_sidebar_mode::QueryBuilding && *ui_building_in_assign)
{ {
return room_assign_search_base::can_init(screen); return room_assign_search_base::can_init(screen);
} }

@ -47,8 +47,8 @@
#include "df/report.h" #include "df/report.h"
#include "df/stockpile_links.h" #include "df/stockpile_links.h"
#include "df/strain_type.h" #include "df/strain_type.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_misc_trait.h" #include "df/unit_misc_trait.h"
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
@ -72,7 +72,7 @@ DFHACK_PLUGIN("siege-engine");
REQUIRE_GLOBAL(gamemode); REQUIRE_GLOBAL(gamemode);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(process_jobs); REQUIRE_GLOBAL(process_jobs);
@ -1477,7 +1477,7 @@ static bool isTired(df::unit *worker)
static void releaseTiredWorker(EngineInfo *engine, df::job *job, df::unit *worker) static void releaseTiredWorker(EngineInfo *engine, df::job *job, df::unit *worker)
{ {
// If not in siege // If not in siege
auto &sieges = ui->invasions.list; auto &sieges = plotinfo->invasions.list;
for (size_t i = 0; i < sieges.size(); i++) for (size_t i = 0; i < sieges.size(); i++)
if (sieges[i]->flags.bits.active) if (sieges[i]->flags.bits.active)

@ -11,7 +11,7 @@
#include "LuaTools.h" #include "LuaTools.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
#include "df/viewscreen_joblistst.h" #include "df/viewscreen_joblistst.h"
#include "df/viewscreen_unitlistst.h" #include "df/viewscreen_unitlistst.h"
@ -38,7 +38,7 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
DFHACK_PLUGIN("sort"); DFHACK_PLUGIN("sort");
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui_building_in_assign); REQUIRE_GLOBAL(ui_building_in_assign);
REQUIRE_GLOBAL(ui_building_item_cursor); REQUIRE_GLOBAL(ui_building_item_cursor);
@ -379,11 +379,11 @@ DEFINE_SORT_HANDLER(unit_sorters, dwarfmode, "/Burrows/AddUnits", screen)
{ {
PARSE_SPEC("units", parameters); PARSE_SPEC("units", parameters);
if (compute_order(*pout, L, top, &order, ui->burrows.list_units)) if (compute_order(*pout, L, top, &order, plotinfo->burrows.list_units))
{ {
reorder_cursor(&ui->burrows.unit_cursor_pos, order); reorder_cursor(&plotinfo->burrows.unit_cursor_pos, order);
reorder_vector(&ui->burrows.list_units, order); reorder_vector(&plotinfo->burrows.list_units, order);
reorder_vector(&ui->burrows.sel_units, order); reorder_vector(&plotinfo->burrows.sel_units, order);
} }
} }

@ -4,7 +4,7 @@
#include <df/viewscreen_dwarfmodest.h> #include <df/viewscreen_dwarfmodest.h>
#include <df/announcements.h> #include <df/announcements.h>
#include <df/d_init.h> #include <df/d_init.h>
#include <df/ui.h> #include <df/plotinfost.h>
#include <algorithm> #include <algorithm>
@ -25,12 +25,12 @@ namespace pausing {
bool locked_states[announcement_flag_arr_size]; // locked state (re-applied each frame) bool locked_states[announcement_flag_arr_size]; // locked state (re-applied each frame)
bool allow_player_pause = true; // toggles player pause ability bool allow_player_pause = true; // toggles player pause ability
using df::global::ui; using df::global::plotinfo;
using namespace df::enums; using namespace df::enums;
struct player_pause_hook : df::viewscreen_dwarfmodest { struct player_pause_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key>* input)) { DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key>* input)) {
if ((ui->main.mode == ui_sidebar_mode::Default) && !allow_player_pause) { if ((plotinfo->main.mode == ui_sidebar_mode::Default) && !allow_player_pause) {
input->erase(interface_key::D_PAUSE); input->erase(interface_key::D_PAUSE);
} }
INTERPOSE_NEXT(feed)(input); INTERPOSE_NEXT(feed)(input);

@ -37,7 +37,7 @@ namespace DFHack {
DFHACK_PLUGIN("spectate"); DFHACK_PLUGIN("spectate");
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(pause_state); REQUIRE_GLOBAL(pause_state);
REQUIRE_GLOBAL(d_init); REQUIRE_GLOBAL(d_init);
@ -106,7 +106,7 @@ namespace SP {
out.print(" SETTINGS:\n"); out.print(" SETTINGS:\n");
out.print(" %-20s\t%" PRIi32 "\n", "tick-threshold: ", config.tick_threshold); out.print(" %-20s\t%" PRIi32 "\n", "tick-threshold: ", config.tick_threshold);
if (following_dwarf) if (following_dwarf)
out.print(" %-21s\t%s[id: %d]\n","FOLLOWING:", our_dorf ? our_dorf->name.first_name.c_str() : "nullptr", df::global::ui->follow_unit); out.print(" %-21s\t%s[id: %d]\n","FOLLOWING:", our_dorf ? our_dorf->name.first_name.c_str() : "nullptr", df::global::plotinfo->follow_unit);
} }
void SetUnpauseState(bool state) { void SetUnpauseState(bool state) {
@ -311,7 +311,7 @@ namespace SP {
// if you're looking at a warning about a local address escaping, it means the unit* from units (which aren't local) // if you're looking at a warning about a local address escaping, it means the unit* from units (which aren't local)
size_t idx = follow_any(RNG); size_t idx = follow_any(RNG);
our_dorf = units[idx]; our_dorf = units[idx];
df::global::ui->follow_unit = our_dorf->id; df::global::plotinfo->follow_unit = our_dorf->id;
timestamp = df::global::world->frame_counter; timestamp = df::global::world->frame_counter;
return true; return true;
} else { } else {
@ -362,7 +362,7 @@ namespace SP {
if (!World::ReadPauseState() && tick - last_tick >= 1) { if (!World::ReadPauseState() && tick - last_tick >= 1) {
last_tick = tick; last_tick = tick;
// validate follow state // validate follow state
if (!following_dwarf || !our_dorf || df::global::ui->follow_unit < 0 || tick - timestamp >= config.tick_threshold) { if (!following_dwarf || !our_dorf || df::global::plotinfo->follow_unit < 0 || tick - timestamp >= config.tick_threshold) {
// we're not following anyone // we're not following anyone
following_dwarf = false; following_dwarf = false;
if (!config.disengage) { if (!config.disengage) {

@ -31,8 +31,8 @@
#include "df/power_info.h" #include "df/power_info.h"
#include "df/report.h" #include "df/report.h"
#include "df/tile_designation.h" #include "df/tile_designation.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/workshop_type.h" #include "df/workshop_type.h"
#include "df/world.h" #include "df/world.h"
@ -48,7 +48,7 @@ DFHACK_PLUGIN("steam-engine");
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_build_selector); REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(cursor); REQUIRE_GLOBAL(cursor);
@ -748,7 +748,7 @@ struct dwarfmode_hook : df::viewscreen_dwarfmodest
steam_engine_workshop *get_steam_engine() steam_engine_workshop *get_steam_engine()
{ {
if (ui->main.mode == ui_sidebar_mode::Build && if (plotinfo->main.mode == ui_sidebar_mode::Build &&
ui_build_selector->stage == 1 && ui_build_selector->stage == 1 &&
ui_build_selector->building_type == building_type::Workshop && ui_build_selector->building_type == building_type::Workshop &&
ui_build_selector->building_subtype == workshop_type::Custom) ui_build_selector->building_subtype == workshop_type::Custom)

@ -26,7 +26,7 @@ DFHACK_PLUGIN_IS_ENABLED(enabled);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
bool fast = false; bool fast = false;
@ -56,15 +56,15 @@ public:
if (found) { if (found) {
// Entice the bookkeeper to spend less time update records. // Entice the bookkeeper to spend less time update records.
ui->nobles.bookkeeper_precision += ui->nobles.bookkeeper_precision >> 3; plotinfo->nobles.bookkeeper_precision += plotinfo->nobles.bookkeeper_precision >> 3;
if (!bookkeeping) { if (!bookkeeping) {
command_method("start_bookkeeping", out); command_method("start_bookkeeping", out);
bookkeeping = true; bookkeeping = true;
} }
} else { } else {
// Entice the bookkeeper to update records more often. // Entice the bookkeeper to update records more often.
ui->nobles.bookkeeper_precision -= ui->nobles.bookkeeper_precision >> 5; plotinfo->nobles.bookkeeper_precision -= plotinfo->nobles.bookkeeper_precision >> 5;
ui->nobles.bookkeeper_cooldown -= ui->nobles.bookkeeper_cooldown >> 2; plotinfo->nobles.bookkeeper_cooldown -= plotinfo->nobles.bookkeeper_cooldown >> 2;
if (bookkeeping) { if (bookkeeping) {
command_method("finish_bookkeeping", out); command_method("finish_bookkeeping", out);
bookkeeping = false; bookkeeping = false;

@ -105,7 +105,7 @@ private:
*/ */
void write(); void write();
// parse serialized data into ui indices // parse serialized data into plotinfo indices
void read (); void read ();
/** /**

@ -21,7 +21,7 @@
#include "df/world_data.h" #include "df/world_data.h"
#include "DataDefs.h" #include "DataDefs.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/building_stockpilest.h" #include "df/building_stockpilest.h"
#include "df/stockpile_settings.h" #include "df/stockpile_settings.h"
#include "df/global_objects.h" #include "df/global_objects.h"
@ -42,7 +42,7 @@ using namespace dfstockpiles;
DFHACK_PLUGIN ( "stockpiles" ); DFHACK_PLUGIN ( "stockpiles" );
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(selection_rect); REQUIRE_GLOBAL(selection_rect);
using df::building_stockpilest; using df::building_stockpilest;
@ -59,7 +59,7 @@ static bool loadstock_guard ( df::viewscreen *top );
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands ) DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands )
{ {
if ( world && ui ) if ( world && plotinfo )
{ {
commands.push_back(PluginCommand( commands.push_back(PluginCommand(
"copystock", "copystock",
@ -106,7 +106,7 @@ static bool copystock_guard ( df::viewscreen *top )
if ( !Gui::dwarfmode_hotkey ( top ) ) if ( !Gui::dwarfmode_hotkey ( top ) )
return false; return false;
switch ( ui->main.mode ) switch ( plotinfo->main.mode )
{ {
case Stockpiles: case Stockpiles:
return true; return true;
@ -123,10 +123,10 @@ static command_result copystock ( color_ostream &out, vector <string> & paramete
// HOTKEY COMMAND: CORE ALREADY SUSPENDED // HOTKEY COMMAND: CORE ALREADY SUSPENDED
// For convenience: when used in the stockpiles mode, switch to 'q' // For convenience: when used in the stockpiles mode, switch to 'q'
if ( ui->main.mode == ui_sidebar_mode::Stockpiles ) if ( plotinfo->main.mode == ui_sidebar_mode::Stockpiles )
{ {
world->selected_building = NULL; // just in case it contains some kind of garbage world->selected_building = NULL; // just in case it contains some kind of garbage
ui->main.mode = ui_sidebar_mode::QueryBuilding; plotinfo->main.mode = ui_sidebar_mode::QueryBuilding;
selection_rect->start_x = -30000; selection_rect->start_x = -30000;
out << "Switched back to query building." << endl; out << "Switched back to query building." << endl;
@ -140,8 +140,8 @@ static command_result copystock ( color_ostream &out, vector <string> & paramete
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
} }
ui->stockpile.custom_settings = sp->settings; plotinfo->stockpile.custom_settings = sp->settings;
ui->main.mode = ui_sidebar_mode::Stockpiles; plotinfo->main.mode = ui_sidebar_mode::Stockpiles;
world->selected_stockpile_type = stockpile_category::Custom; world->selected_stockpile_type = stockpile_category::Custom;
out << "Stockpile options copied." << endl; out << "Stockpile options copied." << endl;
@ -156,7 +156,7 @@ static bool savestock_guard ( df::viewscreen *top )
if ( !Gui::dwarfmode_hotkey ( top ) ) if ( !Gui::dwarfmode_hotkey ( top ) )
return false; return false;
switch ( ui->main.mode ) switch ( plotinfo->main.mode )
{ {
case Stockpiles: case Stockpiles:
return true; return true;
@ -175,7 +175,7 @@ static bool loadstock_guard ( df::viewscreen *top )
if ( !Gui::dwarfmode_hotkey ( top ) ) if ( !Gui::dwarfmode_hotkey ( top ) )
return false; return false;
switch ( ui->main.mode ) switch ( plotinfo->main.mode )
{ {
case Stockpiles: case Stockpiles:
return true; return true;

@ -27,7 +27,7 @@
#include "modules/Maps.h" #include "modules/Maps.h"
#include "modules/Units.h" #include "modules/Units.h"
#include "df/building_cagest.h" #include "df/building_cagest.h"
#include "df/ui_advmode.h" #include "df/adventurest.h"
DFHACK_PLUGIN("stocks"); DFHACK_PLUGIN("stocks");
#define PLUGIN_VERSION 0.13 #define PLUGIN_VERSION 0.13

@ -23,7 +23,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/job_item.h" #include "df/job_item.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_preference.h" #include "df/unit_preference.h"
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
@ -39,7 +39,7 @@ using namespace df::enums;
DFHACK_PLUGIN("strangemood"); DFHACK_PLUGIN("strangemood");
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(d_init); REQUIRE_GLOBAL(d_init);
REQUIRE_GLOBAL(created_item_count); REQUIRE_GLOBAL(created_item_count);
REQUIRE_GLOBAL(created_item_type); REQUIRE_GLOBAL(created_item_type);
@ -394,7 +394,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
out.printerr("Strange moods disabled via debug flag!\n"); out.printerr("Strange moods disabled via debug flag!\n");
return CR_FAILURE; return CR_FAILURE;
} }
if (ui->mood_cooldown && !force) if (plotinfo->mood_cooldown && !force)
{ {
out.printerr("Last strange mood happened too recently!\n"); out.printerr("Last strange mood happened too recently!\n");
return CR_FAILURE; return CR_FAILURE;
@ -406,7 +406,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
df::unit *cur = world->units.active[i]; df::unit *cur = world->units.active[i];
if (Units::isCitizen(cur) && cur->flags1.bits.has_mood) if (Units::isCitizen(cur) && cur->flags1.bits.has_mood)
{ {
ui->mood_cooldown = 1000; plotinfo->mood_cooldown = 1000;
out.printerr("A strange mood is already in progress!\n"); out.printerr("A strange mood is already in progress!\n");
return CR_FAILURE; return CR_FAILURE;
} }
@ -466,12 +466,12 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
if (blk->designation[x][y].bits.subterranean && !blk->designation[x][y].bits.hidden) if (blk->designation[x][y].bits.subterranean && !blk->designation[x][y].bits.hidden)
num_revealed_tiles++; num_revealed_tiles++;
} }
if (num_revealed_tiles / 2304 < ui->tasks.num_artifacts) if (num_revealed_tiles / 2304 < plotinfo->tasks.num_artifacts)
{ {
out.printerr("Fortress is not eligible for a strange mood at this time - not enough subterranean tiles revealed.\n"); out.printerr("Fortress is not eligible for a strange mood at this time - not enough subterranean tiles revealed.\n");
return CR_FAILURE; return CR_FAILURE;
} }
if (num_items / 200 < ui->tasks.num_artifacts) if (num_items / 200 < plotinfo->tasks.num_artifacts)
{ {
out.printerr("Fortress is not eligible for a strange mood at this time - not enough items created\n"); out.printerr("Fortress is not eligible for a strange mood at this time - not enough items created\n");
return CR_FAILURE; return CR_FAILURE;
@ -544,7 +544,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
return CR_FAILURE; return CR_FAILURE;
} }
ui->mood_cooldown = 1000; plotinfo->mood_cooldown = 1000;
// If no mood type was specified, pick one randomly // If no mood type was specified, pick one randomly
if (type == mood_type::None) if (type == mood_type::None)
{ {
@ -1034,7 +1034,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
(job->job_type == job_type::StrangeMoodFell) (job->job_type == job_type::StrangeMoodFell)
)) ))
{ {
int extra_items = std::min(rng.df_trandom((ui->tasks.num_artifacts * 20 + moodable_units.size()) / 20 + 1), 7); int extra_items = std::min(rng.df_trandom((plotinfo->tasks.num_artifacts * 20 + moodable_units.size()) / 20 + 1), 7);
df::item_type avoid_type = item_type::NONE; df::item_type avoid_type = item_type::NONE;
int avoid_glass = 0; int avoid_glass = 0;
switch (skill) switch (skill)

@ -20,7 +20,7 @@
#include "df/job.h" #include "df/job.h"
#include "df/job_type.h" #include "df/job_type.h"
#include "df/manager_order.h" #include "df/manager_order.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
#include "modules/Maps.h" #include "modules/Maps.h"
@ -32,14 +32,14 @@ using namespace DFHack;
using namespace std; using namespace std;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
DFHACK_PLUGIN("tailor"); DFHACK_PLUGIN("tailor");
#define AUTOENABLE false #define AUTOENABLE false
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
class Tailor { class Tailor {
// ARMOR, SHOES, HELM, GLOVES, PANTS // ARMOR, SHOES, HELM, GLOVES, PANTS
@ -261,7 +261,7 @@ private:
void create_orders() void create_orders()
{ {
auto entity = world->entities.all[ui->civ_id]; auto entity = world->entities.all[plotinfo->civ_id];
for (auto& a : needed) for (auto& a : needed)
{ {
@ -325,7 +325,7 @@ private:
void place_orders() void place_orders()
{ {
auto entity = world->entities.all[ui->civ_id]; auto entity = world->entities.all[plotinfo->civ_id];
for (auto& o : orders) for (auto& o : orders)
{ {

@ -26,7 +26,7 @@ DFHACK_PLUGIN("trackstop");
DFHACK_PLUGIN_IS_ENABLED(enabled); DFHACK_PLUGIN_IS_ENABLED(enabled);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
/* /*
@ -44,7 +44,7 @@ struct trackstop_hook : public df::viewscreen_dwarfmodest {
}; };
building_trapst *get_selected_trackstop() { building_trapst *get_selected_trackstop() {
if (ui->main.mode != ui_sidebar_mode::QueryBuilding) { if (plotinfo->main.mode != ui_sidebar_mode::QueryBuilding) {
// Not in a building's 'q' menu. // Not in a building's 'q' menu.
return nullptr; return nullptr;
} }
@ -200,7 +200,7 @@ struct roller_hook : public df::viewscreen_dwarfmodest {
}; };
building_rollersst *get_selected_roller() { building_rollersst *get_selected_roller() {
if (ui->main.mode != ui_sidebar_mode::QueryBuilding) { if (plotinfo->main.mode != ui_sidebar_mode::QueryBuilding) {
// Not in a building's 'q' menu. // Not in a building's 'q' menu.
return nullptr; return nullptr;
} }

@ -21,7 +21,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include <VTableInterpose.h> #include <VTableInterpose.h>
#include "../uicommon.h" #include "../uicommon.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_soul.h" #include "df/unit_soul.h"
@ -36,8 +36,8 @@
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_kitchenprefst.h" #include "df/viewscreen_kitchenprefst.h"
#include "df/viewscreen_layer_unit_actionst.h" #include "df/viewscreen_layer_unit_actionst.h"
#include "df/ui_build_selector.h" #include "df/buildreq.h"
#include "df/ui_sidebar_menus.h" #include "df/gamest.h"
#include "df/building_trapst.h" #include "df/building_trapst.h"
#include "df/building_workshopst.h" #include "df/building_workshopst.h"
#include "df/item_actual.h" #include "df/item_actual.h"
@ -78,7 +78,7 @@
#include "tweaks/block-labors.h" #include "tweaks/block-labors.h"
#include "tweaks/burrow-name-cancel.h" #include "tweaks/burrow-name-cancel.h"
#include "tweaks/cage-butcher.h" #include "tweaks/cage-butcher.h"
#include "tweaks/civ-agreement-ui.h" #include "tweaks/civ-agreement-plotinfo.h"
#include "tweaks/condition-material.h" #include "tweaks/condition-material.h"
#include "tweaks/craft-age-wear.h" #include "tweaks/craft-age-wear.h"
#include "tweaks/do-job-now.h" #include "tweaks/do-job-now.h"
@ -117,14 +117,14 @@ DFHACK_PLUGIN("tweak");
DFHACK_PLUGIN_IS_ENABLED(is_enabled); DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(enabler);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
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_look_cursor); REQUIRE_GLOBAL(ui_look_cursor);
REQUIRE_GLOBAL(ui_menu_width); REQUIRE_GLOBAL(ui_menu_width);
REQUIRE_GLOBAL(ui_sidebar_menus); REQUIRE_GLOBAL(game);
REQUIRE_GLOBAL(ui_unit_view_mode); REQUIRE_GLOBAL(ui_unit_view_mode);
REQUIRE_GLOBAL(ui_workshop_in_add); REQUIRE_GLOBAL(ui_workshop_in_add);
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
@ -449,7 +449,7 @@ static command_result tweak(color_ostream &out, vector <string> &parameters)
// if it happens that the player has 'foreign' units of the same race // if it happens that the player has 'foreign' units of the same race
// (vanilla df: dwarves not from mountainhome) on his map, just grab them // (vanilla df: dwarves not from mountainhome) on his map, just grab them
if(!Units::isOwnCiv(unit)) if(!Units::isOwnCiv(unit))
unit->civ_id = ui->civ_id; unit->civ_id = plotinfo->civ_id;
return fix_clothing_ownership(out, unit); return fix_clothing_ownership(out, unit);
} }
@ -468,7 +468,7 @@ static command_result tweak(color_ostream &out, vector <string> &parameters)
if(Units::isForest(unit)) if(Units::isForest(unit))
unit->flags1.bits.forest = 0; unit->flags1.bits.forest = 0;
if(!Units::isOwnCiv(unit)) if(!Units::isOwnCiv(unit))
unit->civ_id = ui->civ_id; unit->civ_id = plotinfo->civ_id;
if(unit->profession == df::profession::MERCHANT) if(unit->profession == df::profession::MERCHANT)
unit->profession = df::profession::TRADER; unit->profession = df::profession::TRADER;
if(unit->profession2 == df::profession::MERCHANT) if(unit->profession2 == df::profession::MERCHANT)

@ -6,7 +6,7 @@
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
using namespace DFHack; using namespace DFHack;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_look_cursor; using df::global::ui_look_cursor;
using df::global::ui_unit_view_mode; using df::global::ui_unit_view_mode;
@ -15,7 +15,7 @@ struct block_labors_hook : df::viewscreen_dwarfmodest {
inline bool valid_mode() inline bool valid_mode()
{ {
return ui->main.mode == df::ui_sidebar_mode::ViewUnits && return plotinfo->main.mode == df::ui_sidebar_mode::ViewUnits &&
ui_unit_view_mode->value == df::ui_unit_view_mode::T_value::PrefLabor && ui_unit_view_mode->value == df::ui_unit_view_mode::T_value::PrefLabor &&
Gui::getAnyUnit(this); Gui::getAnyUnit(this);
} }

@ -1,6 +1,6 @@
#include "df/burrow.h" #include "df/burrow.h"
using df::global::ui; using df::global::plotinfo;
struct burrow_name_cancel_hook : df::viewscreen_dwarfmodest { struct burrow_name_cancel_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
@ -9,15 +9,15 @@ struct burrow_name_cancel_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input)) DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input))
{ {
if (ui->main.mode == df::ui_sidebar_mode::Burrows) if (plotinfo->main.mode == df::ui_sidebar_mode::Burrows)
{ {
bool was_naming = ui->burrows.in_edit_name_mode; bool was_naming = plotinfo->burrows.in_edit_name_mode;
INTERPOSE_NEXT(feed)(input); INTERPOSE_NEXT(feed)(input);
df::burrow *burrow = vector_get(ui->burrows.list, ui->burrows.sel_index); df::burrow *burrow = vector_get(plotinfo->burrows.list, plotinfo->burrows.sel_index);
if (!burrow) if (!burrow)
return; return;
if (ui->burrows.in_edit_name_mode) if (plotinfo->burrows.in_edit_name_mode)
{ {
if (!was_naming) if (!was_naming)
{ {
@ -27,7 +27,7 @@ struct burrow_name_cancel_hook : df::viewscreen_dwarfmodest {
if (input->count(df::interface_key::LEAVESCREEN)) if (input->count(df::interface_key::LEAVESCREEN))
{ {
// Cancel and restore the old name // Cancel and restore the old name
ui->burrows.in_edit_name_mode = false; plotinfo->burrows.in_edit_name_mode = false;
burrow->name = old_name; burrow->name = old_name;
} }
} }

@ -6,7 +6,7 @@
#include "df/unit.h" #include "df/unit.h"
using namespace DFHack; using namespace DFHack;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_building_in_assign; using df::global::ui_building_in_assign;
using df::global::ui_building_in_resize; using df::global::ui_building_in_resize;
using df::global::ui_building_item_cursor; using df::global::ui_building_item_cursor;
@ -19,7 +19,7 @@ struct cage_butcher_hook : df::viewscreen_dwarfmodest {
if (*ui_building_in_assign || *ui_building_in_resize) if (*ui_building_in_assign || *ui_building_in_resize)
return nullptr; return nullptr;
if (ui->main.mode != df::ui_sidebar_mode::QueryBuilding) if (plotinfo->main.mode != df::ui_sidebar_mode::QueryBuilding)
return nullptr; return nullptr;
auto cage = virtual_cast<df::building_cagest>(Gui::getAnyBuilding(this)); auto cage = virtual_cast<df::building_cagest>(Gui::getAnyBuilding(this));

@ -6,15 +6,15 @@ using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::world; using df::global::world;
using df::global::ui; using df::global::plotinfo;
struct egg_fertile_hook : df::viewscreen_dwarfmodest { struct egg_fertile_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
df::building_nest_boxst* getNestBox() df::building_nest_boxst* getNestBox()
{ {
if (ui->main.mode != ui_sidebar_mode::QueryBuilding && if (plotinfo->main.mode != ui_sidebar_mode::QueryBuilding &&
ui->main.mode != ui_sidebar_mode::BuildingItems) plotinfo->main.mode != ui_sidebar_mode::BuildingItems)
return NULL; return NULL;
return virtual_cast<df::building_nest_boxst>(world->selected_building); return virtual_cast<df::building_nest_boxst>(world->selected_building);
} }
@ -38,7 +38,7 @@ struct egg_fertile_hook : df::viewscreen_dwarfmodest {
has_eggs = true; has_eggs = true;
if (egg->egg_flags.bits.fertile) if (egg->egg_flags.bits.fertile)
fertile = true; fertile = true;
if (ui->main.mode == ui_sidebar_mode::BuildingItems) if (plotinfo->main.mode == ui_sidebar_mode::BuildingItems)
{ {
Screen::paintString( Screen::paintString(
Screen::Pen(' ', fertile ? COLOR_LIGHTGREEN : COLOR_LIGHTRED), Screen::Pen(' ', fertile ? COLOR_LIGHTGREEN : COLOR_LIGHTRED),
@ -50,7 +50,7 @@ struct egg_fertile_hook : df::viewscreen_dwarfmodest {
} }
++idx; ++idx;
} }
if (has_eggs && ui->main.mode == ui_sidebar_mode::QueryBuilding) if (has_eggs && plotinfo->main.mode == ui_sidebar_mode::QueryBuilding)
{ {
Screen::paintString( Screen::paintString(
Screen::Pen(' ', fertile ? COLOR_LIGHTGREEN : COLOR_LIGHTRED), Screen::Pen(' ', fertile ? COLOR_LIGHTGREEN : COLOR_LIGHTRED),

@ -4,7 +4,7 @@
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_building_item_cursor; using df::global::ui_building_item_cursor;
using df::global::world; using df::global::world;
@ -13,7 +13,7 @@ struct farm_select_hook : df::viewscreen_dwarfmodest {
df::building_farmplotst* getFarmPlot() df::building_farmplotst* getFarmPlot()
{ {
if (ui->main.mode != ui_sidebar_mode::QueryBuilding) if (plotinfo->main.mode != ui_sidebar_mode::QueryBuilding)
return NULL; return NULL;
VIRTUAL_CAST_VAR(farm_plot, df::building_farmplotst, world->selected_building); VIRTUAL_CAST_VAR(farm_plot, df::building_farmplotst, world->selected_building);
return farm_plot; return farm_plot;
@ -44,12 +44,12 @@ struct farm_select_hook : df::viewscreen_dwarfmodest {
return false; return false;
} }
inline int32_t getSelectedCropId() { return ui->selected_farm_crops[*ui_building_item_cursor]; } inline int32_t getSelectedCropId() { return plotinfo->selected_farm_crops[*ui_building_item_cursor]; }
DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *input)) DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *input))
{ {
df::building_farmplotst* farm_plot = getFarmPlot(); df::building_farmplotst* farm_plot = getFarmPlot();
if (farm_plot && ui->selected_farm_crops.size() > 0) if (farm_plot && plotinfo->selected_farm_crops.size() > 0)
{ {
if (input->count(interface_key::SELECT_ALL)) if (input->count(interface_key::SELECT_ALL))
{ {
@ -77,7 +77,7 @@ struct farm_select_hook : df::viewscreen_dwarfmodest {
{ {
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
auto farm_plot = getFarmPlot(); auto farm_plot = getFarmPlot();
if (!farm_plot || !ui->selected_farm_crops.size()) if (!farm_plot || !plotinfo->selected_farm_crops.size())
return; return;
if (farm_plot->getBuildStage() != farm_plot->getMaxBuildStage()) if (farm_plot->getBuildStage() != farm_plot->getMaxBuildStage())
return; return;

@ -3,7 +3,7 @@
using namespace DFHack; using namespace DFHack;
using df::global::gps; using df::global::gps;
using df::global::ui_sidebar_menus; using df::global::game;
struct hide_priority_hook : df::viewscreen_dwarfmodest { struct hide_priority_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
@ -14,7 +14,7 @@ struct hide_priority_hook : df::viewscreen_dwarfmodest {
inline bool valid_mode () inline bool valid_mode ()
{ {
switch (ui->main.mode) switch (plotinfo->main.mode)
{ {
case df::ui_sidebar_mode::DesignateMine: case df::ui_sidebar_mode::DesignateMine:
case df::ui_sidebar_mode::DesignateRemoveRamps: case df::ui_sidebar_mode::DesignateRemoveRamps:
@ -41,7 +41,7 @@ struct hide_priority_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, render, ()) DEFINE_VMETHOD_INTERPOSE(void, render, ())
{ {
if (!was_valid_mode && valid_mode() && toggled_manually) { if (!was_valid_mode && valid_mode() && toggled_manually) {
ui_sidebar_menus->designation.priority_set = last_show_priorities_setting; game->designation.priority_set = last_show_priorities_setting;
} }
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
if (valid_mode()) if (valid_mode())
@ -51,7 +51,7 @@ struct hide_priority_hook : df::viewscreen_dwarfmodest {
{ {
int x = dims.menu_x1 + 1, y = gps->dimy - (gps->dimy > 26 ? 8 : 7); int x = dims.menu_x1 + 1, y = gps->dimy - (gps->dimy > 26 ? 8 : 7);
OutputToggleString(x, y, "Show priorities", df::interface_key::CUSTOM_ALT_P, OutputToggleString(x, y, "Show priorities", df::interface_key::CUSTOM_ALT_P,
ui_sidebar_menus->designation.priority_set, true, 0, game->designation.priority_set, true, 0,
COLOR_WHITE, COLOR_LIGHTRED); COLOR_WHITE, COLOR_LIGHTRED);
} }
} }
@ -61,9 +61,9 @@ struct hide_priority_hook : df::viewscreen_dwarfmodest {
{ {
if (valid_mode() && input->count(df::interface_key::CUSTOM_ALT_P)) if (valid_mode() && input->count(df::interface_key::CUSTOM_ALT_P))
{ {
ui_sidebar_menus->designation.priority_set = !ui_sidebar_menus->designation.priority_set; game->designation.priority_set = !game->designation.priority_set;
toggled_manually = true; toggled_manually = true;
last_show_priorities_setting = ui_sidebar_menus->designation.priority_set; last_show_priorities_setting = game->designation.priority_set;
} }
else else
INTERPOSE_NEXT(feed)(input); INTERPOSE_NEXT(feed)(input);

@ -1,6 +1,6 @@
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
using df::global::ui; using df::global::plotinfo;
struct hotkey_clear_hook : df::viewscreen_dwarfmodest { struct hotkey_clear_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
@ -8,7 +8,7 @@ struct hotkey_clear_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, render, ()) DEFINE_VMETHOD_INTERPOSE(void, render, ())
{ {
INTERPOSE_NEXT(render)(); INTERPOSE_NEXT(render)();
if (ui->main.mode == df::ui_sidebar_mode::Hotkeys) if (plotinfo->main.mode == df::ui_sidebar_mode::Hotkeys)
{ {
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
int x = dims.menu_x1 + 1, y = 19; int x = dims.menu_x1 + 1, y = 19;
@ -18,11 +18,11 @@ struct hotkey_clear_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *input)) DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *input))
{ {
if (ui->main.mode == df::ui_sidebar_mode::Hotkeys && if (plotinfo->main.mode == df::ui_sidebar_mode::Hotkeys &&
input->count(df::interface_key::CUSTOM_C) && input->count(df::interface_key::CUSTOM_C) &&
!ui->main.in_rename_hotkey) !plotinfo->main.in_rename_hotkey)
{ {
auto &hotkey = ui->main.hotkeys[ui->main.selected_hotkey]; auto &hotkey = plotinfo->main.hotkeys[plotinfo->main.selected_hotkey];
hotkey.name = ""; hotkey.name = "";
hotkey.cmd = df::ui_hotkey::T_cmd::None; hotkey.cmd = df::ui_hotkey::T_cmd::None;
hotkey.x = 0; hotkey.x = 0;

@ -22,7 +22,7 @@ struct max_wheelbarrow_hook : df::viewscreen_dwarfmodest {
df::building_stockpilest* getStockpile() df::building_stockpilest* getStockpile()
{ {
if (ui->main.mode != ui_sidebar_mode::QueryBuilding) if (plotinfo->main.mode != ui_sidebar_mode::QueryBuilding)
return NULL; return NULL;
return virtual_cast<df::building_stockpilest>(world->selected_building); return virtual_cast<df::building_stockpilest>(world->selected_building);
} }

@ -1,13 +1,13 @@
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
struct shift_8_scroll_hook : df::viewscreen_dwarfmodest { struct shift_8_scroll_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base; typedef df::viewscreen_dwarfmodest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key>* input)) DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key>* input))
{ {
if (ui->main.mode != ui_sidebar_mode::Default && if (plotinfo->main.mode != ui_sidebar_mode::Default &&
input->count(interface_key::CURSOR_UP_FAST) && input->count(interface_key::CURSOR_UP_FAST) &&
input->count(interface_key::SECONDSCROLL_PAGEDOWN) input->count(interface_key::SECONDSCROLL_PAGEDOWN)
) )

@ -6,7 +6,7 @@ using namespace std;
using namespace DFHack; using namespace DFHack;
using namespace df::enums; using namespace df::enums;
using df::global::ui; using df::global::plotinfo;
using df::global::ui_build_selector; using df::global::ui_build_selector;
using df::global::ui_menu_width; using df::global::ui_menu_width;
@ -18,7 +18,7 @@ struct stable_cursor_hook : df::viewscreen_dwarfmodest
bool check_default() bool check_default()
{ {
switch (ui->main.mode) { switch (plotinfo->main.mode) {
case ui_sidebar_mode::Default: case ui_sidebar_mode::Default:
return true; return true;

@ -24,7 +24,7 @@
#include "df/dfhack_material_category.h" #include "df/dfhack_material_category.h"
#include "df/enabler.h" #include "df/enabler.h"
#include "df/item_quality.h" #include "df/item_quality.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/world.h" #include "df/world.h"
using namespace std; using namespace std;
@ -217,7 +217,7 @@ static inline char get_string_input(const std::set<df::interface_key> *input)
static inline df::building_stockpilest *get_selected_stockpile() static inline df::building_stockpilest *get_selected_stockpile()
{ {
if (!Gui::dwarfmode_hotkey(Core::getTopViewscreen()) || if (!Gui::dwarfmode_hotkey(Core::getTopViewscreen()) ||
df::global::ui->main.mode != ui_sidebar_mode::QueryBuilding) df::global::plotinfo->main.mode != ui_sidebar_mode::QueryBuilding)
{ {
return nullptr; return nullptr;
} }
@ -227,10 +227,10 @@ static inline df::building_stockpilest *get_selected_stockpile()
static inline bool can_trade() static inline bool can_trade()
{ {
if (df::global::ui->caravans.size() == 0) if (df::global::plotinfo->caravans.size() == 0)
return false; return false;
for (auto it = df::global::ui->caravans.begin(); it != df::global::ui->caravans.end(); it++) for (auto it = df::global::plotinfo->caravans.begin(); it != df::global::plotinfo->caravans.end(); it++)
{ {
typedef df::caravan_state::T_trade_state state; typedef df::caravan_state::T_trade_state state;
auto caravan = *it; auto caravan = *it;

@ -15,7 +15,7 @@
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/building_workshopst.h" #include "df/building_workshopst.h"
#include "df/building_furnacest.h" #include "df/building_furnacest.h"
#include "df/job.h" #include "df/job.h"
@ -51,7 +51,7 @@ using namespace df::enums;
DFHACK_PLUGIN("workflow"); DFHACK_PLUGIN("workflow");
REQUIRE_GLOBAL(world); REQUIRE_GLOBAL(world);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_workshop_job_cursor); REQUIRE_GLOBAL(ui_workshop_job_cursor);
REQUIRE_GLOBAL(job_next_id); REQUIRE_GLOBAL(job_next_id);
@ -64,7 +64,7 @@ static void cleanup_state(color_ostream &out);
DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, std::vector <PluginCommand> &commands)
{ {
if (!world || !ui) if (!world || !plotinfo)
return CR_FAILURE; return CR_FAILURE;
if (ui_workshop_job_cursor && job_next_id) { if (ui_workshop_job_cursor && job_next_id) {
@ -1684,7 +1684,7 @@ static command_result workflow_cmd(color_ostream &out, vector <string> & paramet
//df::job *job = NULL; //df::job *job = NULL;
if (Gui::dwarfmode_hotkey(Core::getTopViewscreen()) && if (Gui::dwarfmode_hotkey(Core::getTopViewscreen()) &&
ui->main.mode == ui_sidebar_mode::QueryBuilding) plotinfo->main.mode == ui_sidebar_mode::QueryBuilding)
{ {
workshop = world->selected_building; workshop = world->selected_building;
//job = Gui::getSelectedWorkshopJob(out, true); //job = Gui::getSelectedWorkshopJob(out, true);

@ -24,7 +24,7 @@
#include "df/building_chainst.h" #include "df/building_chainst.h"
#include "df/building_civzonest.h" #include "df/building_civzonest.h"
#include "df/general_ref_building_civzone_assignedst.h" #include "df/general_ref_building_civzone_assignedst.h"
#include "df/ui.h" #include "df/plotinfost.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_relationship_type.h" #include "df/unit_relationship_type.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
@ -56,7 +56,7 @@ DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(cursor); REQUIRE_GLOBAL(cursor);
REQUIRE_GLOBAL(gps); REQUIRE_GLOBAL(gps);
REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(plotinfo);
REQUIRE_GLOBAL(ui_building_item_cursor); REQUIRE_GLOBAL(ui_building_item_cursor);
REQUIRE_GLOBAL(ui_building_assign_type); REQUIRE_GLOBAL(ui_building_assign_type);
REQUIRE_GLOBAL(ui_building_assign_is_marked); REQUIRE_GLOBAL(ui_building_assign_is_marked);
@ -1565,7 +1565,7 @@ static command_result df_zone(color_ostream &out, vector <string> & parameters)
if(!race_filter_set && (building_assign || cagezone_assign || unit_slaughter)) if(!race_filter_set && (building_assign || cagezone_assign || unit_slaughter))
{ {
string own_race_name = Units::getRaceNameById(ui->race_id); string own_race_name = Units::getRaceNameById(plotinfo->race_id);
out.color(COLOR_BROWN); out.color(COLOR_BROWN);
out << "Default filter for " << parameters[0] out << "Default filter for " << parameters[0]
<< ": 'not (race " << own_race_name << " or own civilization)'; use 'race " << ": 'not (race " << own_race_name << " or own civilization)'; use 'race "
@ -2128,14 +2128,14 @@ struct zone_hook : public df::viewscreen_dwarfmodest
DEFINE_VMETHOD_INTERPOSE(void, render, ()) DEFINE_VMETHOD_INTERPOSE(void, render, ())
{ {
if ( ( (ui->main.mode == ui_sidebar_mode::ZonesPenInfo || ui->main.mode == ui_sidebar_mode::ZonesPitInfo) && if ( ( (plotinfo->main.mode == ui_sidebar_mode::ZonesPenInfo || plotinfo->main.mode == ui_sidebar_mode::ZonesPitInfo) &&
ui_building_assign_type && ui_building_assign_units && ui_building_assign_type && ui_building_assign_units &&
ui_building_assign_is_marked && ui_building_assign_items && ui_building_assign_is_marked && ui_building_assign_items &&
ui_building_assign_type->size() == ui_building_assign_units->size() && ui_building_assign_type->size() == ui_building_assign_units->size() &&
ui_building_item_cursor) ui_building_item_cursor)
// allow mode QueryBuilding, but only for cages (bedrooms will crash DF with this code, chains don't work either etc) // allow mode QueryBuilding, but only for cages (bedrooms will crash DF with this code, chains don't work either etc)
|| ||
( ui->main.mode == ui_sidebar_mode::QueryBuilding && ( plotinfo->main.mode == ui_sidebar_mode::QueryBuilding &&
ui_building_in_assign && *ui_building_in_assign && ui_building_in_assign && *ui_building_in_assign &&
ui_building_assign_type && ui_building_assign_units && ui_building_assign_type && ui_building_assign_units &&
ui_building_assign_type->size() == ui_building_assign_units->size() && ui_building_assign_type->size() == ui_building_assign_units->size() &&
@ -2146,7 +2146,7 @@ struct zone_hook : public df::viewscreen_dwarfmodest
) )
{ {
if (vector_get(*ui_building_assign_units, *ui_building_item_cursor)) if (vector_get(*ui_building_assign_units, *ui_building_item_cursor))
filter.initialize(ui->main.mode); filter.initialize(plotinfo->main.mode);
} }
else else
{ {