Merge branch 'develop' of https://github.com/DFHack/dfhack into develop

develop
Rose 2022-12-26 16:21:54 -08:00
commit 275e893288
14 changed files with 270 additions and 436 deletions

@ -195,8 +195,8 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl
endif() endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.50.03") set(DF_VERSION "50.04")
set(DFHACK_RELEASE "alpha0pre1") set(DFHACK_RELEASE "alpha0")
set(DFHACK_PRERELEASE TRUE) set(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

@ -9,7 +9,7 @@
############################ ############################
# stabilize the cursor of dwarfmode when switching menus # stabilize the cursor of dwarfmode when switching menus
tweak stable-cursor #tweak stable-cursor
# stop stacked liquid/bar/thread/cloth items from lasting forever # stop stacked liquid/bar/thread/cloth items from lasting forever
# if used in reactions that use only a fraction of the dimension. # if used in reactions that use only a fraction of the dimension.
@ -18,114 +18,114 @@ tweak stable-cursor
# make reactions requiring containers usable in advmode - the issue is # make reactions requiring containers usable in advmode - the issue is
# that the screen asks for those reagents to be selected directly # that the screen asks for those reagents to be selected directly
tweak advmode-contained #tweak advmode-contained
# support Shift-Enter in Trade and Move Goods to Depot screens for faster # support Shift-Enter in Trade and Move Goods to Depot screens for faster
# selection; it selects the current item or stack and scrolls down one line # selection; it selects the current item or stack and scrolls down one line
tweak fast-trade #tweak fast-trade
# stop the right list in military->positions from resetting to top all the time # stop the right list in military->positions from resetting to top all the time
tweak military-stable-assign #tweak military-stable-assign
# in same list, color units already assigned to squads in brown & green # in same list, color units already assigned to squads in brown & green
tweak military-color-assigned #tweak military-color-assigned
# make crafted cloth items wear out with time like in old versions (bug 6003) # make crafted cloth items wear out with time like in old versions (bug 6003)
tweak craft-age-wear #tweak craft-age-wear
# stop adamantine clothing from wearing out (bug 6481) # stop adamantine clothing from wearing out (bug 6481)
#tweak adamantine-cloth-wear #tweak adamantine-cloth-wear
# Add "Select all" and "Deselect all" options to farm plot menus # Add "Select all" and "Deselect all" options to farm plot menus
tweak farm-plot-select #tweak farm-plot-select
# Add Shift-Left/Right controls to import agreement screen # Add Shift-Left/Right controls to import agreement screen
tweak import-priority-category #tweak import-priority-category
# Fixes a crash in the work order contition material list (bug 9905). # Fixes a crash in the work order contition material list (bug 9905).
tweak condition-material #tweak condition-material
# Adds an option to clear currently-bound hotkeys # Adds an option to clear currently-bound hotkeys
tweak hotkey-clear #tweak hotkey-clear
# Allows lowercase letters in embark profile names, and allows exiting the name prompt without saving # Allows lowercase letters in embark profile names, and allows exiting the name prompt without saving
tweak embark-profile-name #tweak embark-profile-name
# Reduce performance impact of temperature changes # Reduce performance impact of temperature changes
tweak fast-heat 100 #tweak fast-heat 100
# Misc. UI tweaks # Misc. UI tweaks
tweak block-labors # Prevents labors that can't be used from being toggled #tweak block-labors # Prevents labors that can't be used from being toggled
tweak burrow-name-cancel #tweak burrow-name-cancel
tweak cage-butcher #tweak cage-butcher
tweak civ-view-agreement #tweak civ-view-agreement
tweak do-job-now #tweak do-job-now
tweak eggs-fertile #tweak eggs-fertile
tweak fps-min #tweak fps-min
tweak hide-priority #tweak hide-priority
tweak kitchen-prefs-all #tweak kitchen-prefs-all
tweak kitchen-prefs-empty #tweak kitchen-prefs-empty
tweak max-wheelbarrow #tweak max-wheelbarrow
tweak partial-items #tweak partial-items
tweak shift-8-scroll #tweak shift-8-scroll
tweak stone-status-all #tweak stone-status-all
tweak title-start-rename #tweak title-start-rename
tweak tradereq-pet-gender #tweak tradereq-pet-gender
########################### ###########################
# Globally acting plugins # # Globally acting plugins #
########################### ###########################
# Display DFHack version on title screen # Display DFHack version on title screen
enable title-version #enable title-version
# Dwarf Manipulator (simple in-game Dwarf Therapist replacement) # Dwarf Manipulator (simple in-game Dwarf Therapist replacement)
enable manipulator #enable manipulator
# Search tool in various screens (by falconne) # Search tool in various screens (by falconne)
enable search #enable search
# Improved build material selection interface (by falconne) # Improved build material selection interface (by falconne)
enable automaterial #enable automaterial
# Other interface improvement tools # Other interface improvement tools
enable \ #enable \
overlay \ # overlay \
confirm \ # confirm \
dwarfmonitor \ # dwarfmonitor \
mousequery \ # mousequery \
autogems \ # autogems \
autodump \ # autodump \
automelt \ # automelt \
autotrade \ # autotrade \
buildingplan \ # buildingplan \
trackstop \ # trackstop \
zone \ # zone \
stocks \ # stocks \
autochop \ # autochop \
stockpiles # stockpiles
#end a line with a backslash to make it continue to the next line. The \ is deleted for the final command. #end a line with a backslash to make it continue to the next line. The \ is deleted for the final command.
# Multiline commands are ONLY supported for scripts like dfhack.init. You cannot do multiline command manually on the DFHack console. # Multiline commands are ONLY supported for scripts like dfhack.init. You cannot do multiline command manually on the DFHack console.
# You cannot extend a commented line. # You cannot extend a commented line.
# You can comment out the extension of a line. # You can comment out the extension of a line.
# enable mouse controls and sand indicator in embark screen # enable mouse controls and sand indicator in embark screen
embark-tools enable sticky sand mouse #embark-tools enable sticky sand mouse
# enable option to enter embark assistant # enable option to enter embark assistant
enable embark-assistant #enable embark-assistant
########### ###########
# Scripts # # Scripts #
########### ###########
# write extra information to the gamelog # write extra information to the gamelog
modtools/extra-gamelog enable #modtools/extra-gamelog enable
# extended status screen (bedrooms page) # extended status screen (bedrooms page)
enable gui/extended-status #enable gui/extended-status
# add information to item viewscreens # add information to item viewscreens
view-item-info enable #view-item-info enable
# a replacement for the "load game" screen # a replacement for the "load game" screen
gui/load-screen enable #gui/load-screen enable

@ -1014,10 +1014,12 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, v
else if (first == "fpause") else if (first == "fpause")
{ {
World::SetPauseState(true); World::SetPauseState(true);
/* TODO: understand how this changes for v50
if (auto scr = Gui::getViewscreenByType<df::viewscreen_new_regionst>()) if (auto scr = Gui::getViewscreenByType<df::viewscreen_new_regionst>())
{ {
scr->worldgen_paused = true; scr->worldgen_paused = true;
} }
*/
con.print("The game was forced to pause!\n"); con.print("The game was forced to pause!\n");
} }
else if (first == "cls" || first == "clear") else if (first == "cls" || first == "clear")

@ -5,13 +5,6 @@
#pragma once #pragma once
namespace DFHack { namespace Renderer { namespace DFHack { namespace Renderer {
// If the the 'x' parameter points to this value, then the 'y' parameter will
// be interpreted as a boolean flag for whether to return map coordinates (false)
// or text tile coordinates (true). Only TWBT implements this logic, and this
// sentinel value can be removed once DF provides an API for retrieving the
// two sets of coordinates.
DFHACK_EXPORT extern const int32_t GET_MOUSE_COORDS_SENTINEL;
struct DFHACK_EXPORT renderer_wrap : public df::renderer { struct DFHACK_EXPORT renderer_wrap : public df::renderer {
void set_to_null(); void set_to_null();
void copy_from_parent(); void copy_from_parent();
@ -19,19 +12,12 @@ namespace DFHack { namespace Renderer {
renderer_wrap *parent; renderer_wrap *parent;
renderer_wrap *child; renderer_wrap *child;
virtual void update_tile(int32_t x, int32_t y);
virtual void update_all();
virtual void render();
virtual void set_fullscreen();
virtual void zoom(df::zoom_commands z);
virtual void resize(int32_t w, int32_t h);
virtual void grid_resize(int32_t w, int32_t h);
virtual ~renderer_wrap() { virtual ~renderer_wrap() {
// All necessary cleanup should be handled by RemoveRenderer() // All necessary cleanup should be handled by RemoveRenderer()
}; };
virtual bool get_mouse_coords(int32_t *x, int32_t *y);
virtual bool uses_opengl();
}; };
/* TODO: we can't cat enabler->renderer to renderer_wrap and expect it to work
// Returns the renderer instance given on success, or deletes it and returns NULL on failure // Returns the renderer instance given on success, or deletes it and returns NULL on failure
// Usage: renderer_foo *r = AddRenderer(new renderer_foo) // Usage: renderer_foo *r = AddRenderer(new renderer_foo)
DFHACK_EXPORT renderer_wrap *AddRenderer(renderer_wrap*, bool refresh_screen = false); DFHACK_EXPORT renderer_wrap *AddRenderer(renderer_wrap*, bool refresh_screen = false);
@ -42,4 +28,5 @@ namespace DFHack { namespace Renderer {
{ {
return (renderer_wrap*)(df::global::enabler ? df::global::enabler->renderer : NULL); return (renderer_wrap*)(df::global::enabler ? df::global::enabler->renderer : NULL);
} }
*/
}} }}

@ -687,9 +687,9 @@ GREY_FRAME = {
-- The usual boundary used by the DF screens. Often has fancy pattern in tilesets. -- The usual boundary used by the DF screens. Often has fancy pattern in tilesets.
BOUNDARY_FRAME = { BOUNDARY_FRAME = {
frame_pen = to_pen{ ch = 0xDB, fg = COLOR_DARKGREY, bg = COLOR_BLACK }, frame_pen = to_pen{ ch = 0xDB, fg = COLOR_GREY, bg = COLOR_BLACK },
title_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_GREY }, title_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_GREY },
signature_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_DARKGREY }, signature_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_GREY },
} }
GREY_LINE_FRAME = { GREY_LINE_FRAME = {
@ -701,7 +701,7 @@ GREY_LINE_FRAME = {
rt_frame_pen = to_pen{ ch = 187, fg = COLOR_GREY, bg = COLOR_BLACK }, rt_frame_pen = to_pen{ ch = 187, fg = COLOR_GREY, bg = COLOR_BLACK },
rb_frame_pen = to_pen{ ch = 188, fg = COLOR_GREY, bg = COLOR_BLACK }, rb_frame_pen = to_pen{ ch = 188, fg = COLOR_GREY, bg = COLOR_BLACK },
title_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_GREY }, title_pen = to_pen{ fg = COLOR_BLACK, bg = COLOR_GREY },
signature_pen = to_pen{ fg = COLOR_DARKGREY, bg = COLOR_BLACK }, signature_pen = to_pen{ fg = COLOR_GREY, bg = COLOR_BLACK },
} }
function paint_frame(dc,rect,style,title) function paint_frame(dc,rect,style,title)

