(so Menu doesn't need to be aware of the tutorial.) set_more() support with multi-line strings will only work if there are enough free lines; it doesn't (yet) reduce pagesize. Also, it doesn't handle newlines which aren't EOLs.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1700 c06c8d41-db1a-0410-9941-cceddc491573
2N5AKUYV6EUUT254C47WSHZKD7FGN65JKJ3RCKSDP74XJIHIFMDQC
YQ5IYBHW2ICYKOC2M6CI5BNOZKST3DIMMZRQN72LUQCHDAPVYQCQC
VNIAJEGE3PYE6F6EAMCQDWMAS52EQTKJUPAFXK7ARCITZ326WTTQC
IHIJSWVOONSTA2WCHKW3YKBLETUQECFVBVLMET5SGQZ4C6U3GCUQC
77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC
7NDXS36TE7QVXTXJWMYSVG5UHCCLPIO4VL6NXFGTDK3ZNKE3A2IAC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
J75GZPQLMV3NRQ6KP7FXHZXJ63L62NFGVNPVK7XFM65XLFQP5CUQC
SGR2P5BGJIJHVSSQYQHWS4ORLVHQBZTDES3D4BFC6SVAQXSKENNQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
4XGOVPFCU6KZIYHKWCHUTZY6G5S326DKBG3UREPR34Q4TSDD3TAAC
WXSNNK2RXP3DQFAEQGQUZJHFWXJC7ZKG2WURZGL566UDM4YXFSWQC
const int bottom_line = (get_number_of_lines() > 30) ? 30 : get_number_of_lines();
textcolor(MAGENTA);
gotoxy(1, bottom_line-5);
std::string text =
"This screen shows your character's set of talents. You can gain new " EOL
"abilities via certain items, through religion or by way of mutations. " EOL
"Activation of an ability usually comes at a cost, e.g. nutrition or " EOL
"Magic power. ";
if (you.religion == GOD_TROG) text +=
"<w>Renounce Religion<magenta> will make your character leave your god" EOL
"(and usually anger said god), while <w>Berserk<magenta> temporarily increases your" EOL
"damage output in melee fights.";
formatted_string::parse_block(text, false).display();
std::string text = "<magenta>"
"This screen shows your character's set of talents. You can gain new " EOL
"abilities via certain items, through religion or by way of mutations. " EOL
"Activation of an ability usually comes at a cost, e.g. nutrition or " EOL
"Magic power. ";
if (you.religion == GOD_TROG)
{
text +=
"<w>Renounce Religion<magenta> will make your character leave your god" EOL
"(and usually anger said god), while <w>Berserk<magenta> temporarily increases your" EOL
"damage output in melee fights.";
}
return formatted_string::parse_string(text, false);
int count_linebreaks(const formatted_string& fs)
{
std::string::size_type where = 0;
const std::string s = fs;
int count = 0;
while ( 1 )
{
where = s.find(EOL, where);
if ( where == std::string::npos )
break;
else
{
++count;
++where;
}
}
return count;
}
bool tutorial = (Options.tutorial_left > 0);
std::vector<MenuEntry*> sel = abil_menu.show(false, tutorial);
if ( Options.tutorial_left )
{
// XXX This could be buggy if manage to pick up lots and lots
// of abilities during the tutorial.
abil_menu.set_more(tut_abilities_info());
abil_menu.set_flags(MF_SINGLESELECT | MF_ANYPRINTABLE |
MF_ALWAYS_SHOW_MORE);
}
std::vector<MenuEntry*> sel = abil_menu.show(false);