Block and grey out the trade screen actions when search is active.

After actually trying the search in game, it is obvious that
clearing search upon pressing the trade button is confusing,
because if you don't pay enough attention, it looks exactly
like as if the trade actually happened.
develop
Alexander Gavrilov 2013-01-16 20:42:41 +04:00
parent 597074498f
commit e1a2e6ece4
2 changed files with 39 additions and 8 deletions

@ -2105,7 +2105,9 @@ directly to the main dwarf mode screen.
Search
======
The search plugin adds search to the Stocks, Trading, Stockpile and Unit List screens.
The search plugin adds search to the Stocks, Animals, Trading, Stockpile,
Noble (assignment candidates), Military (position candidates), Burrows
(unit list), Rooms, Announcements, Job List and Unit List screens.
.. image:: images/search.png
@ -2125,8 +2127,9 @@ Leaving any screen automatically clears the filter.
In the Trade screen, the actual trade will always only act on items that
are actually visible in the list; the same effect applies to the Trade
Value numbers displayed by the screen. Because of this, pressing the 't'
key while search is active clears the search instead of executing the trade.
Value numbers displayed by the screen. Because of this, the 't' key is
blocked while search is active, so you have to reset the filters first.
Pressing Alt-C will clear both search strings.
In the stockpile screen the option only appears if the cursor is in the
rightmost list:

@ -57,6 +57,27 @@ void OutputString(int8_t color, int &x, int y, const std::string &text)
x += text.length();
}
void make_text_dim(int x1, int x2, int y)
{
for (int x = x1; x <= x2; x++)
{
Screen::Pen pen = Screen::readTile(x,y);
if (pen.valid())
{
if (pen.fg != 0)
{
if (pen.fg == 7)
pen.adjust(0,true);
else
pen.bold = 0;
}
Screen::paintTile(pen,x,y);
}
}
}
static bool is_live_screen(const df::viewscreen *screen)
{
for (df::viewscreen *cur = &gview->view; cur; cur = cur->child)
@ -1015,13 +1036,8 @@ private:
{
// Block the keys if were searching
if (!search_string.empty())
{
input->clear();
// Send a force clear to other search class too
input->insert(interface_key::CUSTOM_ALT_C);
}
clear_search_for_trade();
return false;
}
else if (input->count(interface_key::CUSTOM_ALT_C))
@ -1048,6 +1064,12 @@ public:
virtual void render() const
{
print_search_option(2, 26);
if (!search_string.empty())
{
make_text_dim(2, 37, 22);
make_text_dim(42, gps->dimx-2, 22);
}
}
private:
@ -1081,6 +1103,12 @@ public:
virtual void render() const
{
print_search_option(42, 26);
if (!search_string.empty())
{
make_text_dim(2, 37, 22);
make_text_dim(42, gps->dimx-2, 22);
}
}
private: