mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
[11743] Fixed auction crash in case missing localization for only some items
Source crash in missing locale strings array size check before access to it in locale structure. Also move repeating code for access to wide used localization string arrays to ObjectMgr functions.
This commit is contained in:
parent
bc171d5f97
commit
3e0cacbdaf
15 changed files with 203 additions and 315 deletions
|
|
@ -2330,17 +2330,9 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
|
|||
// overwrite WorldObject function for proper name localization
|
||||
const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
|
||||
{
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry());
|
||||
if (cl)
|
||||
{
|
||||
if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty())
|
||||
return cl->Name[loc_idx].c_str();
|
||||
}
|
||||
}
|
||||
|
||||
return GetName();
|
||||
char const* name = GetName();
|
||||
sObjectMgr.GetCreatureLocaleStrings(GetEntry(), loc_idx, &name);
|
||||
return name;
|
||||
}
|
||||
|
||||
void Creature::SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue