Merge branch 'develop' into myk_no_alias

develop
Myk 2023-04-24 14:14:28 -07:00 committed by GitHub
commit ea34a0b0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 226 additions and 386 deletions

@ -144,3 +144,4 @@ enable \
alias add autounsuspend suspendmanager alias add autounsuspend suspendmanager
alias add gui/dig gui/design alias add gui/dig gui/design
alias add version help

@ -206,6 +206,12 @@ stocksettings
Along with ``copystock``, ``loadstock`` and ``savestock``, replaced with the new Along with ``copystock``, ``loadstock`` and ``savestock``, replaced with the new
`stockpiles` API. `stockpiles` API.
.. _title-version:
title-version
=============
Replaced with an `overlay`.
.. _warn-stuck-trees: .. _warn-stuck-trees:
warn-stuck-trees warn-stuck-trees

@ -36,22 +36,27 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## New Plugins ## New Plugins
## Fixes ## Fixes
- `buildingplan`: fixed size limit calculations for rollers
## Misc Improvements ## Misc Improvements
- `buildingplan`: planner panel is minimized by default and now remembers minimized state - `buildingplan`: planner panel is minimized by default and now remembers minimized state
- `buildingplan`: can now filter by gems (for gem windows) and yarn (for ropes in wells) - `buildingplan`: can now filter by gems (for gem windows) and yarn (for ropes in wells)
- ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K)
- ``version``: add alias to display the DFHack help (including the version number) so something happens when players try to run "version"
- `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding the terminal console on startup
- `gui/control-panel`: add preference option for hiding "armok" tools in command lists - `gui/control-panel`: add preference option for hiding "armok" tools in command lists
- ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running). - ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running).
- `overlay`: add the DFHack version string to the DF title screen
## Documentation ## Documentation
## API ## API
## Lua ## Lua
- ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget
## Removed ## Removed
- `title-version`: replaced by an `overlay` widget
# 50.07-r1 # 50.07-r1

@ -5130,6 +5130,20 @@ widget does not require direct usage of ``Tab``.
usage of ``Tab`` in ``TabBar:init()`` for an example. See the default value of ``active_tab_pens`` or ``inactive_tab_pens`` usage of ``Tab`` in ``TabBar:init()`` for an example. See the default value of ``active_tab_pens`` or ``inactive_tab_pens``
in ``TabBar`` for an example of how to construct pens. in ``TabBar`` for an example of how to construct pens.
RangeSlider class
-----------------
This widget implements a mouse-interactable range-slider. The player can move its two handles to set minimum and maximum values
to define a range, or they can drag the bar itself to move both handles at once.
The parent widget owns the range values, and can control them independently (e.g. with ``CycleHotkeyLabels``). If the range values change, the ``RangeSlider`` appearance will adjust automatically.
:num_stops: Used to specify the number of "notches" in the range slider, the places where handles can stop.
(this should match the parents' number of options)
:get_left_idx_fn: The function used by the RangeSlider to get the notch index on which to display the left handle.
:get_right_idx_fn: The function used by the RangeSlider to get the notch index on which to display the right handle.
:on_left_change: Callback executed when moving the left handle.
:on_right_change: Callback executed when moving the right handle.
.. _lua-plugins: .. _lua-plugins:
======= =======

@ -1,14 +0,0 @@
title-version
=============
.. dfhack-tool::
:summary: Displays the DFHack version on DF's title screen.
:tags: unavailable interface
:no-command:
Usage
-----
::
enable title-version

@ -273,7 +273,7 @@ static std::string dfhack_version_desc()
if (Version::is_release()) if (Version::is_release())
s << "(release)"; s << "(release)";
else else
s << "(development build " << Version::git_description() << ")"; s << "(git: " << Version::git_commit(true) << ")";
s << " on " << (sizeof(void*) == 8 ? "x86_64" : "x86"); s << " on " << (sizeof(void*) == 8 ? "x86_64" : "x86");
if (strlen(Version::dfhack_build_id())) if (strlen(Version::dfhack_build_id()))
s << " [build ID: " << Version::dfhack_build_id() << "]"; s << " [build ID: " << Version::dfhack_build_id() << "]";

@ -1,6 +1,8 @@
#define NO_DFHACK_VERSION_MACROS #define NO_DFHACK_VERSION_MACROS
#include "DFHackVersion.h" #include "DFHackVersion.h"
#include "git-describe.h" #include "git-describe.h"
#include <string>
namespace DFHack { namespace DFHack {
namespace Version { namespace Version {
int dfhack_abi_version() int dfhack_abi_version()
@ -27,9 +29,10 @@ namespace DFHack {
{ {
return DFHACK_GIT_DESCRIPTION; return DFHACK_GIT_DESCRIPTION;
} }
const char *git_commit() const char* git_commit(bool short_hash)
{ {
return DFHACK_GIT_COMMIT; static std::string shorty(DFHACK_GIT_COMMIT, 0, 7);
return short_hash ? shorty.c_str() : DFHACK_GIT_COMMIT;
} }
const char *git_xml_commit() const char *git_xml_commit()
{ {

@ -8,7 +8,7 @@ namespace DFHack {
int dfhack_abi_version(); int dfhack_abi_version();
const char *git_description(); const char *git_description();
const char *git_commit(); const char* git_commit(bool short_hash = false);
const char *git_xml_commit(); const char *git_xml_commit();
const char *git_xml_expected_commit(); const char *git_xml_expected_commit();
bool git_xml_match(); bool git_xml_match();

@ -2293,4 +2293,141 @@ function TabBar:onInput(keys)
end end
end end
--------------------------------
-- RangeSlider
--
RangeSlider = defclass(RangeSlider, Widget)
RangeSlider.ATTRS{
num_stops=DEFAULT_NIL,
get_left_idx_fn=DEFAULT_NIL,
get_right_idx_fn=DEFAULT_NIL,
on_left_change=DEFAULT_NIL,
on_right_change=DEFAULT_NIL,
}
function RangeSlider:preinit(init_table)
init_table.frame = init_table.frame or {}
init_table.frame.h = init_table.frame.h or 1
end
function RangeSlider:init()
if self.num_stops < 2 then error('too few RangeSlider stops') end
self.is_dragging_target = nil -- 'left', 'right', or 'both'
self.is_dragging_idx = nil -- offset from leftmost dragged tile
end
local function rangeslider_get_width_per_idx(self)
return math.max(5, (self.frame_body.width-7) // (self.num_stops-1))
end
function RangeSlider:onInput(keys)
if not keys._MOUSE_L_DOWN then return false end
local x = self:getMousePos()
if not x then return false end
local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn()
local width_per_idx = rangeslider_get_width_per_idx(self)
local left_pos = width_per_idx*(left_idx-1)
local right_pos = width_per_idx*(right_idx-1) + 4
if x < left_pos then
self.on_left_change(self.get_left_idx_fn() - 1)
elseif x < left_pos+3 then
self.is_dragging_target = 'left'
self.is_dragging_idx = x - left_pos
elseif x < right_pos then
self.is_dragging_target = 'both'
self.is_dragging_idx = x - left_pos
elseif x < right_pos+3 then
self.is_dragging_target = 'right'
self.is_dragging_idx = x - right_pos
else
self.on_right_change(self.get_right_idx_fn() + 1)
end
return true
end
local function rangeslider_do_drag(self, width_per_idx)
local x = self.frame_body:localXY(dfhack.screen.getMousePos())
local cur_pos = x - self.is_dragging_idx
cur_pos = math.max(0, cur_pos)
cur_pos = math.min(width_per_idx*(self.num_stops-1)+7, cur_pos)
local offset = self.is_dragging_target == 'right' and -2 or 1
local new_idx = math.max(0, cur_pos+offset)//width_per_idx + 1
local new_left_idx, new_right_idx
if self.is_dragging_target == 'right' then
new_right_idx = new_idx
else
new_left_idx = new_idx
if self.is_dragging_target == 'both' then
new_right_idx = new_left_idx + self.get_right_idx_fn() - self.get_left_idx_fn()
if new_right_idx > self.num_stops then
return
end
end
end
if new_left_idx and new_left_idx ~= self.get_left_idx_fn() then
self.on_left_change(new_left_idx)
end
if new_right_idx and new_right_idx ~= self.get_right_idx_fn() then
self.on_right_change(new_right_idx)
end
end
local SLIDER_LEFT_END = to_pen{ch=198, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK = to_pen{ch=205, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK_SELECTED = to_pen{ch=205, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK}
local SLIDER_TRACK_STOP = to_pen{ch=216, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK_STOP_SELECTED = to_pen{ch=216, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK}
local SLIDER_RIGHT_END = to_pen{ch=181, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TAB_LEFT = to_pen{ch=60, fg=COLOR_BLACK, bg=COLOR_YELLOW}
local SLIDER_TAB_CENTER = to_pen{ch=9, fg=COLOR_BLACK, bg=COLOR_YELLOW}
local SLIDER_TAB_RIGHT = to_pen{ch=62, fg=COLOR_BLACK, bg=COLOR_YELLOW}
function RangeSlider:onRenderBody(dc, rect)
local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn()
local width_per_idx = rangeslider_get_width_per_idx(self)
-- draw track
dc:seek(1,0)
dc:char(nil, SLIDER_LEFT_END)
dc:char(nil, SLIDER_TRACK)
for stop_idx=1,self.num_stops-1 do
local track_stop_pen = SLIDER_TRACK_STOP_SELECTED
local track_pen = SLIDER_TRACK_SELECTED
if left_idx > stop_idx or right_idx < stop_idx then
track_stop_pen = SLIDER_TRACK_STOP
track_pen = SLIDER_TRACK
elseif right_idx == stop_idx then
track_pen = SLIDER_TRACK
end
dc:char(nil, track_stop_pen)
for i=2,width_per_idx do
dc:char(nil, track_pen)
end
end
if right_idx >= self.num_stops then
dc:char(nil, SLIDER_TRACK_STOP_SELECTED)
else
dc:char(nil, SLIDER_TRACK_STOP)
end
dc:char(nil, SLIDER_TRACK)
dc:char(nil, SLIDER_RIGHT_END)
-- draw tabs
dc:seek(width_per_idx*(left_idx-1))
dc:char(nil, SLIDER_TAB_LEFT)
dc:char(nil, SLIDER_TAB_CENTER)
dc:char(nil, SLIDER_TAB_RIGHT)
dc:seek(width_per_idx*(right_idx-1)+4)
dc:char(nil, SLIDER_TAB_LEFT)
dc:char(nil, SLIDER_TAB_CENTER)
dc:char(nil, SLIDER_TAB_RIGHT)
-- manage dragging
if self.is_dragging_target then
rangeslider_do_drag(self, width_per_idx)
end
if df.global.enabler.mouse_lbut == 0 then
self.is_dragging_target = nil
self.is_dragging_idx = nil
end
end
return _ENV return _ENV

@ -84,6 +84,7 @@ using namespace DFHack;
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_inventory_item.h" #include "df/unit_inventory_item.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_titlest.h"
#include "df/world.h" #include "df/world.h"
const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size
@ -144,6 +145,17 @@ static std::map<virtual_identity*, getFocusStringsHandler> getFocusStringsHandle
); \ ); \
static void getFocusStrings_##screen_type(std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen) static void getFocusStrings_##screen_type(std::string &baseFocus, std::vector<std::string> &focusStrings, VIEWSCREEN(screen_type) *screen)
DEFINE_GET_FOCUS_STRING_HANDLER(title)
{
if (screen->managing_mods)
focusStrings.push_back(baseFocus + "/Mods");
else if (game->main_interface.settings.open)
focusStrings.push_back(baseFocus + "/Settings");
if (focusStrings.empty())
focusStrings.push_back(baseFocus + "/Default");
}
DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode) DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
{ {
std::string newFocusString; std::string newFocusString;

@ -162,7 +162,6 @@ dfhack_plugin(strangemood strangemood.cpp)
dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua) dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua)
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(trackstop trackstop.cpp) #dfhack_plugin(trackstop trackstop.cpp)
#dfhack_plugin(tubefill tubefill.cpp) #dfhack_plugin(tubefill tubefill.cpp)
#add_subdirectory(tweak) #add_subdirectory(tweak)

@ -12,143 +12,6 @@ local function get_cur_filters()
uibs.building_subtype, uibs.custom_type) uibs.building_subtype, uibs.custom_type)
end end
--------------------------------
-- Slider
--
Slider = defclass(Slider, widgets.Widget)
Slider.ATTRS{
num_stops=DEFAULT_NIL,
get_left_idx_fn=DEFAULT_NIL,
get_right_idx_fn=DEFAULT_NIL,
on_left_change=DEFAULT_NIL,
on_right_change=DEFAULT_NIL,
}
function Slider:preinit(init_table)
init_table.frame = init_table.frame or {}
init_table.frame.h = init_table.frame.h or 1
end
function Slider:init()
if self.num_stops < 2 then error('too few Slider stops') end
self.is_dragging_target = nil -- 'left', 'right', or 'both'
self.is_dragging_idx = nil -- offset from leftmost dragged tile
end
local function slider_get_width_per_idx(self)
return math.max(5, (self.frame_body.width-7) // (self.num_stops-1))
end
function Slider:onInput(keys)
if not keys._MOUSE_L_DOWN then return false end
local x = self:getMousePos()
if not x then return false end
local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn()
local width_per_idx = slider_get_width_per_idx(self)
local left_pos = width_per_idx*(left_idx-1)
local right_pos = width_per_idx*(right_idx-1) + 4
if x < left_pos then
self.on_left_change(self.get_left_idx_fn() - 1)
elseif x < left_pos+3 then
self.is_dragging_target = 'left'
self.is_dragging_idx = x - left_pos
elseif x < right_pos then
self.is_dragging_target = 'both'
self.is_dragging_idx = x - left_pos
elseif x < right_pos+3 then
self.is_dragging_target = 'right'
self.is_dragging_idx = x - right_pos
else
self.on_right_change(self.get_right_idx_fn() + 1)
end
return true
end
local function slider_do_drag(self, width_per_idx)
local x = self.frame_body:localXY(dfhack.screen.getMousePos())
local cur_pos = x - self.is_dragging_idx
cur_pos = math.max(0, cur_pos)
cur_pos = math.min(width_per_idx*(self.num_stops-1)+7, cur_pos)
local offset = self.is_dragging_target == 'right' and -2 or 1
local new_idx = math.max(0, cur_pos+offset)//width_per_idx + 1
local new_left_idx, new_right_idx
if self.is_dragging_target == 'right' then
new_right_idx = new_idx
else
new_left_idx = new_idx
if self.is_dragging_target == 'both' then
new_right_idx = new_left_idx + self.get_right_idx_fn() - self.get_left_idx_fn()
if new_right_idx > self.num_stops then
return
end
end
end
if new_left_idx and new_left_idx ~= self.get_left_idx_fn() then
self.on_left_change(new_left_idx)
end
if new_right_idx and new_right_idx ~= self.get_right_idx_fn() then
self.on_right_change(new_right_idx)
end
end
local SLIDER_LEFT_END = to_pen{ch=198, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK = to_pen{ch=205, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK_SELECTED = to_pen{ch=205, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK}
local SLIDER_TRACK_STOP = to_pen{ch=216, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TRACK_STOP_SELECTED = to_pen{ch=216, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK}
local SLIDER_RIGHT_END = to_pen{ch=181, fg=COLOR_GREY, bg=COLOR_BLACK}
local SLIDER_TAB_LEFT = to_pen{ch=60, fg=COLOR_BLACK, bg=COLOR_YELLOW}
local SLIDER_TAB_CENTER = to_pen{ch=9, fg=COLOR_BLACK, bg=COLOR_YELLOW}
local SLIDER_TAB_RIGHT = to_pen{ch=62, fg=COLOR_BLACK, bg=COLOR_YELLOW}
function Slider:onRenderBody(dc, rect)
local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn()
local width_per_idx = slider_get_width_per_idx(self)
-- draw track
dc:seek(1,0)
dc:char(nil, SLIDER_LEFT_END)
dc:char(nil, SLIDER_TRACK)
for stop_idx=1,self.num_stops-1 do
local track_stop_pen = SLIDER_TRACK_STOP_SELECTED
local track_pen = SLIDER_TRACK_SELECTED
if left_idx > stop_idx or right_idx < stop_idx then
track_stop_pen = SLIDER_TRACK_STOP
track_pen = SLIDER_TRACK
elseif right_idx == stop_idx then
track_pen = SLIDER_TRACK
end
dc:char(nil, track_stop_pen)
for i=2,width_per_idx do
dc:char(nil, track_pen)
end
end
if right_idx >= self.num_stops then
dc:char(nil, SLIDER_TRACK_STOP_SELECTED)
else
dc:char(nil, SLIDER_TRACK_STOP)
end
dc:char(nil, SLIDER_TRACK)
dc:char(nil, SLIDER_RIGHT_END)
-- draw tabs
dc:seek(width_per_idx*(left_idx-1))
dc:char(nil, SLIDER_TAB_LEFT)
dc:char(nil, SLIDER_TAB_CENTER)
dc:char(nil, SLIDER_TAB_RIGHT)
dc:seek(width_per_idx*(right_idx-1)+4)
dc:char(nil, SLIDER_TAB_LEFT)
dc:char(nil, SLIDER_TAB_CENTER)
dc:char(nil, SLIDER_TAB_RIGHT)
-- manage dragging
if self.is_dragging_target then
slider_do_drag(self, width_per_idx)
end
if df.global.enabler.mouse_lbut == 0 then
self.is_dragging_target = nil
self.is_dragging_idx = nil
end
end
-------------------------------- --------------------------------
-- QualityAndMaterialsPage -- QualityAndMaterialsPage
-- --
@ -328,7 +191,7 @@ function QualityAndMaterialsPage:init()
enabled=enable_item_quality, enabled=enable_item_quality,
on_change=function(val) self:set_max_quality(val+1) end, on_change=function(val) self:set_max_quality(val+1) end,
}, },
Slider{ widgets.RangeSlider{
frame={l=0, t=6}, frame={l=0, t=6},
num_stops=7, num_stops=7,
get_left_idx_fn=function() get_left_idx_fn=function()

@ -34,9 +34,10 @@ local function get_selection_size_limits()
or btype == df.building_type.RoadPaved or btype == df.building_type.RoadPaved
or btype == df.building_type.RoadDirt then or btype == df.building_type.RoadDirt then
return {w=31, h=31} return {w=31, h=31}
elseif btype == df.building_type.AxleHorizontal elseif btype == df.building_type.AxleHorizontal then
or btype == df.building_type.Rollers then
return uibs.direction == 1 and {w=1, h=31} or {w=31, h=1} return uibs.direction == 1 and {w=1, h=31} or {w=31, h=1}
elseif btype == df.building_type.Rollers then
return (uibs.direction == 1 or uibs.direction == 3) and {w=31, h=1} or {w=1, h=31}
end end
end end

@ -39,7 +39,7 @@ HotspotMenuWidget.ATTRS{
-- 'new_region', -- conflicts with vanilla panel layouts -- 'new_region', -- conflicts with vanilla panel layouts
'savegame', 'savegame',
'setupdwarfgame', 'setupdwarfgame',
'title', 'title/Default',
'update_region', 'update_region',
'world' 'world'
}, },

@ -562,4 +562,42 @@ function OverlayWidget:init()
self.frame.h = self.frame.h or 1 self.frame.h = self.frame.h or 1
end end
-- ------------------- --
-- TitleVersionOverlay --
-- ------------------- --
TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget)
TitleVersionOverlay.ATTRS{
default_pos={x=50, y=-2},
default_enabled=true,
viewscreens='title/Default',
frame={w=35, h=3},
}
function TitleVersionOverlay:init()
local text = {}
table.insert(text, 'DFHack ' .. dfhack.getDFHackVersion() ..
(dfhack.isPrerelease() and (' (git: %s)'):format(dfhack.getGitCommit(true)) or ''))
if #dfhack.getDFHackBuildID() > 0 then
table.insert(text, NEWLINE)
table.insert(text, 'Build ID: ' .. dfhack.getDFHackBuildID())
end
if dfhack.isPrerelease() then
table.insert(text, NEWLINE)
table.insert(text, {text='Pre-release build', pen=COLOR_LIGHTRED})
end
self:addviews{
widgets.Label{
frame={t=0, l=0},
text=text,
text_pen=COLOR_WHITE,
},
}
end
OVERLAY_WIDGETS = {
title_version = TitleVersionOverlay,
}
return _ENV return _ENV

@ -1,109 +0,0 @@
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <string>
#include <vector>
#include "Core.h"
#include "Console.h"
#include "Export.h"
#include "PluginManager.h"
#include "modules/Gui.h"
#include "modules/Screen.h"
#include "VTableInterpose.h"
#include "DFHackVersion.h"
#include "df/graphic.h"
#include "df/viewscreen_optionst.h"
#include "df/viewscreen_titlest.h"
#include "uicommon.h"
using std::vector;
using std::string;
using namespace DFHack;
DFHACK_PLUGIN("title-version");
DFHACK_PLUGIN_IS_ENABLED(is_enabled);
REQUIRE_GLOBAL(gps);
void draw_version(int start_x, int start_y) {
int x = start_x,
y = start_y;
OutputString(COLOR_WHITE, x, y, string("DFHack ") + DFHACK_VERSION);
if (!DFHACK_IS_RELEASE)
{
OutputString(COLOR_WHITE, x, y, " (dev)");
x = start_x; y++;
OutputString(COLOR_WHITE, x, y, "Git: ");
OutputString(COLOR_WHITE, x, y, DFHACK_GIT_DESCRIPTION);
}
if (strlen(DFHACK_BUILD_ID))
{
x = start_x; y++;
OutputString(COLOR_WHITE, x, y, "Build ID: ");
OutputString(COLOR_WHITE, x, y, DFHACK_BUILD_ID);
}
if (DFHACK_IS_PRERELEASE)
{
x = start_x; y++;
OutputString(COLOR_LIGHTRED, x, y, "Pre-release build");
}
}
struct title_version_hook : df::viewscreen_titlest {
typedef df::viewscreen_titlest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();
if (!loading)
draw_version(0, 0);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(title_version_hook, render);
struct options_version_hook : df::viewscreen_optionst {
typedef df::viewscreen_optionst interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();
if (!msg_quit && !in_retire_adv && !msg_peasant &&
!in_retire_dwf_abandon_adv && !in_abandon_dwf && !ending_game)
draw_version(2, gps->dimy - 6);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(options_version_hook, render);
DFhackCExport command_result plugin_enable (color_ostream &out, bool enable)
{
if (!gps)
return CR_FAILURE;
if (enable != is_enabled)
{
if (!INTERPOSE_HOOK(title_version_hook, render).apply(enable) ||
!INTERPOSE_HOOK(options_version_hook, render).apply(enable))
return CR_FAILURE;
is_enabled = enable;
}
return CR_OK;
}
DFhackCExport command_result plugin_init (color_ostream &out, vector<PluginCommand> &commands)
{
return CR_OK;
}
DFhackCExport command_result plugin_shutdown (color_ostream &out)
{
INTERPOSE_HOOK(title_version_hook, render).remove();
INTERPOSE_HOOK(options_version_hook, render).remove();
return CR_OK;
}

@ -1 +1 @@
Subproject commit 5da969fce69a5b9330f183cc0629798bf9907b69 Subproject commit 68f6d354b0d815ad0985dbe9b5faa140c980af14

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,9 +0,0 @@
#!/bin/sh
script_name="$(basename "$0")"
new_script_path="$(dirname "$0")/../ci/${script_name}"
printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}"
"${new_script_path}" "$@"
exit $?

@ -1,9 +0,0 @@
#!/bin/sh
script_name="$(basename "$0")"
new_script_path="$(dirname "$0")/../ci/${script_name}"
printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}"
"${new_script_path}" "$@"
exit $?

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)

@ -1,14 +0,0 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
script_name = os.path.basename(__file__)
new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name)
sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name))
sys.stderr.flush()
p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:])
sys.exit(p.returncode)