Minor styling tidy up
This commit is contained in:
parent
54dfa8af3b
commit
cf04a9518e
@ -128,16 +128,24 @@ World::World()
|
||||
m_availableDbcLocaleMask = 0;
|
||||
|
||||
for (int i = 0; i < CONFIG_UINT32_VALUE_COUNT; ++i)
|
||||
{ m_configUint32Values[i] = 0; }
|
||||
{
|
||||
m_configUint32Values[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < CONFIG_INT32_VALUE_COUNT; ++i)
|
||||
{ m_configInt32Values[i] = 0; }
|
||||
{
|
||||
m_configInt32Values[i] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < CONFIG_FLOAT_VALUE_COUNT; ++i)
|
||||
{ m_configFloatValues[i] = 0.0f; }
|
||||
{
|
||||
m_configFloatValues[i] = 0.0f;
|
||||
}
|
||||
|
||||
for (int i = 0; i < CONFIG_BOOL_VALUE_COUNT; ++i)
|
||||
{ m_configBoolValues[i] = false; }
|
||||
{
|
||||
m_configBoolValues[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// World destructor
|
||||
@ -153,11 +161,15 @@ World::~World()
|
||||
|
||||
CliCommandHolder* command = NULL;
|
||||
while (cliCmdQueue.next(command))
|
||||
{ delete command; }
|
||||
{
|
||||
delete command;
|
||||
}
|
||||
|
||||
WorldSession* session = NULL;
|
||||
while (addSessQueue.next(session))
|
||||
{ delete session; }
|
||||
{
|
||||
delete session;
|
||||
}
|
||||
|
||||
VMAP::VMapFactory::clear();
|
||||
MMAP::MMapFactory::clear();
|
||||
@ -177,9 +189,13 @@ WorldSession* World::FindSession(uint32 id) const
|
||||
SessionMap::const_iterator itr = m_sessions.find(id);
|
||||
|
||||
if (itr != m_sessions.end())
|
||||
{ return itr->second; } // also can return NULL for kicked session
|
||||
{
|
||||
return itr->second;
|
||||
} // also can return NULL for kicked session
|
||||
else
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove a given session
|
||||
@ -191,7 +207,9 @@ bool World::RemoveSession(uint32 id)
|
||||
if (itr != m_sessions.end() && itr->second)
|
||||
{
|
||||
if (itr->second->PlayerLoading())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
itr->second->KickPlayer();
|
||||
}
|
||||
|
||||
@ -231,7 +249,9 @@ World::AddSession_(WorldSession* s)
|
||||
{
|
||||
// prevent decrease sessions count if session queued
|
||||
if (RemoveQueuedSession(old->second))
|
||||
{ decrease_session = false; }
|
||||
{
|
||||
decrease_session = false;
|
||||
}
|
||||
// not remove replaced session form queue if listed
|
||||
delete old->second;
|
||||
}
|
||||
@ -246,7 +266,9 @@ World::AddSession_(WorldSession* s)
|
||||
// so we don't count the user trying to
|
||||
// login as a session and queue the socket that we are using
|
||||
if (decrease_session)
|
||||
{ --Sessions; }
|
||||
{
|
||||
--Sessions;
|
||||
}
|
||||
|
||||
if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity() == SEC_PLAYER)
|
||||
{
|
||||
@ -288,7 +310,9 @@ int32 World::GetQueuedSessionPos(WorldSession* sess)
|
||||
|
||||
for (Queue::const_iterator iter = m_QueuedSessions.begin(); iter != m_QueuedSessions.end(); ++iter, ++position)
|
||||
if ((*iter) == sess)
|
||||
{ return position; }
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -336,7 +360,9 @@ bool World::RemoveQueuedSession(WorldSession* sess)
|
||||
|
||||
// if session not queued then we need decrease sessions count
|
||||
if (!found && sessions)
|
||||
{ --sessions; }
|
||||
{
|
||||
--sessions;
|
||||
}
|
||||
|
||||
// accept first in queue
|
||||
if ((!m_playerLimit || (int32)sessions < m_playerLimit) && !m_QueuedSessions.empty())
|
||||
@ -354,7 +380,9 @@ bool World::RemoveQueuedSession(WorldSession* sess)
|
||||
// update position from iter to end()
|
||||
// iter point to first not updated socket, position store new position
|
||||
for (; iter != m_QueuedSessions.end(); ++iter, ++position)
|
||||
{ (*iter)->SendAuthWaitQue(position); }
|
||||
{
|
||||
(*iter)->SendAuthWaitQue(position);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
@ -485,12 +513,18 @@ void World::LoadConfigSettings(bool reload)
|
||||
setConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL, "AutoBroadcast", 600);
|
||||
|
||||
if (getConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL) > 0)
|
||||
{ m_broadcastEnable = true; }
|
||||
{
|
||||
m_broadcastEnable = true;
|
||||
}
|
||||
else
|
||||
{ m_broadcastEnable = false; }
|
||||
{
|
||||
m_broadcastEnable = false;
|
||||
}
|
||||
|
||||
if (reload && m_broadcastEnable)
|
||||
{ m_broadcastTimer.SetInterval(getConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL) * IN_MILLISECONDS); }
|
||||
{
|
||||
m_broadcastTimer.SetInterval(getConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL) * IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
std::string forceLoadGridOnMaps = sConfig.GetStringDefault("LoadAllGridsOnMaps", "");
|
||||
@ -509,24 +543,34 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
setConfigMin(CONFIG_UINT32_INTERVAL_GRIDCLEAN, "GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS, MIN_GRID_DELAY);
|
||||
if (reload)
|
||||
{ sMapMgr.SetGridCleanUpDelay(getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN)); }
|
||||
{
|
||||
sMapMgr.SetGridCleanUpDelay(getConfig(CONFIG_UINT32_INTERVAL_GRIDCLEAN));
|
||||
}
|
||||
|
||||
setConfig(CONFIG_UINT32_NUMTHREADS, "MapUpdateThreads", 2);
|
||||
|
||||
setConfigMin(CONFIG_UINT32_INTERVAL_MAPUPDATE, "MapUpdateInterval", 100, MIN_MAP_UPDATE_DELAY);
|
||||
if (reload)
|
||||
{ sMapMgr.SetMapUpdateInterval(getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE)); }
|
||||
{
|
||||
sMapMgr.SetMapUpdateInterval(getConfig(CONFIG_UINT32_INTERVAL_MAPUPDATE));
|
||||
}
|
||||
|
||||
setConfig(CONFIG_UINT32_INTERVAL_CHANGEWEATHER, "ChangeWeatherInterval", 10 * MINUTE * IN_MILLISECONDS);
|
||||
|
||||
if (configNoReload(reload, CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT))
|
||||
{ setConfig(CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT); }
|
||||
{
|
||||
setConfig(CONFIG_UINT32_PORT_WORLD, "WorldServerPort", DEFAULT_WORLDSERVER_PORT);
|
||||
}
|
||||
|
||||
if (configNoReload(reload, CONFIG_UINT32_GAME_TYPE, "GameType", 0))
|
||||
{ setConfig(CONFIG_UINT32_GAME_TYPE, "GameType", 0); }
|
||||
{
|
||||
setConfig(CONFIG_UINT32_GAME_TYPE, "GameType", 0);
|
||||
}
|
||||
|
||||
if (configNoReload(reload, CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT))
|
||||
{ setConfig(CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT); }
|
||||
{
|
||||
setConfig(CONFIG_UINT32_REALM_ZONE, "RealmZone", REALM_ZONE_DEVELOPMENT);
|
||||
}
|
||||
|
||||
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ACCOUNTS, "AllowTwoSide.Accounts", false);
|
||||
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT, "AllowTwoSide.Interaction.Chat", false);
|
||||
@ -559,7 +603,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
setConfigMinMax(CONFIG_UINT32_SKIP_CINEMATICS, "SkipCinematics", 0, 0, 2);
|
||||
|
||||
if (configNoReload(reload, CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL))
|
||||
{ setConfigMinMax(CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL, 1, DEFAULT_MAX_LEVEL); }
|
||||
{
|
||||
setConfigMinMax(CONFIG_UINT32_MAX_PLAYER_LEVEL, "MaxPlayerLevel", DEFAULT_MAX_LEVEL, 1, DEFAULT_MAX_LEVEL);
|
||||
}
|
||||
|
||||
setConfigMinMax(CONFIG_UINT32_START_PLAYER_LEVEL, "StartPlayerLevel", 1, 1, getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
|
||||
|
||||
@ -834,24 +880,34 @@ void World::LoadConfigSettings(bool reload)
|
||||
setConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS, "CharDelete.KeepDays", 30);
|
||||
|
||||
if (configNoReload(reload, CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100))
|
||||
{ setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100); }
|
||||
{
|
||||
setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, "GuidReserveSize.Creature", 100);
|
||||
}
|
||||
if (configNoReload(reload, CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100))
|
||||
{ setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100); }
|
||||
{
|
||||
setConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, "GuidReserveSize.GameObject", 100);
|
||||
}
|
||||
|
||||
///- Read the "Data" directory from the config file
|
||||
std::string dataPath = sConfig.GetStringDefault("DataDir", "./");
|
||||
|
||||
// for empty string use current dir as for absent case
|
||||
if (dataPath.empty())
|
||||
{ dataPath = "./"; }
|
||||
{
|
||||
dataPath = "./";
|
||||
}
|
||||
// normalize dir path to path/ or path\ form
|
||||
else if (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\')
|
||||
{ dataPath.append("/"); }
|
||||
{
|
||||
dataPath.append("/");
|
||||
}
|
||||
|
||||
if (reload)
|
||||
{
|
||||
if (dataPath != m_dataPath)
|
||||
{ sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).", m_dataPath.c_str()); }
|
||||
{
|
||||
sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).", m_dataPath.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -865,7 +921,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
std::string ignoreSpellIds = sConfig.GetStringDefault("vmap.ignoreSpellIds", "");
|
||||
|
||||
if (!enableHeight)
|
||||
{ sLog.outError("VMAP height use disabled! Creatures movements and other things will be in broken state."); }
|
||||
{
|
||||
sLog.outError("VMAP height use disabled! Creatures movements and other things will be in broken state.");
|
||||
}
|
||||
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
|
||||
@ -1343,13 +1401,19 @@ void World::SetInitialWorldSettings()
|
||||
// for AutoBroadcast
|
||||
sLog.outString("Starting AutoBroadcast System");
|
||||
if (m_broadcastEnable)
|
||||
{ LoadBroadcastStrings(); }
|
||||
{
|
||||
LoadBroadcastStrings();
|
||||
}
|
||||
else
|
||||
{ sLog.outString("AutoBroadcast is disabled");}
|
||||
{
|
||||
sLog.outString("AutoBroadcast is disabled");
|
||||
}
|
||||
sLog.outString();
|
||||
|
||||
if (m_broadcastEnable)
|
||||
{ m_broadcastTimer.SetInterval(getConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL) * IN_MILLISECONDS); }
|
||||
{
|
||||
m_broadcastTimer.SetInterval(getConfig(CONFIG_UINT32_AUTOBROADCAST_INTERVAL) * IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
// to set mailtimer to return mails every day between 4 and 5 am
|
||||
// mailtimer is increased when updating auctions
|
||||
@ -1490,17 +1554,25 @@ void World::Update(uint32 diff)
|
||||
for (int i = 0; i < WUPDATE_COUNT; ++i)
|
||||
{
|
||||
if (m_timers[i].GetCurrent() >= 0)
|
||||
{ m_timers[i].Update(diff); }
|
||||
{
|
||||
m_timers[i].Update(diff);
|
||||
}
|
||||
else
|
||||
{ m_timers[i].SetCurrent(0); }
|
||||
{
|
||||
m_timers[i].SetCurrent(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_broadcastEnable)
|
||||
{
|
||||
if (m_broadcastTimer.GetCurrent() >= 0)
|
||||
{ m_broadcastTimer.Update(diff); }
|
||||
{
|
||||
m_broadcastTimer.Update(diff);
|
||||
}
|
||||
else
|
||||
{ m_broadcastTimer.SetCurrent(0); }
|
||||
{
|
||||
m_broadcastTimer.SetCurrent(0);
|
||||
}
|
||||
|
||||
if (m_broadcastTimer.Passed())
|
||||
{
|
||||
@ -1613,7 +1685,9 @@ void World::Update(uint32 diff)
|
||||
m_MaintenanceTimeChecker = 600000; // check 10 minutes
|
||||
}
|
||||
else
|
||||
{ m_MaintenanceTimeChecker -= diff; }
|
||||
{
|
||||
m_MaintenanceTimeChecker -= diff;
|
||||
}
|
||||
|
||||
// And last, but not least handle the issued cli commands
|
||||
ProcessCliCommands();
|
||||
@ -1646,7 +1720,9 @@ namespace MaNGOS
|
||||
do_helper(data_list, &str[0]);
|
||||
}
|
||||
else
|
||||
{ do_helper(data_list, (char*)text); }
|
||||
{
|
||||
do_helper(data_list, (char*)text);
|
||||
}
|
||||
}
|
||||
private:
|
||||
char* lineFromMessage(char*& pos)
|
||||
@ -1686,7 +1762,9 @@ void World::SendWorldText(int32 string_id, ...)
|
||||
{
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld())
|
||||
{ wt_do(player); }
|
||||
{
|
||||
wt_do(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1704,7 +1782,9 @@ void World::SendGlobalMessage(WorldPacket* packet, AccountTypes minSec)
|
||||
continue;
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld())
|
||||
{ session->SendPacket(packet); }
|
||||
{
|
||||
session->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1717,9 +1797,13 @@ void World::SendServerMessage(ServerMessageType type, const char* text /*=""*/,
|
||||
data << text;
|
||||
|
||||
if (player)
|
||||
{ player->GetSession()->SendPacket(&data); }
|
||||
{
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
else
|
||||
{ SendGlobalMessage(&data); }
|
||||
{
|
||||
SendGlobalMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
/// Sends a zone under attack message to all players not in an instance
|
||||
@ -1734,7 +1818,9 @@ void World::SendZoneUnderAttackMessage(uint32 zoneId, Team team)
|
||||
{
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld() && player->GetTeam() == team && !player->GetMap()->Instanceable())
|
||||
{ itr->second->SendPacket(&data); }
|
||||
{
|
||||
itr->second->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1769,7 +1855,9 @@ void World::KickAll()
|
||||
|
||||
// session not removed at kick and will removed in next update tick
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{ itr->second->KickPlayer(); }
|
||||
{
|
||||
itr->second->KickPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
/// Kick (and save) all players with security level less `sec`
|
||||
@ -1779,7 +1867,9 @@ void World::KickAllLess(AccountTypes sec)
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
if (WorldSession* session = itr->second)
|
||||
if (session->GetSecurity() < sec)
|
||||
{ session->KickPlayer(); }
|
||||
{
|
||||
session->KickPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
/// Ban an account or ban an IP address, duration_secs if it is positive used, otherwise permban
|
||||
@ -1815,9 +1905,13 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_
|
||||
if (!resultAccounts)
|
||||
{
|
||||
if (mode == BAN_IP)
|
||||
{ return BAN_SUCCESS; } // ip correctly banned but nobody affected (yet)
|
||||
{
|
||||
return BAN_SUCCESS;
|
||||
} // ip correctly banned but nobody affected (yet)
|
||||
else
|
||||
{ return BAN_NOTFOUND; } // Nobody to ban
|
||||
{
|
||||
return BAN_NOTFOUND;
|
||||
} // Nobody to ban
|
||||
}
|
||||
|
||||
///- Disconnect all affected players (for IP it can be several)
|
||||
@ -1835,9 +1929,10 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_
|
||||
|
||||
if (WorldSession* sess = FindSession(account))
|
||||
if (std::string(sess->GetPlayerName()) != author)
|
||||
{ sess->KickPlayer(); }
|
||||
}
|
||||
while (resultAccounts->NextRow());
|
||||
{
|
||||
sess->KickPlayer();
|
||||
}
|
||||
} while (resultAccounts->NextRow());
|
||||
|
||||
delete resultAccounts;
|
||||
return BAN_SUCCESS;
|
||||
@ -1855,12 +1950,18 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
|
||||
{
|
||||
uint32 account = 0;
|
||||
if (mode == BAN_ACCOUNT)
|
||||
{ account = sAccountMgr.GetId(nameOrIP); }
|
||||
{
|
||||
account = sAccountMgr.GetId(nameOrIP);
|
||||
}
|
||||
else if (mode == BAN_CHARACTER)
|
||||
{ account = sObjectMgr.GetPlayerAccountIdByPlayerName(nameOrIP); }
|
||||
{
|
||||
account = sObjectMgr.GetPlayerAccountIdByPlayerName(nameOrIP);
|
||||
}
|
||||
|
||||
if (!account)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// NO SQL injection as account is uint32
|
||||
LoginDatabase.PExecute("UPDATE account_banned SET active = '0' WHERE id = '%u'", account);
|
||||
@ -1883,9 +1984,13 @@ void World::_UpdateGameTime()
|
||||
if (m_ShutdownTimer <= elapsed)
|
||||
{
|
||||
if (!(m_ShutdownMask & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount() == 0)
|
||||
{ m_stopEvent = true; } // exist code already set
|
||||
{
|
||||
m_stopEvent = true;
|
||||
} // exist code already set
|
||||
else
|
||||
{ m_ShutdownTimer = 1; } // minimum timer value to wait idle state
|
||||
{
|
||||
m_ShutdownTimer = 1;
|
||||
} // minimum timer value to wait idle state
|
||||
}
|
||||
///- ... else decrease it and if necessary display a shutdown countdown to the users
|
||||
else
|
||||
@ -1902,7 +2007,9 @@ void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
|
||||
{
|
||||
// ignore if server shutdown at next tick
|
||||
if (m_stopEvent)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_ShutdownMask = options;
|
||||
m_ExitCode = exitcode;
|
||||
@ -1916,7 +2023,9 @@ void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
|
||||
m_stopEvent = true; // exist code already set
|
||||
}
|
||||
else
|
||||
{ m_ShutdownTimer = 1; } // So that the session count is re-evaluated at next world tick
|
||||
{
|
||||
m_ShutdownTimer = 1;
|
||||
} // So that the session count is re-evaluated at next world tick
|
||||
}
|
||||
///- Else set the shutdown timer and warn users
|
||||
else
|
||||
@ -1940,7 +2049,9 @@ void World::ShutdownMsg(bool show /*= false*/, Player* player /*= NULL*/)
|
||||
{
|
||||
// not show messages for idle shutdown mode
|
||||
if (m_ShutdownMask & SHUTDOWN_MASK_IDLE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
///- Display a message every 12 hours, 1 hour, 5 minutes, 1 minute and 15 seconds
|
||||
if (show ||
|
||||
@ -1964,7 +2075,9 @@ void World::ShutdownCancel()
|
||||
{
|
||||
// nothing cancel or too later
|
||||
if (!m_ShutdownTimer || m_stopEvent)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
|
||||
|
||||
@ -1986,7 +2099,9 @@ void World::UpdateSessions(uint32 /*diff*/)
|
||||
///- Add new sessions
|
||||
WorldSession* sess;
|
||||
while (addSessQueue.next(sess))
|
||||
{ AddSession_(sess); }
|
||||
{
|
||||
AddSession_(sess);
|
||||
}
|
||||
|
||||
///- Then send an update signal to remaining ones
|
||||
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
|
||||
@ -2012,7 +2127,9 @@ void World::ServerMaintenanceStart()
|
||||
m_NextMaintenanceDate = LastWeekEnd + 7; // next maintenance begin
|
||||
|
||||
if (m_NextMaintenanceDate <= GetDateToday()) // avoid loop in manually case, maybe useless
|
||||
{ m_NextMaintenanceDate += 7; }
|
||||
{
|
||||
m_NextMaintenanceDate += 7;
|
||||
}
|
||||
|
||||
// flushing rank points list ( standing must be reloaded after server maintenance )
|
||||
sObjectMgr.FlushRankPoints(LastWeekEnd);
|
||||
@ -2020,7 +2137,9 @@ void World::ServerMaintenanceStart()
|
||||
// save and update all online players
|
||||
for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
if (itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
|
||||
{ itr->second->GetPlayer()->SaveToDB(); }
|
||||
{
|
||||
itr->second->GetPlayer()->SaveToDB();
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE saved_variables SET NextMaintenanceDate = '" UI64FMTD "'", uint64(m_NextMaintenanceDate));
|
||||
}
|
||||
@ -2042,7 +2161,9 @@ void World::InitServerMaintenanceCheck()
|
||||
}
|
||||
|
||||
if (m_NextMaintenanceDate <= GetDateToday())
|
||||
{ ServerMaintenanceStart(); }
|
||||
{
|
||||
ServerMaintenanceStart();
|
||||
}
|
||||
|
||||
DEBUG_LOG("Server maintenance check initialized.");
|
||||
}
|
||||
@ -2060,7 +2181,9 @@ void World::ProcessCliCommands()
|
||||
handler.ParseCommands(command->m_command);
|
||||
|
||||
if (command->m_commandFinished)
|
||||
{ command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage()); }
|
||||
{
|
||||
command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
|
||||
}
|
||||
|
||||
delete command;
|
||||
}
|
||||
@ -2102,7 +2225,9 @@ void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId
|
||||
void World::SetPlayerLimit(int32 limit, bool needUpdate)
|
||||
{
|
||||
if (limit < -SEC_ADMINISTRATOR)
|
||||
{ limit = -SEC_ADMINISTRATOR; }
|
||||
{
|
||||
limit = -SEC_ADMINISTRATOR;
|
||||
}
|
||||
|
||||
// lock update need
|
||||
bool db_update_need = needUpdate || (limit < 0) != (m_playerLimit < 0) || (limit < 0 && m_playerLimit < 0 && limit != m_playerLimit);
|
||||
@ -2140,7 +2265,9 @@ void World::LoadDBVersion()
|
||||
}
|
||||
|
||||
if (m_DBVersion.empty())
|
||||
{ m_DBVersion = "Unknown world database."; }
|
||||
{
|
||||
m_DBVersion = "Unknown world database.";
|
||||
}
|
||||
}
|
||||
|
||||
void World::setConfig(eConfigUInt32Values index, char const* fieldname, uint32 defvalue)
|
||||
@ -2256,11 +2383,15 @@ void World::setConfigMinMax(eConfigFloatValues index, char const* fieldname, flo
|
||||
bool World::configNoReload(bool reload, eConfigUInt32Values index, char const* fieldname, uint32 defvalue)
|
||||
{
|
||||
if (!reload)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 val = sConfig.GetIntDefault(fieldname, defvalue);
|
||||
if (val != getConfig(index))
|
||||
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%u).", fieldname, getConfig(index)); }
|
||||
{
|
||||
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%u).", fieldname, getConfig(index));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2268,11 +2399,15 @@ bool World::configNoReload(bool reload, eConfigUInt32Values index, char const* f
|
||||
bool World::configNoReload(bool reload, eConfigInt32Values index, char const* fieldname, int32 defvalue)
|
||||
{
|
||||
if (!reload)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int32 val = sConfig.GetIntDefault(fieldname, defvalue);
|
||||
if (val != getConfig(index))
|
||||
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%i).", fieldname, getConfig(index)); }
|
||||
{
|
||||
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%i).", fieldname, getConfig(index));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2280,11 +2415,15 @@ bool World::configNoReload(bool reload, eConfigInt32Values index, char const* fi
|
||||
bool World::configNoReload(bool reload, eConfigFloatValues index, char const* fieldname, float defvalue)
|
||||
{
|
||||
if (!reload)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
float val = sConfig.GetFloatDefault(fieldname, defvalue);
|
||||
if (val != getConfig(index))
|
||||
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%f).", fieldname, getConfig(index)); }
|
||||
{
|
||||
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%f).", fieldname, getConfig(index));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2292,11 +2431,15 @@ bool World::configNoReload(bool reload, eConfigFloatValues index, char const* fi
|
||||
bool World::configNoReload(bool reload, eConfigBoolValues index, char const* fieldname, bool defvalue)
|
||||
{
|
||||
if (!reload)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool val = sConfig.GetBoolDefault(fieldname, defvalue);
|
||||
if (val != getConfig(index))
|
||||
{ sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%s).", fieldname, getConfig(index) ? "'true'" : "'false'"); }
|
||||
{
|
||||
sLog.outError("%s option can't be changed at mangosd.conf reload, using current value (%s).", fieldname, getConfig(index) ? "'true'" : "'false'");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -2345,8 +2488,7 @@ void World::LoadBroadcastStrings()
|
||||
bs.text = fields[1].GetString();
|
||||
bs.freq = m_broadcastWeight;
|
||||
m_broadcastList.push_back(bs);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
if (m_broadcastWeight == 0)
|
||||
|
@ -421,13 +421,19 @@ void Log::outString(const char* str, ...)
|
||||
void Log::outError(const char* err, ...)
|
||||
{
|
||||
if (!err)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_colored)
|
||||
{ SetColor(false, m_colors[LogError]); }
|
||||
{
|
||||
SetColor(false, m_colors[LogError]);
|
||||
}
|
||||
|
||||
if (m_includeTime)
|
||||
{ outTime(); }
|
||||
{
|
||||
outTime();
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
|
||||
@ -436,7 +442,9 @@ void Log::outError(const char* err, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (m_colored)
|
||||
{ ResetColor(false); }
|
||||
{
|
||||
ResetColor(false);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
if (logfile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user