@ -1027,6 +1027,9 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
end end
if token.key then if token.key then
if type(token.key) == 'string' and not df.interface_key[token.key] then
error('Invalid interface_key: ' .. token.key)
end
local keystr = gui.getKeyDisplay(token.key) local keystr = gui.getKeyDisplay(token.key)
local sep = token.key_sep or '' local sep = token.key_sep or ''

@ -1,5 +1,6 @@
#include "Core.h" #include "Core.h"
#include "Console.h" #include "Console.h"
#include "Debug.h"
#include "VTableInterpose.h" #include "VTableInterpose.h"
#include "modules/Buildings.h" #include "modules/Buildings.h"
#include "modules/Constructions.h" #include "modules/Constructions.h"
@ -43,6 +44,10 @@
#include <unordered_set> #include <unordered_set>
#include <array> #include <array>
namespace DFHack {
DBG_DECLARE(eventmanager, log, DebugCategory::LINFO);
}
using namespace std; using namespace std;
using namespace DFHack; using namespace DFHack;
using namespace EventManager; using namespace EventManager;
@ -63,6 +68,7 @@ static int32_t eventLastTick[EventType::EVENT_MAX];
static const int32_t ticksPerYear = 403200; static const int32_t ticksPerYear = 403200;
void DFHack::EventManager::registerListener(EventType::EventType e, EventHandler handler, Plugin* plugin) { void DFHack::EventManager::registerListener(EventType::EventType e, EventHandler handler, Plugin* plugin) {
DEBUG(log).print("registering handler %p from plugin %s for event %d\n", handler.eventHandler, plugin->getName().c_str(), e);
handlers[e].insert(pair<Plugin*, EventHandler>(plugin, handler)); handlers[e].insert(pair<Plugin*, EventHandler>(plugin, handler));
} }
@ -78,6 +84,7 @@ int32_t DFHack::EventManager::registerTick(EventHandler handler, int32_t when, P
} }
handler.freq = when; handler.freq = when;
tickQueue.insert(pair<int32_t, EventHandler>(handler.freq, handler)); tickQueue.insert(pair<int32_t, EventHandler>(handler.freq, handler));
DEBUG(log).print("registering handler %p from plugin %s for event TICK\n", handler.eventHandler, plugin->getName().c_str());
handlers[EventType::TICK].insert(pair<Plugin*,EventHandler>(plugin,handler)); handlers[EventType::TICK].insert(pair<Plugin*,EventHandler>(plugin,handler));
return when; return when;
} }
@ -103,6 +110,7 @@ void DFHack::EventManager::unregister(EventType::EventType e, EventHandler handl
i++; i++;
continue; continue;
} }
DEBUG(log).print("unregistering handler %p from plugin %s for event %d\n", handler.eventHandler, plugin->getName().c_str(), e);
i = handlers[e].erase(i); i = handlers[e].erase(i);
if ( e == EventType::TICK ) if ( e == EventType::TICK )
removeFromTickQueue(handler); removeFromTickQueue(handler);
@ -110,6 +118,7 @@ void DFHack::EventManager::unregister(EventType::EventType e, EventHandler handl
} }
void DFHack::EventManager::unregisterAll(Plugin* plugin) { void DFHack::EventManager::unregisterAll(Plugin* plugin) {
DEBUG(log).print("unregistering all handlers for plugin %s\n", plugin->getName().c_str());
for ( auto i = handlers[EventType::TICK].find(plugin); i != handlers[EventType::TICK].end(); i++ ) { for ( auto i = handlers[EventType::TICK].find(plugin); i != handlers[EventType::TICK].end(); i++ ) {
if ( (*i).first != plugin ) if ( (*i).first != plugin )
break; break;
@ -268,6 +277,7 @@ void DFHack::EventManager::onStateChange(color_ostream& out, state_change_event
multimap<Plugin*,EventHandler> copy(handlers[EventType::UNLOAD].begin(), handlers[EventType::UNLOAD].end()); multimap<Plugin*,EventHandler> copy(handlers[EventType::UNLOAD].begin(), handlers[EventType::UNLOAD].end());
for (auto &key_value : copy) { for (auto &key_value : copy) {
DEBUG(log,out).print("calling handler for map unloaded state change event\n");
key_value.second.eventHandler(out, nullptr); key_value.second.eventHandler(out, nullptr);
} }
} else if ( event == DFHack::SC_MAP_LOADED ) { } else if ( event == DFHack::SC_MAP_LOADED ) {
@ -358,6 +368,7 @@ void DFHack::EventManager::manageEvents(color_ostream& out) {
CoreSuspender suspender; CoreSuspender suspender;
int32_t tick = df::global::world->frame_counter; int32_t tick = df::global::world->frame_counter;
TRACE(log,out).print("processing events at tick %d\n", tick);
for ( size_t a = 0; a < EventType::EVENT_MAX; a++ ) { for ( size_t a = 0; a < EventType::EVENT_MAX; a++ ) {
if ( handlers[a].empty() ) if ( handlers[a].empty() )
@ -389,6 +400,7 @@ static void manageTickEvent(color_ostream& out) {
break; break;
EventHandler &handle = (*tickQueue.begin()).second; EventHandler &handle = (*tickQueue.begin()).second;
tickQueue.erase(tickQueue.begin()); tickQueue.erase(tickQueue.begin());
DEBUG(log,out).print("calling handler for tick event\n");
handle.eventHandler(out, (void*)intptr_t(tick)); handle.eventHandler(out, (void*)intptr_t(tick));
toRemove.insert(handle); toRemove.insert(handle);
} }
@ -429,6 +441,7 @@ static void manageJobInitiatedEvent(color_ostream& out) {
continue; continue;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for job initiated event\n");
handle.eventHandler(out, (void*)link->item); handle.eventHandler(out, (void*)link->item);
} }
} }
@ -451,6 +464,7 @@ static void manageJobStartedEvent(color_ostream& out) {
for (auto &key_value : copy) { for (auto &key_value : copy) {
auto &handler = key_value.second; auto &handler = key_value.second;
// the jobs must have a worker to start // the jobs must have a worker to start
DEBUG(log,out).print("calling handler for job started event\n");
handler.eventHandler(out, job); handler.eventHandler(out, job);
} }
} }
@ -561,6 +575,7 @@ static void manageJobCompletedEvent(color_ostream& out) {
//still false positive if cancelled at EXACTLY the right time, but experiments show this doesn't happen //still false positive if cancelled at EXACTLY the right time, but experiments show this doesn't happen
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for repeated job completed event\n");
handle.eventHandler(out, (void*)&job0); handle.eventHandler(out, (void*)&job0);
} }
continue; continue;
@ -573,6 +588,7 @@ static void manageJobCompletedEvent(color_ostream& out) {
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for job completed event\n");
handle.eventHandler(out, (void*)&job0); handle.eventHandler(out, (void*)&job0);
} }
} }
@ -607,6 +623,7 @@ static void manageNewUnitActiveEvent(color_ostream& out) {
int32_t id = unit->id; int32_t id = unit->id;
if (!activeUnits.count(id)) { if (!activeUnits.count(id)) {
activeUnits.emplace(id); activeUnits.emplace(id);
DEBUG(log,out).print("calling handler for new unit event\n");
handler.eventHandler(out, (void*) intptr_t(id)); // intptr_t() avoids cast from smaller type warning handler.eventHandler(out, (void*) intptr_t(id)); // intptr_t() avoids cast from smaller type warning
} }
} }
@ -630,6 +647,7 @@ static void manageUnitDeathEvent(color_ostream& out) {
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for unit death event\n");
handle.eventHandler(out, (void*)intptr_t(unit->id)); handle.eventHandler(out, (void*)intptr_t(unit->id));
} }
livingUnits.erase(unit->id); livingUnits.erase(unit->id);
@ -667,6 +685,7 @@ static void manageItemCreationEvent(color_ostream& out) {
continue; continue;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for item created event\n");
handle.eventHandler(out, (void*)intptr_t(item->id)); handle.eventHandler(out, (void*)intptr_t(item->id));
} }
} }
@ -694,6 +713,7 @@ static void manageBuildingEvent(color_ostream& out) {
buildings.insert(a); buildings.insert(a);
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for created building event\n");
handle.eventHandler(out, (void*)intptr_t(a)); handle.eventHandler(out, (void*)intptr_t(a));
} }
} }
@ -710,6 +730,7 @@ static void manageBuildingEvent(color_ostream& out) {
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for destroyed building event\n");
handle.eventHandler(out, (void*)intptr_t(id)); handle.eventHandler(out, (void*)intptr_t(id));
} }
a = buildings.erase(a); a = buildings.erase(a);
@ -733,6 +754,7 @@ static void manageConstructionEvent(color_ostream& out) {
// send construction to handlers, because it was removed // send construction to handlers, because it was removed
for (const auto &key_value: copy) { for (const auto &key_value: copy) {
EventHandler handle = key_value.second; EventHandler handle = key_value.second;
DEBUG(log,out).print("calling handler for destroyed construction event\n");
handle.eventHandler(out, (void*) &construction); handle.eventHandler(out, (void*) &construction);
} }
// erase from existent constructions // erase from existent constructions
@ -747,6 +769,7 @@ static void manageConstructionEvent(color_ostream& out) {
// send construction to handlers, because it is new // send construction to handlers, because it is new
for (const auto &key_value: copy) { for (const auto &key_value: copy) {
EventHandler handle = key_value.second; EventHandler handle = key_value.second;
DEBUG(log,out).print("calling handler for created construction event\n");
handle.eventHandler(out, (void*) &construction); handle.eventHandler(out, (void*) &construction);
} }
} }
@ -775,6 +798,7 @@ static void manageSyndromeEvent(color_ostream& out) {
SyndromeData data(unit->id, b); SyndromeData data(unit->id, b);
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for syndrome event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -793,6 +817,7 @@ static void manageInvasionEvent(color_ostream& out) {
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for invasion event\n");
handle.eventHandler(out, (void*)intptr_t(nextInvasion-1)); handle.eventHandler(out, (void*)intptr_t(nextInvasion-1));
} }
} }
@ -834,6 +859,7 @@ static void manageEquipmentEvent(color_ostream& out) {
InventoryChangeData data(unit->id, nullptr, &item_new); InventoryChangeData data(unit->id, nullptr, &item_new);
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for new item equipped inventory change event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
continue; continue;
@ -849,6 +875,7 @@ static void manageEquipmentEvent(color_ostream& out) {
InventoryChangeData data(unit->id, &item_old, &item_new); InventoryChangeData data(unit->id, &item_old, &item_new);
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for inventory change event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -860,6 +887,7 @@ static void manageEquipmentEvent(color_ostream& out) {
InventoryChangeData data(unit->id, &i, nullptr); InventoryChangeData data(unit->id, &i, nullptr);
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for dropped item inventory change event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -913,6 +941,7 @@ static void manageReportEvent(color_ostream& out) {
df::report* report = reports[idx]; df::report* report = reports[idx];
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for report event\n");
handle.eventHandler(out, (void*)intptr_t(report->id)); handle.eventHandler(out, (void*)intptr_t(report->id));
} }
lastReport = report->id; lastReport = report->id;
@ -990,6 +1019,7 @@ static void manageUnitAttackEvent(color_ostream& out) {
alreadyDone[data.attacker][data.defender] = 1; alreadyDone[data.attacker][data.defender] = 1;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for unit1 attack unit attack event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -1002,6 +1032,7 @@ static void manageUnitAttackEvent(color_ostream& out) {
alreadyDone[data.attacker][data.defender] = 1; alreadyDone[data.attacker][data.defender] = 1;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for unit2 attack unit attack event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -1013,6 +1044,7 @@ static void manageUnitAttackEvent(color_ostream& out) {
alreadyDone[data.attacker][data.defender] = 1; alreadyDone[data.attacker][data.defender] = 1;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for unit1 killed unit attack event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -1024,6 +1056,7 @@ static void manageUnitAttackEvent(color_ostream& out) {
alreadyDone[data.attacker][data.defender] = 1; alreadyDone[data.attacker][data.defender] = 1;
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for unit2 killed unit attack event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
} }
@ -1282,6 +1315,7 @@ static void manageInteractionEvent(color_ostream& out) {
//fire event //fire event
for (auto &key_value : copy) { for (auto &key_value : copy) {
EventHandler &handle = key_value.second; EventHandler &handle = key_value.second;
DEBUG(log,out).print("calling handler for interaction event\n");
handle.eventHandler(out, (void*)&data); handle.eventHandler(out, (void*)&data);
} }
//TODO: deduce attacker from latest defend event first //TODO: deduce attacker from latest defend event first

@ -66,7 +66,6 @@ using namespace DFHack;
#include "df/item_corpsepiecest.h" #include "df/item_corpsepiecest.h"
#include "df/item_corpsest.h" #include "df/item_corpsest.h"
#include "df/job.h" #include "df/job.h"
#include "df/layer_object_listst.h"
#include "df/occupation.h" #include "df/occupation.h"
#include "df/plant.h" #include "df/plant.h"
#include "df/popup_message.h" #include "df/popup_message.h"
@ -2150,19 +2149,13 @@ bool Gui::setDesignationCoords (const int32_t x, const int32_t y, const int32_t
df::coord Gui::getMousePos() df::coord Gui::getMousePos()
{ {
df::coord pos; df::coord pos;
/* TODO: understand how this changes for v50 if (gps && gps->precise_mouse_x > -1) {
if (gps && gps->mouse_x > -1) {
// return invalid coords if the cursor is not over the map
DwarfmodeDims dims = getDwarfmodeViewDims();
if (gps->mouse_x < dims.map_x1 || gps->mouse_x > dims.map_x2 ||
gps->mouse_y < dims.map_y1 || gps->mouse_y > dims.map_y2) {
return pos;
}
pos = getViewportPos(); pos = getViewportPos();
pos.x += gps->mouse_x - 1; /* TODO: understand how this changes for v50
pos.y += gps->mouse_y - 1; pos.x += gps->mouse_x_pixel / tile_width;
} pos.y += gps->mouse_y_pixel / tile_height;
*/ */
}
return pos; return pos;
} }

@ -7,10 +7,9 @@ using df::global::enabler;
using df::global::gps; using df::global::gps;
using DFHack::Renderer::renderer_wrap; using DFHack::Renderer::renderer_wrap;
/*
static renderer_wrap *original_renderer = NULL; static renderer_wrap *original_renderer = NULL;
const int32_t Renderer::GET_MOUSE_COORDS_SENTINEL = 0xcd1aa471;
bool init() bool init()
{ {
if (!original_renderer) if (!original_renderer)
@ -156,3 +155,4 @@ bool Renderer::renderer_wrap::get_mouse_coords(int32_t* x, int32_t* y) {
bool Renderer::renderer_wrap::uses_opengl() { bool Renderer::renderer_wrap::uses_opengl() {
return parent->uses_opengl(); return parent->uses_opengl();
}; };
*/

@ -34,6 +34,7 @@ using namespace std;
#include "modules/Renderer.h" #include "modules/Renderer.h"
#include "modules/Screen.h" #include "modules/Screen.h"
#include "modules/GuiHooks.h" #include "modules/GuiHooks.h"
#include "Debug.h"
#include "MemAccess.h" #include "MemAccess.h"
#include "VersionInfo.h" #include "VersionInfo.h"
#include "Types.h" #include "Types.h"
@ -49,10 +50,11 @@ using namespace DFHack;
#include "DataDefs.h" #include "DataDefs.h"
#include "df/init.h" #include "df/init.h"
#include "df/texture_handler.h" #include "df/texture_handlerst.h"
#include "df/tile_page.h" #include "df/tile_pagest.h"
#include "df/interfacest.h" #include "df/interfacest.h"
#include "df/enabler.h" #include "df/enabler.h"
#include "df/graphic_map_portst.h"
#include "df/unit.h" #include "df/unit.h"
#include "df/item.h" #include "df/item.h"
#include "df/job.h" #include "df/job.h"
@ -72,30 +74,29 @@ using Screen::PenArray;
using std::string; using std::string;
namespace DFHack {
DBG_DECLARE(core, screen, DebugCategory::LINFO);
}
/* /*
* Screen painting API. * Screen painting API.
*/ */
// returns text grid coordinates, even if the game map is scaled differently // returns ui grid coordinates, even if the game map is scaled differently
df::coord2d Screen::getMousePos() df::coord2d Screen::getMousePos()
{ {
int32_t pixelx = 0, pixely = 0, tilex = 0, tiley = 0; if (!gps)
if (!enabler || !enabler->renderer->get_mouse_coords(
&pixelx, &pixely, &tilex, &tiley)) {
return df::coord2d(-1, -1); return df::coord2d(-1, -1);
} return df::coord2d(gps->mouse_x, gps->mouse_y);
return df::coord2d(tilex, tiley);
} }
// returns the screen pixel coordinates // returns the screen pixel coordinates
df::coord2d Screen::getMousePixels() df::coord2d Screen::getMousePixels()
{ {
int32_t pixelx = 0, pixely = 0, tilex = 0, tiley = 0; if (!gps)
if (!enabler || !enabler->renderer->get_mouse_coords(
&pixelx, &pixely, &tilex, &tiley)) {
return df::coord2d(-1, -1); return df::coord2d(-1, -1);
} return df::coord2d(gps->precise_mouse_x, gps->precise_mouse_y);
return df::coord2d(pixelx, pixely);
} }
df::coord2d Screen::getWindowSize() df::coord2d Screen::getWindowSize()
@ -116,22 +117,36 @@ bool Screen::inGraphicsMode()
static bool doSetTile_default(const Pen &pen, int x, int y, bool map) static bool doSetTile_default(const Pen &pen, int x, int y, bool map)
{ {
auto dim = Screen::getWindowSize(); // TODO: understand how this changes for v50
if (x < 0 || x >= dim.x || y < 0 || y >= dim.y) size_t index = ((x * gps->dimy) + y);
return false; if (!map) {
// don't let DF overlay interface elements draw over us
/* TODO: understand how this changes for v50 gps->screentexpos_anchored[index] = 0;
int index = ((x * gps->dimy) + y); gps->screentexpos_top[index] = 0;
auto screen = gps->screen + index*4; gps->screentexpos_flag[index] = 0;
screen[0] = uint8_t(pen.ch); }
screen[1] = uint8_t(pen.fg) & 15; //gps->screen1_opt_tile[index] = uint8_t(pen.tile);
screen[2] = uint8_t(pen.bg) & 15; auto fg = &gps->uccolor[pen.fg][0];
screen[3] = uint8_t(pen.bold) & 1; auto bg = &gps->uccolor[pen.bg][0];
gps->screentexpos[index] = pen.tile; auto argb = &gps->screen[index * 8];
gps->screentexpos_addcolor[index] = (pen.tile_mode == Screen::Pen::CharColor); argb[0] = uint8_t(pen.ch);
gps->screentexpos_grayscale[index] = (pen.tile_mode == Screen::Pen::TileColor); argb[1] = fg[0];
gps->screentexpos_cf[index] = pen.tile_fg; argb[2] = fg[1];
gps->screentexpos_cbr[index] = pen.tile_bg; argb[3] = fg[2];
argb[4] = bg[0];
argb[5] = bg[1];
argb[6] = bg[2];
/* old code
// auto screen = gps->screen + index*4;
// screen[0] = uint8_t(pen.ch);
// screen[1] = uint8_t(pen.fg) & 15;
// screen[2] = uint8_t(pen.bg) & 15;
// screen[3] = uint8_t(pen.bold) & 1;
// gps->screentexpos[index] = pen.tile;
// gps->screentexpos_addcolor[index] = (pen.tile_mode == Screen::Pen::CharColor);
// gps->screentexpos_grayscale[index] = (pen.tile_mode == Screen::Pen::TileColor);
// gps->screentexpos_cf[index] = pen.tile_fg;
// gps->screentexpos_cbr[index] = pen.tile_bg;
*/ */
return true; return true;
} }
@ -592,11 +607,13 @@ bool dfhack_viewscreen::key_conflict(df::interface_key key)
if (key == interface_key::OPTIONS) if (key == interface_key::OPTIONS)
return true; return true;
/* TODO: understand how this changes for v50
if (text_input_mode) if (text_input_mode)
{ {
if (key == interface_key::HELP || key == interface_key::MOVIES) if (key == interface_key::HELP || key == interface_key::MOVIES)
return true; return true;
} }
*/
return false; return false;
} }

@ -1 +1 @@
Subproject commit 7ad3f05c5b3608f6fc7fad439cca8acd776dec30 Subproject commit c4d78c229aa0edd68a69cd5b19d5ad35a5b71098

@ -2,12 +2,12 @@ include(Plugins.cmake)
option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF) option(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
if(BUILD_STONESENSE) if(BUILD_STONESENSE)
add_subdirectory(stonesense) #add_subdirectory(stonesense)
endif() endif()
option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF) option(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD) if(BUILD_ISOWORLD)
add_subdirectory(isoworld) #add_subdirectory(isoworld)
if(UNIX) if(UNIX)
if(APPLE) if(APPLE)
# TODO: add an OSX runner script # TODO: add an OSX runner script
@ -21,12 +21,12 @@ endif()
option(BUILD_DEV_PLUGINS "Build developer plugins." OFF) option(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
if(BUILD_DEV_PLUGINS) if(BUILD_DEV_PLUGINS)
add_subdirectory(devel) #add_subdirectory(devel)
endif() endif()
option(BUILD_RUBY "Build ruby binding." ON) option(BUILD_RUBY "Build ruby binding." ON)
if(BUILD_RUBY) if(BUILD_RUBY)
add_subdirectory(ruby) #add_subdirectory(ruby)
endif() endif()
install(DIRECTORY lua/ install(DIRECTORY lua/
@ -75,111 +75,108 @@ add_custom_target(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE ) set_source_files_properties( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
# Plugins # Plugins
option(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if(BUILD_SUPPORTED)
# If you are adding a plugin that you do not intend to commit to the DFHack repo, # If you are adding a plugin that you do not intend to commit to the DFHack repo,
# see instructions for adding "external" plugins at the end of this file. # see instructions for adding "external" plugins at the end of this file.
dfhack_plugin(3dveins 3dveins.cpp) #dfhack_plugin(3dveins 3dveins.cpp)
dfhack_plugin(add-spatter add-spatter.cpp) #dfhack_plugin(add-spatter add-spatter.cpp)
dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua) #dfhack_plugin(autobutcher autobutcher.cpp LINK_LIBRARIES lua)
dfhack_plugin(autochop autochop.cpp) #dfhack_plugin(autochop autochop.cpp)
dfhack_plugin(autoclothing autoclothing.cpp) #dfhack_plugin(autoclothing autoclothing.cpp)
dfhack_plugin(autodump autodump.cpp) #dfhack_plugin(autodump autodump.cpp)
dfhack_plugin(autofarm autofarm.cpp) #dfhack_plugin(autofarm autofarm.cpp)
dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static) #dfhack_plugin(autogems autogems.cpp LINK_LIBRARIES jsoncpp_static)
add_subdirectory(autolabor) #add_subdirectory(autolabor)
dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua) #dfhack_plugin(automaterial automaterial.cpp LINK_LIBRARIES lua)
dfhack_plugin(automelt automelt.cpp) #dfhack_plugin(automelt automelt.cpp)
dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua) #dfhack_plugin(autonestbox autonestbox.cpp LINK_LIBRARIES lua)
dfhack_plugin(autotrade autotrade.cpp) #dfhack_plugin(autotrade autotrade.cpp)
dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua) #dfhack_plugin(blueprint blueprint.cpp LINK_LIBRARIES lua)
dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua) #dfhack_plugin(burrows burrows.cpp LINK_LIBRARIES lua)
dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua) #dfhack_plugin(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
add_subdirectory(buildingplan) #add_subdirectory(buildingplan)
dfhack_plugin(changeitem changeitem.cpp) #dfhack_plugin(changeitem changeitem.cpp)
dfhack_plugin(changelayer changelayer.cpp) #dfhack_plugin(changelayer changelayer.cpp)
dfhack_plugin(changevein changevein.cpp) #dfhack_plugin(changevein changevein.cpp)
add_subdirectory(channel-safely) #add_subdirectory(channel-safely)
dfhack_plugin(cleanconst cleanconst.cpp) #dfhack_plugin(cleanconst cleanconst.cpp)
dfhack_plugin(cleaners cleaners.cpp) #dfhack_plugin(cleaners cleaners.cpp)
dfhack_plugin(cleanowned cleanowned.cpp) #dfhack_plugin(cleanowned cleanowned.cpp)
dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua) #dfhack_plugin(confirm confirm.cpp LINK_LIBRARIES lua)
dfhack_plugin(createitem createitem.cpp) #dfhack_plugin(createitem createitem.cpp)
dfhack_plugin(cursecheck cursecheck.cpp) #dfhack_plugin(cursecheck cursecheck.cpp)
dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua) #dfhack_plugin(cxxrandom cxxrandom.cpp LINK_LIBRARIES lua)
dfhack_plugin(deramp deramp.cpp) #dfhack_plugin(deramp deramp.cpp)
dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_static) dfhack_plugin(debug debug.cpp LINK_LIBRARIES jsoncpp_static)
dfhack_plugin(dig dig.cpp) #dfhack_plugin(dig dig.cpp)
dfhack_plugin(dig-now dig-now.cpp LINK_LIBRARIES lua) #dfhack_plugin(dig-now dig-now.cpp LINK_LIBRARIES lua)
dfhack_plugin(digFlood digFlood.cpp) #dfhack_plugin(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders) #add_subdirectory(diggingInvaders)
dfhack_plugin(dwarfvet dwarfvet.cpp) #dfhack_plugin(dwarfvet dwarfvet.cpp)
dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua) #dfhack_plugin(dwarfmonitor dwarfmonitor.cpp LINK_LIBRARIES lua)
add_subdirectory(embark-assistant) #add_subdirectory(embark-assistant)
dfhack_plugin(embark-tools embark-tools.cpp) #dfhack_plugin(embark-tools embark-tools.cpp)
dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua) dfhack_plugin(eventful eventful.cpp LINK_LIBRARIES lua)
dfhack_plugin(fastdwarf fastdwarf.cpp) #dfhack_plugin(fastdwarf fastdwarf.cpp)
dfhack_plugin(filltraffic filltraffic.cpp) #dfhack_plugin(filltraffic filltraffic.cpp)
dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp) #dfhack_plugin(fix-unit-occupancy fix-unit-occupancy.cpp)
dfhack_plugin(fixveins fixveins.cpp) #dfhack_plugin(fixveins fixveins.cpp)
dfhack_plugin(flows flows.cpp) #dfhack_plugin(flows flows.cpp)
dfhack_plugin(follow follow.cpp) #dfhack_plugin(follow follow.cpp)
dfhack_plugin(forceequip forceequip.cpp) #dfhack_plugin(forceequip forceequip.cpp)
dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp) #dfhack_plugin(generated-creature-renamer generated-creature-renamer.cpp)
dfhack_plugin(getplants getplants.cpp) #dfhack_plugin(getplants getplants.cpp)
dfhack_plugin(hotkeys hotkeys.cpp LINK_LIBRARIES lua) dfhack_plugin(hotkeys hotkeys.cpp LINK_LIBRARIES lua)
dfhack_plugin(infiniteSky infiniteSky.cpp) #dfhack_plugin(infiniteSky infiniteSky.cpp)
dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote) #dfhack_plugin(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
dfhack_plugin(jobutils jobutils.cpp) #dfhack_plugin(jobutils jobutils.cpp)
dfhack_plugin(lair lair.cpp) #dfhack_plugin(lair lair.cpp)
dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua) #dfhack_plugin(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread) #dfhack_plugin(luasocket luasocket.cpp LINK_LIBRARIES clsocket lua dfhack-tinythread)
dfhack_plugin(manipulator manipulator.cpp) #dfhack_plugin(manipulator manipulator.cpp)
dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua) #dfhack_plugin(map-render map-render.cpp LINK_LIBRARIES lua)
dfhack_plugin(misery misery.cpp) #dfhack_plugin(misery misery.cpp)
dfhack_plugin(mode mode.cpp) #dfhack_plugin(mode mode.cpp)
dfhack_plugin(mousequery mousequery.cpp) #dfhack_plugin(mousequery mousequery.cpp)
dfhack_plugin(nestboxes nestboxes.cpp) #dfhack_plugin(nestboxes nestboxes.cpp)
dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_static) #dfhack_plugin(orders orders.cpp LINK_LIBRARIES jsoncpp_static)
dfhack_plugin(overlay overlay.cpp LINK_LIBRARIES lua) dfhack_plugin(overlay overlay.cpp LINK_LIBRARIES lua)
dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua) #dfhack_plugin(pathable pathable.cpp LINK_LIBRARIES lua)
dfhack_plugin(petcapRemover petcapRemover.cpp) #dfhack_plugin(petcapRemover petcapRemover.cpp)
dfhack_plugin(plants plants.cpp) #dfhack_plugin(plants plants.cpp)
dfhack_plugin(probe probe.cpp) #dfhack_plugin(probe probe.cpp)
dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua) #dfhack_plugin(prospector prospector.cpp LINK_LIBRARIES lua)
dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua) #dfhack_plugin(power-meter power-meter.cpp LINK_LIBRARIES lua)
dfhack_plugin(regrass regrass.cpp) #dfhack_plugin(regrass regrass.cpp)
add_subdirectory(remotefortressreader) #add_subdirectory(remotefortressreader)
dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename) #dfhack_plugin(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
add_subdirectory(rendermax) #add_subdirectory(rendermax)
dfhack_plugin(reveal reveal.cpp LINK_LIBRARIES lua) #dfhack_plugin(reveal reveal.cpp LINK_LIBRARIES lua)
dfhack_plugin(search search.cpp) #dfhack_plugin(search search.cpp)
dfhack_plugin(seedwatch seedwatch.cpp) #dfhack_plugin(seedwatch seedwatch.cpp)
dfhack_plugin(showmood showmood.cpp) #dfhack_plugin(showmood showmood.cpp)
dfhack_plugin(siege-engine siege-engine.cpp LINK_LIBRARIES lua) #dfhack_plugin(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
dfhack_plugin(sort sort.cpp LINK_LIBRARIES lua) #dfhack_plugin(sort sort.cpp LINK_LIBRARIES lua)
dfhack_plugin(steam-engine steam-engine.cpp) #dfhack_plugin(steam-engine steam-engine.cpp)
add_subdirectory(spectate) #add_subdirectory(spectate)
dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua) #dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua)
add_subdirectory(stockpiles) #add_subdirectory(stockpiles)
dfhack_plugin(stocks stocks.cpp) #dfhack_plugin(stocks stocks.cpp)
dfhack_plugin(strangemood strangemood.cpp) #dfhack_plugin(strangemood strangemood.cpp)
dfhack_plugin(tailor tailor.cpp) #dfhack_plugin(tailor tailor.cpp)
dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua) #dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua)
dfhack_plugin(title-folder title-folder.cpp) #dfhack_plugin(title-folder title-folder.cpp)
dfhack_plugin(title-version title-version.cpp) #dfhack_plugin(title-version title-version.cpp)
dfhack_plugin(trackstop trackstop.cpp) #dfhack_plugin(trackstop trackstop.cpp)
dfhack_plugin(tubefill tubefill.cpp) #dfhack_plugin(tubefill tubefill.cpp)
add_subdirectory(tweak) #add_subdirectory(tweak)
dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua) #dfhack_plugin(workflow workflow.cpp LINK_LIBRARIES lua)
dfhack_plugin(workNow workNow.cpp) #dfhack_plugin(workNow workNow.cpp)
dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat) #dfhack_plugin(xlsxreader xlsxreader.cpp LINK_LIBRARIES lua xlsxio_read_STATIC zip expat)
dfhack_plugin(zone zone.cpp) #dfhack_plugin(zone zone.cpp)
# If you are adding a plugin that you do not intend to commit to the DFHack repo, # If you are adding a plugin that you do not intend to commit to the DFHack repo,
# see instructions for adding "external" plugins at the end of this file. # see instructions for adding "external" plugins at the end of this file.
endif()
# this is the skeleton plugin. If you want to make your own, make a copy and then change it # this is the skeleton plugin. If you want to make your own, make a copy and then change it
option(BUILD_SKELETON "Build the skeleton plugin." OFF) option(BUILD_SKELETON "Build the skeleton plugin." OFF)

