MCPcopy Create free account
hub / github.com/DFHack/dfhack / feed

Method feed

plugins/embark-assistant/finder_ui.cpp:1620–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618 //===============================================================================
1619
1620 void ViewscreenFindUi::feed(std::set<df::interface_key> *input) {
1621 if (input->count(df::interface_key::LEAVESCREEN))
1622 {
1623 input->clear();
1624 Screen::dismiss(this);
1625 return;
1626
1627 } else if (input->count(df::interface_key::STANDARDSCROLL_LEFT) ||
1628 input->count(df::interface_key::STANDARDSCROLL_RIGHT)) {
1629 state->finder_list_active = !state->finder_list_active;
1630
1631 } else if (input->count(df::interface_key::STANDARDSCROLL_UP)) {
1632 if (state->finder_list_active) {
1633 if (state->finder_list_focus > 0) {
1634 state->finder_list_focus--;
1635 }
1636 else {
1637 state->finder_list_focus = static_cast<uint16_t>(last_fields) + state->civs.size() - 1;
1638 }
1639 }
1640 else {
1641 if (state->plotinfo[state->finder_list_focus]->current_index > 0) {
1642 state->plotinfo[state->finder_list_focus]->current_index--;
1643 } else {
1644 state->plotinfo[state->finder_list_focus]->current_index = static_cast<uint16_t>(state->plotinfo[state->finder_list_focus]->list.size()) - 1;
1645 }
1646 }
1647
1648 } else if (input->count(df::interface_key::STANDARDSCROLL_DOWN)) {
1649 if (state->finder_list_active) {
1650 if (state->finder_list_focus < static_cast<uint16_t>(last_fields) + state->civs.size() - 1) {
1651 state->finder_list_focus++;
1652 } else {
1653 state->finder_list_focus = 0;
1654 }
1655 }
1656 else {
1657 if (state->plotinfo[state->finder_list_focus]->current_index < state->plotinfo[state->finder_list_focus]->list.size() - 1) {
1658 state->plotinfo[state->finder_list_focus]->current_index++;
1659 } else {
1660 state->plotinfo[state->finder_list_focus]->current_index = 0;
1661 }
1662 }
1663
1664 } else if (input->count(df::interface_key::SELECT)) {
1665 if (!state->finder_list_active) {
1666 state->plotinfo[state->finder_list_focus]->current_display_value = state->plotinfo[state->finder_list_focus]->current_index;
1667 state->plotinfo[state->finder_list_focus]->current_value = state->plotinfo[state->finder_list_focus]->list[state->plotinfo[state->finder_list_focus]->current_index].key;
1668 state->finder_list_active = true;
1669 }
1670
1671 } else if (input->count(df::interface_key::CUSTOM_F)) {
1672 input->clear();
1673 Screen::dismiss(this);
1674 find();
1675 return;
1676
1677 } else if (input->count(df::interface_key::CUSTOM_S)) { // Save

Callers

nothing calls this directly

Calls 6

save_profileFunction · 0.85
load_profileFunction · 0.85
findFunction · 0.70
countMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected