Provide and use universal way for get locale and locale index for chat/console command use.

This commit is contained in:
VladimirMangos 2009-05-19 00:45:48 +04:00
parent 695d83568a
commit fdbc22ac93
6 changed files with 56 additions and 30 deletions

View file

@ -309,9 +309,9 @@ bool ChatHandler::HandleGPSCommand(const char* args)
uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0;
PSendSysMessage(LANG_MAP_POSITION,
obj->GetMapId(), (mapEntry ? mapEntry->name[m_session->GetSessionDbcLocale()] : "<unknown>" ),
zone_id, (zoneEntry ? zoneEntry->area_name[m_session->GetSessionDbcLocale()] : "<unknown>" ),
area_id, (areaEntry ? areaEntry->area_name[m_session->GetSessionDbcLocale()] : "<unknown>" ),
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>" ),
zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ),
area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ),
obj->GetPhaseMask(),
obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
@ -1818,7 +1818,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag);
if (areaEntry)
{
int loc = m_session ? m_session->GetSessionDbcLocale () : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale ();
std::string name = areaEntry->area_name[loc];
if (name.empty())
continue;
@ -1828,7 +1828,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if (m_session && loc==m_session->GetSessionDbcLocale ())
if (loc==GetSessionDbcLocale ())
continue;
name = areaEntry->area_name[loc];
@ -2432,7 +2432,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args)
if(map->Instanceable())
{
PSendSysMessage(LANG_INVALID_ZONE_MAP,areaEntry->ID,areaEntry->area_name[m_session->GetSessionDbcLocale()],map->GetId(),map->GetMapName());
PSendSysMessage(LANG_INVALID_ZONE_MAP,areaEntry->ID,areaEntry->area_name[GetSessionDbcLocale()],map->GetId(),map->GetMapName());
SetSentErrorMessage(true);
return false;
}