git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@645 c06c8d41-db1a-0410-9941-cceddc491573
M7UBBA4B6VWC4UDEJWOYB3VW7QCLRKJHOKVRJE6JFZW3JSMQCYTAC
// Remove the "empty" autoinscription, if present.
// Return true if the inscription was there, false otherwise.
bool remove_empty_inscription( item_def& item )
{
const char* empty_inscription = "empty";
size_t p = item.inscription.find(empty_inscription);
if ( p != std::string::npos )
{
// found it, delete it
size_t prespace = 0;
// if preceded by a space, delete that too
if ( p != 0 && item.inscription[p-1] == ' ' )
prespace = 1;
item.inscription =
item.inscription.substr(0, p - prespace) +
item.inscription.substr(p + strlen(empty_inscription),
std::string::npos);
return true;
}
else
return false;
}
// remove "empty" autoinscription
const char* empty_inscription = "empty";
size_t p = wand.inscription.find(empty_inscription);
if ( p != std::string::npos ) {
// found it, delete it
size_t prespace = 0;
if ( p != 0 && wand.inscription[p-1] == ' ' )
prespace = 1;
wand.inscription =
wand.inscription.substr(0, p - prespace) +
wand.inscription.substr(p + strlen(empty_inscription),
std::string::npos);
}
remove_empty_inscription(wand);