diff --git a/library/include/modules/Screen.h b/library/include/modules/Screen.h index e29233170..10b6afb21 100644 --- a/library/include/modules/Screen.h +++ b/library/include/modules/Screen.h @@ -123,6 +123,9 @@ namespace DFHack static bool is_instance(df::viewscreen *screen); + virtual int8_t movies_okay() { return 1; } + virtual bool key_conflict(df::interface_key key); + virtual bool is_lua_screen() { return false; } virtual std::string getFocusString() = 0; }; @@ -154,6 +157,5 @@ namespace DFHack virtual void help(); virtual void resize(int w, int h); virtual void feed(std::set *keys); - virtual bool key_conflict(df::interface_key key); }; } diff --git a/library/modules/Screen.cpp b/library/modules/Screen.cpp index 561ae2c5e..7dcbba322 100644 --- a/library/modules/Screen.cpp +++ b/library/modules/Screen.cpp @@ -269,6 +269,11 @@ bool dfhack_viewscreen::is_instance(df::viewscreen *screen) return dfhack_screens.count(screen) != 0; } +bool dfhack_viewscreen::key_conflict(df::interface_key key) +{ + return key == interface_key::OPTIONS; +} + /* * Lua-backed viewscreen. */ @@ -516,8 +521,3 @@ void dfhack_lua_viewscreen::feed(std::set *keys) lua_pushlightuserdata(Lua::Core::State, keys); safe_call_lua(do_input, 1, 0); } - -bool dfhack_lua_viewscreen::key_conflict(df::interface_key key) -{ - return key == interface_key::MOVIES || key == interface_key::OPTIONS; -} diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp index 5179b0132..deb45b9d9 100644 --- a/plugins/manipulator.cpp +++ b/plugins/manipulator.cpp @@ -36,7 +36,7 @@ using df::global::enabler; typedef struct { - char *name; + const char *name; int points; char abbrev; } SkillLevel; @@ -241,7 +241,7 @@ DFHACK_PLUGIN("manipulator"); #define FILTER_LIVING 0x0010 #define FILTER_DEAD 0x0020 -class viewscreen_unitlaborsst : public df::viewscreen { +class viewscreen_unitlaborsst : public dfhack_viewscreen { public: static viewscreen_unitlaborsst *create (char pushtype, df::viewscreen *scr = NULL); @@ -251,12 +251,11 @@ public: void resize(int w, int h) { calcSize(); } void help() { } - int8_t movies_okay() { return 1; } - int8_t is_option_screen() { return 0; } - int8_t is_save_screen() { return 0; } + + std::string getFocusString() { return "unitlabors"; } + viewscreen_unitlaborsst(); ~viewscreen_unitlaborsst() { }; - bool key_conflict(df::interface_key test_key) { return test_key == interface_key::OPTIONS; } protected: vector units; @@ -577,11 +576,7 @@ void viewscreen_unitlaborsst::render() str += ENUM_ATTR_STR(job_skill, caption_noun, columns[sel_column].skill); if (level != NUM_SKILL_LEVELS - 1) { - str += " ("; - str += itoa(skill->experience, buf, 10); - str += "/"; - str += itoa(skill_levels[level].points, buf, 10); - str += ")"; + str += stl_sprintf(" (%d/%d)", skill->experience, skill_levels[level].points); } } else