std::string Unit::formatGeneralMessage(const int32_t baseTextId) const { const int32_t textId = VLC->generaltexth->pluralText(baseTextId, getCount()); MetaString text; text.addTxt(MetaString::GENERAL_TXT, textId); text.addCreReplacement(creatureId(), getCount()); return text.toString(); }
void Unit::addText(MetaString & text, ui8 type, int32_t serial, const boost::logic::tribool & plural) const { if(boost::logic::indeterminate(plural)) serial = VLC->generaltexth->pluralText(serial, getCount()); else if(plural) serial = VLC->generaltexth->pluralText(serial, 2); else serial = VLC->generaltexth->pluralText(serial, 1); text.addTxt(type, serial); }
void IBoatGenerator::getProblemText(MetaString &out, const CGHeroInstance *visitor) const { switch(shipyardStatus()) { case BOAT_ALREADY_BUILT: out.addTxt(MetaString::GENERAL_TXT, 51); break; case TILE_BLOCKED: if(visitor) { out.addTxt(MetaString::GENERAL_TXT, 134); out.addReplacement(visitor->name); } else out.addTxt(MetaString::ADVOB_TXT, 189); break; case NO_WATER: logGlobal->error("Shipyard without water! %s \t %d", o->pos.toString(), o->id.getNum()); return; } }