MCPcopy Create free account
hub / github.com/crawl/crawl / stack_five

Function stack_five

crawl-ref/source/decks.cc:831–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831bool 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.

Callers 1

run_uncancelsFunction · 0.85

Calls 13

_draw_stackFunction · 0.85
card_nameFunction · 0.85
tile_defClass · 0.85
parse_stringFunction · 0.85
get_intMethod · 0.80
sizeMethod · 0.45
set_titleMethod · 0.45
add_tileMethod · 0.45
add_entryMethod · 0.45
set_moreMethod · 0.45
showMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected