Clean up Merc::LoadMerc lastname processing

This is still less than ideal, but client's name restrictions should
prevent this from being an actual problem
This commit is contained in:
Michael Cook (mackal) 2021-03-05 15:43:06 -05:00
parent 316336d1cf
commit f7d40ec88e

View File

@ -4791,7 +4791,12 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id,
tmpsize = c->GetMercInfo().MercSize;
}
sprintf(npc_type->lastname, "%s's Mercenary", c->GetName());
std::string tmp_lastname = c->GetName();
tmp_lastname += "'s Mercenary";
// not sure what to do if too long
if (tmp_lastname.length() < sizeof(npc_type->lastname))
strn0cpy(npc_type->lastname, tmp_lastname.c_str(), sizeof(npc_type->lastname));
npc_type->gender = tmpgender;
npc_type->size = tmpsize;
npc_type->loottable_id = 0; // Loottable has to be 0, otherwise we'll be leavin' some corpses!