| 829 | } |
| 830 | |
| 831 | bool stack_five(int to_stack) |
| 832 | { |
| 833 | auto& stack = you.props[NEMELEX_STACK_KEY].get_vector(); |
| 834 | |
| 835 | // TODO: this loop makes me sad |
| 836 | while (stack.size() < to_stack) |
| 837 | { |
| 838 | if (crawl_state.seen_hups) |
| 839 | return false; |
| 840 | |
| 841 | _draw_stack(to_stack); |
| 842 | } |
| 843 | |
| 844 | StackFiveMenu menu(stack); |
| 845 | MenuEntry *const title = new MenuEntry("Select two cards to swap them:", MEL_TITLE); |
| 846 | menu.set_title(title); |
| 847 | for (unsigned int i = 0; i < stack.size(); i++) |
| 848 | { |
| 849 | MenuEntry * const entry = |
| 850 | new MenuEntry(card_name((card_type)stack[i].get_int()), |
| 851 | MEL_ITEM, 1, '1'+i); |
| 852 | entry->add_tile(tile_def(TILEG_NEMELEX_CARD)); |
| 853 | menu.add_entry(entry); |
| 854 | } |
| 855 | menu.set_more(formatted_string::parse_string( |
| 856 | "<lightgrey>Press <w>?</w> for the card descriptions" |
| 857 | " or <w>Enter</w> to accept.")); |
| 858 | menu.show(); |
| 859 | |
| 860 | if (crawl_state.seen_hups) |
| 861 | return false; |
| 862 | else |
| 863 | { |
| 864 | std::reverse(stack.begin(), stack.end()); |
| 865 | return true; |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | // Draw the top four cards of an deck and play them all. |
| 870 | // Return spret::abort if the operation was failed/aborted along the way. |
no test coverage detected