Merge remote-tracking branch 'lethosor/cmdprompt-cursor' into develop

develop
expwnent 2014-11-28 23:13:09 -05:00
commit 5b1eb0e770
6 changed files with 13 additions and 5 deletions

@ -6,6 +6,7 @@ DFHack Future
New plugins: New plugins:
New scripts: New scripts:
Misc improvements: Misc improvements:
- cmd-prompt can now access selected items, units, and buildings
DFHack 0.40.16-r1 DFHack 0.40.16-r1
Internals: Internals:

@ -86,6 +86,7 @@ namespace DFHack
// A unit is selected via 'v', 'k', unitjobs, or // A unit is selected via 'v', 'k', unitjobs, or
// a full-screen item view of a cage or suchlike // a full-screen item view of a cage or suchlike
DFHACK_EXPORT bool any_unit_hotkey(df::viewscreen *top); DFHACK_EXPORT bool any_unit_hotkey(df::viewscreen *top);
DFHACK_EXPORT df::unit *getAnyUnit(df::viewscreen *top);
DFHACK_EXPORT df::unit *getSelectedUnit(color_ostream &out, bool quiet = false); DFHACK_EXPORT df::unit *getSelectedUnit(color_ostream &out, bool quiet = false);
// An item is selected via 'v'->inventory, 'k', 't', or // An item is selected via 'v'->inventory, 'k', 't', or
@ -93,10 +94,12 @@ namespace DFHack
// last case, the highlighted contained item is returned, not // last case, the highlighted contained item is returned, not
// the container itself. // the container itself.
DFHACK_EXPORT bool any_item_hotkey(df::viewscreen *top); DFHACK_EXPORT bool any_item_hotkey(df::viewscreen *top);
DFHACK_EXPORT df::item *getAnyItem(df::viewscreen *top);
DFHACK_EXPORT df::item *getSelectedItem(color_ostream &out, bool quiet = false); DFHACK_EXPORT df::item *getSelectedItem(color_ostream &out, bool quiet = false);
// A building is selected via 'q', 't' or 'i' (civzone) // A building is selected via 'q', 't' or 'i' (civzone)
DFHACK_EXPORT bool any_building_hotkey(df::viewscreen *top); DFHACK_EXPORT bool any_building_hotkey(df::viewscreen *top);
DFHACK_EXPORT df::building *getAnyBuilding(df::viewscreen *top);
DFHACK_EXPORT df::building *getSelectedBuilding(color_ostream &out, bool quiet = false); DFHACK_EXPORT df::building *getSelectedBuilding(color_ostream &out, bool quiet = false);
// Low-level API that gives full control over announcements and reports // Low-level API that gives full control over announcements and reports

@ -773,7 +773,7 @@ df::job *Gui::getSelectedJob(color_ostream &out, bool quiet)
return getSelectedWorkshopJob(out, quiet); return getSelectedWorkshopJob(out, quiet);
} }
static df::unit *getAnyUnit(df::viewscreen *top) df::unit *Gui::getAnyUnit(df::viewscreen *top)
{ {
using namespace ui_sidebar_mode; using namespace ui_sidebar_mode;
using df::global::ui; using df::global::ui;
@ -904,7 +904,7 @@ df::unit *Gui::getSelectedUnit(color_ostream &out, bool quiet)
return unit; return unit;
} }
static df::item *getAnyItem(df::viewscreen *top) df::item *Gui::getAnyItem(df::viewscreen *top)
{ {
using namespace ui_sidebar_mode; using namespace ui_sidebar_mode;
using df::global::ui; using df::global::ui;
@ -1017,7 +1017,7 @@ df::item *Gui::getSelectedItem(color_ostream &out, bool quiet)
return item; return item;
} }
static df::building *getAnyBuilding(df::viewscreen *top) df::building *Gui::getAnyBuilding(df::viewscreen *top)
{ {
using namespace ui_sidebar_mode; using namespace ui_sidebar_mode;
using df::global::ui; using df::global::ui;

@ -12,6 +12,6 @@ fi
old_tty_settings=$(stty -g) old_tty_settings=$(stty -g)
cd "${PWD}" cd "${PWD}"
DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@" DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib ./dwarfort.exe "$@" 2>&1 | tee dfhack.log
stty "$old_tty_settings" stty "$old_tty_settings"
echo "" echo ""

@ -65,7 +65,7 @@ case "$1" in
ret=$? ret=$?
;; ;;
*) *)
setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@" setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@" 2>&1 | tee dfhack.log
ret=$? ret=$?
;; ;;
esac esac

@ -50,6 +50,10 @@ public:
void help() { } void help() { }
int8_t movies_okay() { return 0; } int8_t movies_okay() { return 0; }
df::unit* getSelectedUnit() { return Gui::getAnyUnit(parent); }
df::item* getSelectedItem() { return Gui::getAnyItem(parent); }
df::building* getSelectedBuilding() { return Gui::getAnyBuilding(parent); }
std::string getFocusString() { return "commandprompt"; } std::string getFocusString() { return "commandprompt"; }
viewscreen_commandpromptst(std::string entry):is_response(false) viewscreen_commandpromptst(std::string entry):is_response(false)
{ {