--- deliantra/server/common/player.C 2012/10/29 23:55:52 1.71 +++ deliantra/server/common/player.C 2012/11/21 12:59:44 1.73 @@ -286,7 +286,7 @@ // end == 0, till eos // end >= 1, levels of " >>>" static const char * -expand_cfpod (const player *pl, dynbuf_text &buf, const char *cfpod, int end = 0) +expand_cfpod (int hintmode, int gender, dynbuf_text &buf, const char *cfpod, int end = 0) { static dynbuf_text nest(128, 128); @@ -364,9 +364,8 @@ break; - case 'B': case 'C': case 'E': case 'G': - case 'H': case 'I': case 'T': case 'U': - case 'Z': + case 'B': case 'C': case 'E': case 'G': case 'H': + case 'I': case 'L': case 'T': case 'U': case 'Z': { int end = 0; @@ -396,14 +395,29 @@ case 'T': pfx = ""; sfx = ""; break; case 'Z': pfx = "" ; sfx = "" ; break; + case 'L': // link, not really supported - always use first (or only) component + { + cfpod = expand_cfpod (hintmode, gender, nest, cfpod, end); + nest << '\0'; // zero-terminate + + const char *str = nest.linearise (); + const char *sep = strchr (str, '|'); + + buf.add (str, sep ? sep - str : nest.size ()); + + nest.clear (); + + goto skip; + } + case 'H': // hint { - if (pl->hintmode) + if (hintmode) { - cfpod = expand_cfpod (pl, nest, cfpod, end); + cfpod = expand_cfpod (hintmode, gender, nest, cfpod, end); nest.clear (); - if (pl->hintmode == 1) + if (hintmode == 1) buf << "[Hint available]"; else while (*cfpod <= ' '&& *cfpod) // eat trailing whitespace @@ -421,7 +435,7 @@ case 'G': // gender { - cfpod = expand_cfpod (pl, nest, cfpod, end); + cfpod = expand_cfpod (hintmode, gender, nest, cfpod, end); nest << '\0'; // zero-terminate const char *str = nest.linearise (); @@ -429,7 +443,7 @@ if (sep) { - if (pl->gender) + if (gender) buf.add (sep + 1, nest.size () - (sep - str) - 2); else buf.add (str, sep - str); @@ -447,7 +461,7 @@ } buf << pfx; - cfpod = expand_cfpod (pl, buf, cfpod, end); + cfpod = expand_cfpod (hintmode, gender, buf, cfpod, end); buf << sfx; } @@ -464,7 +478,7 @@ do { buf << ""; - cfpod = expand_cfpod (pl, buf, cfpod, -2); + cfpod = expand_cfpod (hintmode, gender, buf, cfpod, -2); buf << "\n"; while (*cfpod == '\n') @@ -477,13 +491,19 @@ } dynbuf_text * -player::expand_cfpod (const char *cfpod) const +player::expand_cfpod (int hintmode, int gender, const_utf8_string cfpod) { - static dynbuf_text buf(1024, 1024); + static dynbuf_text buf(65536, 1024); buf.clear (); - ::expand_cfpod (this, buf, cfpod); + ::expand_cfpod (hintmode, gender, buf, cfpod); return &buf; } +dynbuf_text * +player::expand_cfpod (const_utf8_string cfpod) const +{ + return expand_cfpod (hintmode, gender, cfpod); +} +