Skip to content

Commit

Permalink
Merge pull request #289 from eswald/trade-search
Browse files Browse the repository at this point in the history
Moving trade screen search lines
  • Loading branch information
quietust committed Aug 28, 2014
2 parents 5ccd7db + 6d9d616 commit f0c52a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
16 changes: 10 additions & 6 deletions plugins/autotrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,15 +489,19 @@ struct tradeview_hook : public df::viewscreen_tradegoodsst
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();

// Insert into the blank line between trade items and standard keys.
// The blank line at the bottom is taken by the search plugin.
auto dim = Screen::getWindowSize();
int y = dim.y - 5;

int x = 2;
int y = 27;
OutputHotkeyString(x, y, "Mark all", "m", true, 2);
OutputHotkeyString(x, y, "Unmark all", "u");
OutputHotkeyString(x, y, "Mark all, ", "m", false, x, COLOR_WHITE, COLOR_LIGHTRED);
OutputHotkeyString(x, y, "Unmark all", "u", false, x, COLOR_WHITE, COLOR_LIGHTRED);

x = 42;
y = 27;
OutputHotkeyString(x, y, "Mark all", "Shift-m", true, 42);
OutputHotkeyString(x, y, "Unmark all", "Shift-u");
OutputHotkeyString(x, y, "Mark all, ", "M", false, x, COLOR_WHITE, COLOR_LIGHTRED);
OutputHotkeyString(x, y, "Unmark all", "U", false, x, COLOR_WHITE, COLOR_LIGHTRED);
}
};

Expand Down
14 changes: 7 additions & 7 deletions plugins/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,10 @@ template <class T, class V, int D> V generic_search_hook<T, V, D> ::module;


// Hook definition helpers
#define IMPLEMENT_HOOKS_WITH_ID(screen, module, id) \
#define IMPLEMENT_HOOKS_WITH_ID(screen, module, id, prio) \
typedef generic_search_hook<screen, module, id> module##_hook; \
template<> IMPLEMENT_VMETHOD_INTERPOSE(module##_hook, feed); \
template<> IMPLEMENT_VMETHOD_INTERPOSE(module##_hook, render)
template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(module##_hook, feed, prio); \
template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(module##_hook, render, prio)

#define IMPLEMENT_HOOKS(screen, module) \
typedef generic_search_hook<screen, module> module##_hook; \
Expand Down Expand Up @@ -1074,7 +1074,7 @@ class trade_search_merc : public trade_search_base
public:
virtual void render() const
{
print_search_option(2, 26);
print_search_option(2, -1);

if (!search_string.empty())
{
Expand Down Expand Up @@ -1108,15 +1108,15 @@ class trade_search_merc : public trade_search_base
}
};

IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_merc, 1);
IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_merc, 1, 100);


class trade_search_fort : public trade_search_base
{
public:
virtual void render() const
{
print_search_option(42, 26);
print_search_option(42, -1);

if (!search_string.empty())
{
Expand Down Expand Up @@ -1150,7 +1150,7 @@ class trade_search_fort : public trade_search_base
}
};

IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_fort, 2);
IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_fort, 2, 100);

//
// END: Trade screen search
Expand Down

0 comments on commit f0c52a9

Please sign in to comment.