Core: Cleanup locale handling.

It also fixes the recent problem of strange strings.

--HG--
branch : trunk
This commit is contained in:
linencloth
2010-09-17 07:04:29 +02:00
parent 5de48a67c6
commit d8a854d6e0
19 changed files with 39 additions and 45 deletions
@@ -2385,9 +2385,9 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
}
// overwrite WorldObject function for proper name localization
const char* Creature::GetNameForLocaleIdx(int32 loc_idx) const
const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
{
if (loc_idx >= 0)
if (loc_idx != DEFAULT_LOCALE)
{
uint8 uloc_idx = uint8(loc_idx);
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(GetEntry());
+1 -1
View File
@@ -526,7 +526,7 @@ class Creature : public Unit, public GridObject<Creature>
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
// overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const;
const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void setDeathState(DeathState s); // overwrite virtual Unit::setDeathState
bool FallGround();
@@ -1710,9 +1710,9 @@ void GameObject::EventInform(uint32 eventId)
}
// overwrite WorldObject function for proper name localization
const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
const char* GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const
{
if (loc_idx >= 0)
if (loc_idx != DEFAULT_LOCALE)
{
uint8 uloc_idx = uint8(loc_idx);
if (GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry()))
@@ -622,7 +622,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
// overwrite WorldObject function for proper name localization
const char* GetNameForLocaleIdx(int32 locale_idx) const;
const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
+2 -2
View File
@@ -1634,7 +1634,7 @@ namespace Trinity
public:
MonsterChatBuilder(WorldObject const& obj, ChatMsg msgtype, int32 textId, uint32 language, uint64 targetGUID)
: i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(language), i_targetGUID(targetGUID) {}
void operator()(WorldPacket& data, int32 loc_idx)
void operator()(WorldPacket& data, LocaleConstant loc_idx)
{
char const* text = sObjectMgr.GetTrinityString(i_textId,loc_idx);
@@ -1715,7 +1715,7 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp
if (!player || !player->GetSession())
return;
uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
char const* text = sObjectMgr.GetTrinityString(textId, loc_idx);
WorldPacket data(SMSG_MESSAGECHAT, 200);
+1 -1
View File
@@ -612,7 +612,7 @@ class WorldObject : public Object, public WorldLocation
const char* GetName() const { return m_name.c_str(); }
void SetName(const std::string& newname) { m_name=newname; }
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
virtual const char* GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return GetName(); }
float GetDistance(const WorldObject *obj) const
{