@ -1,87 +1,18 @@
#include "df/viewscreen_adopt_regionst.h" #include "df/viewscreen_adopt_regionst.h"
#include "df/viewscreen_adventure_logst.h" #include "df/viewscreen_choose_game_typest.h"
#include "df/viewscreen_announcelistst.h"
#include "df/viewscreen_assign_display_itemst.h"
#include "df/viewscreen_barterst.h"
#include "df/viewscreen_buildinglistst.h"
#include "df/viewscreen_buildingst.h"
#include "df/viewscreen_choose_start_sitest.h" #include "df/viewscreen_choose_start_sitest.h"
#include "df/viewscreen_civlistst.h"
#include "df/viewscreen_counterintelligencest.h"
#include "df/viewscreen_createquotast.h"
#include "df/viewscreen_customize_unitst.h"
#include "df/viewscreen_dungeonmodest.h"
#include "df/viewscreen_dungeon_monsterstatusst.h"
#include "df/viewscreen_dungeon_wrestlest.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_entityst.h"
#include "df/viewscreen_export_graphical_mapst.h"
#include "df/viewscreen_export_regionst.h" #include "df/viewscreen_export_regionst.h"
#include "df/viewscreen_game_cleanerst.h" #include "df/viewscreen_game_cleanerst.h"
#include "df/viewscreen_image_creator_mode.h" #include "df/viewscreen_initial_prepst.h"
#include "df/viewscreen_image_creatorst.h"
#include "df/viewscreen_itemst.h"
#include "df/viewscreen_joblistst.h"
#include "df/viewscreen_jobmanagementst.h"
#include "df/viewscreen_jobst.h"
#include "df/viewscreen_justicest.h"
#include "df/viewscreen_kitchenpref_page.h"
#include "df/viewscreen_kitchenprefst.h"
#include "df/viewscreen_layer_arena_creaturest.h"
#include "df/viewscreen_layer_assigntradest.h"
#include "df/viewscreen_layer_choose_language_namest.h"
#include "df/viewscreen_layer_currencyst.h"
#include "df/viewscreen_layer_export_play_mapst.h"
#include "df/viewscreen_layer.h"
#include "df/viewscreen_layer_militaryst.h"
#include "df/viewscreen_layer_musicsoundst.h"
#include "df/viewscreen_layer_noblelistst.h"
#include "df/viewscreen_layer_overall_healthst.h"
#include "df/viewscreen_layer_reactionst.h"
#include "df/viewscreen_layer_squad_schedulest.h"
#include "df/viewscreen_layer_stockpilest.h"
#include "df/viewscreen_layer_stone_restrictionst.h"
#include "df/viewscreen_layer_unit_actionst.h"
#include "df/viewscreen_layer_unit_healthst.h"
#include "df/viewscreen_layer_unit_relationshipst.h"
#include "df/viewscreen_layer_world_gen_param_presetst.h"
#include "df/viewscreen_layer_world_gen_paramst.h"
#include "df/viewscreen_legendsst.h" #include "df/viewscreen_legendsst.h"
#include "df/viewscreen_loadgamest.h" #include "df/viewscreen_loadgamest.h"
#include "df/viewscreen_locationsst.h"
#include "df/viewscreen_meetingst.h"
#include "df/viewscreen_movieplayerst.h"
#include "df/viewscreen_new_regionst.h" #include "df/viewscreen_new_regionst.h"
#include "df/viewscreen_noblest.h"
#include "df/viewscreen_optionst.h"
#include "df/viewscreen_overallstatusst.h"
#include "df/viewscreen_petitionsst.h"
#include "df/viewscreen_petst.h"
#include "df/viewscreen_pricest.h"
#include "df/viewscreen_reportlistst.h"
#include "df/viewscreen_requestagreementst.h"
#include "df/viewscreen_savegamest.h" #include "df/viewscreen_savegamest.h"
#include "df/viewscreen_selectitemst.h"
#include "df/viewscreen_setupadventurest.h"
#include "df/viewscreen_setupdwarfgamest.h" #include "df/viewscreen_setupdwarfgamest.h"
#include "df/viewscreen_storesst.h"
#include "df/viewscreen_textviewerst.h"
#include "df/viewscreen_titlest.h" #include "df/viewscreen_titlest.h"
#include "df/viewscreen_topicmeeting_fill_land_holder_positionsst.h"
#include "df/viewscreen_topicmeetingst.h"
#include "df/viewscreen_topicmeeting_takerequestsst.h"
#include "df/viewscreen_tradeagreementst.h"
#include "df/viewscreen_tradelistst.h"
#include "df/viewscreen_tradegoodsst.h"
#include "df/viewscreen_treasurelistst.h"
#include "df/viewscreen_unitlist_page.h"
#include "df/viewscreen_unitlistst.h"
#include "df/viewscreen_unitst.h"
#include "df/viewscreen_update_regionst.h" #include "df/viewscreen_update_regionst.h"
#include "df/viewscreen_wagesst.h" #include "df/viewscreen_worldst.h"
#include "df/viewscreen_workquota_conditionst.h"
#include "df/viewscreen_workquota_detailsst.h"
#include "df/viewscreen_workshop_profilest.h"
#include "Debug.h" #include "Debug.h"
#include "LuaTools.h" #include "LuaTools.h"
@ -163,85 +94,20 @@ struct viewscreen_overlay : T {
template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(screen##_overlay, render, 100); template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(screen##_overlay, render, 100);
IMPLEMENT_HOOKS(adopt_region) IMPLEMENT_HOOKS(adopt_region)
IMPLEMENT_HOOKS(adventure_log) IMPLEMENT_HOOKS(choose_game_type)
IMPLEMENT_HOOKS(announcelist)
IMPLEMENT_HOOKS(assign_display_item)
IMPLEMENT_HOOKS(barter)
IMPLEMENT_HOOKS(buildinglist)
IMPLEMENT_HOOKS(building)
IMPLEMENT_HOOKS(choose_start_site) IMPLEMENT_HOOKS(choose_start_site)
IMPLEMENT_HOOKS(civlist)
IMPLEMENT_HOOKS(counterintelligence)
IMPLEMENT_HOOKS(createquota)
IMPLEMENT_HOOKS(customize_unit)
IMPLEMENT_HOOKS(dungeonmode)
IMPLEMENT_HOOKS(dungeon_monsterstatus)
IMPLEMENT_HOOKS(dungeon_wrestle)
IMPLEMENT_HOOKS(dwarfmode) IMPLEMENT_HOOKS(dwarfmode)
IMPLEMENT_HOOKS(entity)
IMPLEMENT_HOOKS(export_graphical_map)
IMPLEMENT_HOOKS(export_region) IMPLEMENT_HOOKS(export_region)
IMPLEMENT_HOOKS(game_cleaner) IMPLEMENT_HOOKS(game_cleaner)
IMPLEMENT_HOOKS(image_creator) IMPLEMENT_HOOKS(initial_prep)
IMPLEMENT_HOOKS(item)
IMPLEMENT_HOOKS(joblist)
IMPLEMENT_HOOKS(jobmanagement)
IMPLEMENT_HOOKS(job)
IMPLEMENT_HOOKS(justice)
IMPLEMENT_HOOKS(kitchenpref)
IMPLEMENT_HOOKS(layer_arena_creature)
IMPLEMENT_HOOKS(layer_assigntrade)
IMPLEMENT_HOOKS(layer_choose_language_name)
IMPLEMENT_HOOKS(layer_currency)
IMPLEMENT_HOOKS(layer_export_play_map)
IMPLEMENT_HOOKS(layer_military)
IMPLEMENT_HOOKS(layer_musicsound)
IMPLEMENT_HOOKS(layer_noblelist)
IMPLEMENT_HOOKS(layer_overall_health)
IMPLEMENT_HOOKS(layer_reaction)
IMPLEMENT_HOOKS(layer_squad_schedule)
IMPLEMENT_HOOKS(layer_stockpile)
IMPLEMENT_HOOKS(layer_stone_restriction)
IMPLEMENT_HOOKS(layer_unit_action)
IMPLEMENT_HOOKS(layer_unit_health)
IMPLEMENT_HOOKS(layer_unit_relationship)
IMPLEMENT_HOOKS(layer_world_gen_param_preset)
IMPLEMENT_HOOKS(layer_world_gen_param)
IMPLEMENT_HOOKS(legends) IMPLEMENT_HOOKS(legends)
IMPLEMENT_HOOKS(loadgame) IMPLEMENT_HOOKS(loadgame)
IMPLEMENT_HOOKS(locations)
IMPLEMENT_HOOKS(meeting)
IMPLEMENT_HOOKS(movieplayer)
IMPLEMENT_HOOKS(new_region) IMPLEMENT_HOOKS(new_region)
IMPLEMENT_HOOKS(noble)
IMPLEMENT_HOOKS(option)
IMPLEMENT_HOOKS(overallstatus)
IMPLEMENT_HOOKS(petitions)
IMPLEMENT_HOOKS(pet)
IMPLEMENT_HOOKS(price)
IMPLEMENT_HOOKS(reportlist)
IMPLEMENT_HOOKS(requestagreement)
IMPLEMENT_HOOKS(savegame) IMPLEMENT_HOOKS(savegame)
IMPLEMENT_HOOKS(selectitem)
IMPLEMENT_HOOKS(setupadventure)
IMPLEMENT_HOOKS(setupdwarfgame) IMPLEMENT_HOOKS(setupdwarfgame)
IMPLEMENT_HOOKS(stores)
IMPLEMENT_HOOKS(textviewer)
IMPLEMENT_HOOKS(title) IMPLEMENT_HOOKS(title)
IMPLEMENT_HOOKS(topicmeeting_fill_land_holder_positions)
IMPLEMENT_HOOKS(topicmeeting)
IMPLEMENT_HOOKS(topicmeeting_takerequests)
IMPLEMENT_HOOKS(tradeagreement)
IMPLEMENT_HOOKS(tradegoods)
IMPLEMENT_HOOKS(tradelist)
IMPLEMENT_HOOKS(treasurelist)
IMPLEMENT_HOOKS(unitlist)
IMPLEMENT_HOOKS(unit)
IMPLEMENT_HOOKS(update_region) IMPLEMENT_HOOKS(update_region)
IMPLEMENT_HOOKS(wages) IMPLEMENT_HOOKS(world)
IMPLEMENT_HOOKS(workquota_condition)
IMPLEMENT_HOOKS(workquota_details)
IMPLEMENT_HOOKS(workshop_profile)
#undef IMPLEMENT_HOOKS #undef IMPLEMENT_HOOKS
@ -262,85 +128,20 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
DEBUG(control).print("%sing interpose hooks\n", enable ? "enabl" : "disabl"); DEBUG(control).print("%sing interpose hooks\n", enable ? "enabl" : "disabl");
if (INTERPOSE_HOOKS_FAILED(adopt_region) || if (INTERPOSE_HOOKS_FAILED(adopt_region) ||
INTERPOSE_HOOKS_FAILED(adventure_log) ||
INTERPOSE_HOOKS_FAILED(announcelist) ||
INTERPOSE_HOOKS_FAILED(assign_display_item) ||
INTERPOSE_HOOKS_FAILED(barter) ||
INTERPOSE_HOOKS_FAILED(buildinglist) ||
INTERPOSE_HOOKS_FAILED(building) ||
INTERPOSE_HOOKS_FAILED(choose_start_site) || INTERPOSE_HOOKS_FAILED(choose_start_site) ||
INTERPOSE_HOOKS_FAILED(civlist) || INTERPOSE_HOOKS_FAILED(choose_game_type) ||
INTERPOSE_HOOKS_FAILED(counterintelligence) ||
INTERPOSE_HOOKS_FAILED(createquota) ||
INTERPOSE_HOOKS_FAILED(customize_unit) ||
INTERPOSE_HOOKS_FAILED(dungeonmode) ||
INTERPOSE_HOOKS_FAILED(dungeon_monsterstatus) ||
INTERPOSE_HOOKS_FAILED(dungeon_wrestle) ||
INTERPOSE_HOOKS_FAILED(dwarfmode) || INTERPOSE_HOOKS_FAILED(dwarfmode) ||
INTERPOSE_HOOKS_FAILED(entity) ||
INTERPOSE_HOOKS_FAILED(export_graphical_map) ||
INTERPOSE_HOOKS_FAILED(export_region) || INTERPOSE_HOOKS_FAILED(export_region) ||
INTERPOSE_HOOKS_FAILED(game_cleaner) || INTERPOSE_HOOKS_FAILED(game_cleaner) ||
INTERPOSE_HOOKS_FAILED(image_creator) || INTERPOSE_HOOKS_FAILED(initial_prep) ||
INTERPOSE_HOOKS_FAILED(item) ||
INTERPOSE_HOOKS_FAILED(joblist) ||
INTERPOSE_HOOKS_FAILED(jobmanagement) ||
INTERPOSE_HOOKS_FAILED(job) ||
INTERPOSE_HOOKS_FAILED(justice) ||
INTERPOSE_HOOKS_FAILED(kitchenpref) ||
INTERPOSE_HOOKS_FAILED(layer_arena_creature) ||
INTERPOSE_HOOKS_FAILED(layer_assigntrade) ||
INTERPOSE_HOOKS_FAILED(layer_choose_language_name) ||
INTERPOSE_HOOKS_FAILED(layer_currency) ||
INTERPOSE_HOOKS_FAILED(layer_export_play_map) ||
INTERPOSE_HOOKS_FAILED(layer_military) ||
INTERPOSE_HOOKS_FAILED(layer_musicsound) ||
INTERPOSE_HOOKS_FAILED(layer_noblelist) ||
INTERPOSE_HOOKS_FAILED(layer_overall_health) ||
INTERPOSE_HOOKS_FAILED(layer_reaction) ||
INTERPOSE_HOOKS_FAILED(layer_squad_schedule) ||
INTERPOSE_HOOKS_FAILED(layer_stockpile) ||
INTERPOSE_HOOKS_FAILED(layer_stone_restriction) ||
INTERPOSE_HOOKS_FAILED(layer_unit_action) ||
INTERPOSE_HOOKS_FAILED(layer_unit_health) ||
INTERPOSE_HOOKS_FAILED(layer_unit_relationship) ||
INTERPOSE_HOOKS_FAILED(layer_world_gen_param_preset) ||
INTERPOSE_HOOKS_FAILED(layer_world_gen_param) ||
INTERPOSE_HOOKS_FAILED(legends) || INTERPOSE_HOOKS_FAILED(legends) ||
INTERPOSE_HOOKS_FAILED(loadgame) || INTERPOSE_HOOKS_FAILED(loadgame) ||
INTERPOSE_HOOKS_FAILED(locations) ||
INTERPOSE_HOOKS_FAILED(meeting) ||
INTERPOSE_HOOKS_FAILED(movieplayer) ||
INTERPOSE_HOOKS_FAILED(new_region) || INTERPOSE_HOOKS_FAILED(new_region) ||
INTERPOSE_HOOKS_FAILED(noble) ||
INTERPOSE_HOOKS_FAILED(option) ||
INTERPOSE_HOOKS_FAILED(overallstatus) ||
INTERPOSE_HOOKS_FAILED(petitions) ||
INTERPOSE_HOOKS_FAILED(pet) ||
INTERPOSE_HOOKS_FAILED(price) ||
INTERPOSE_HOOKS_FAILED(reportlist) ||
INTERPOSE_HOOKS_FAILED(requestagreement) ||
INTERPOSE_HOOKS_FAILED(savegame) || INTERPOSE_HOOKS_FAILED(savegame) ||
INTERPOSE_HOOKS_FAILED(selectitem) ||
INTERPOSE_HOOKS_FAILED(setupadventure) ||
INTERPOSE_HOOKS_FAILED(setupdwarfgame) || INTERPOSE_HOOKS_FAILED(setupdwarfgame) ||
INTERPOSE_HOOKS_FAILED(stores) ||
INTERPOSE_HOOKS_FAILED(textviewer) ||
INTERPOSE_HOOKS_FAILED(title) || INTERPOSE_HOOKS_FAILED(title) ||
INTERPOSE_HOOKS_FAILED(topicmeeting_fill_land_holder_positions) ||
INTERPOSE_HOOKS_FAILED(topicmeeting) ||
INTERPOSE_HOOKS_FAILED(topicmeeting_takerequests) ||
INTERPOSE_HOOKS_FAILED(tradeagreement) ||
INTERPOSE_HOOKS_FAILED(tradegoods) ||
INTERPOSE_HOOKS_FAILED(tradelist) ||
INTERPOSE_HOOKS_FAILED(treasurelist) ||
INTERPOSE_HOOKS_FAILED(unitlist) ||
INTERPOSE_HOOKS_FAILED(unit) ||
INTERPOSE_HOOKS_FAILED(update_region) || INTERPOSE_HOOKS_FAILED(update_region) ||
INTERPOSE_HOOKS_FAILED(wages) || INTERPOSE_HOOKS_FAILED(world))
INTERPOSE_HOOKS_FAILED(workquota_condition) ||
INTERPOSE_HOOKS_FAILED(workquota_details) ||
INTERPOSE_HOOKS_FAILED(workshop_profile))
return CR_FAILURE; return CR_FAILURE;
is_enabled = enable; is_enabled = enable;

@ -1 +1 @@
Subproject commit 57172de9bdc54490957b046907462f61f0be3e7b Subproject commit 6f723420adbd3e485167b725ca980e10e6055f96