mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
refactoring of session update loop in zone
This commit is contained in:
parent
b95d741cd8
commit
e8ab570502
2 changed files with 18 additions and 12 deletions
|
@ -481,8 +481,18 @@ bool Core::Zone::update( uint32_t currTime )
|
||||||
{
|
{
|
||||||
int64_t tickCount = Util::getTimeMs();
|
int64_t tickCount = Util::getTimeMs();
|
||||||
|
|
||||||
|
//TODO: this should be moved to a updateWeather call and pulled out of updateSessions
|
||||||
bool changedWeather = checkWeather();
|
bool changedWeather = checkWeather();
|
||||||
|
|
||||||
|
updateSessions( changedWeather );
|
||||||
|
updateBnpcs( tickCount );
|
||||||
|
onUpdate( currTime );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Zone::updateSessions( bool changedWeather )
|
||||||
|
{
|
||||||
auto it = m_sessionSet.begin();
|
auto it = m_sessionSet.begin();
|
||||||
|
|
||||||
// update sessions in this zone
|
// update sessions in this zone
|
||||||
|
@ -498,8 +508,8 @@ bool Core::Zone::update( uint32_t currTime )
|
||||||
}
|
}
|
||||||
|
|
||||||
// this session is not linked to this area anymore, remove it from zone session list
|
// this session is not linked to this area anymore, remove it from zone session list
|
||||||
if( ( !pSession->getPlayer()->getCurrentZone() )
|
if( ( !pSession->getPlayer()->getCurrentZone() ) ||
|
||||||
|| ( pSession->getPlayer()->getCurrentZone() != shared_from_this() ) )
|
( pSession->getPlayer()->getCurrentZone() != shared_from_this() ) )
|
||||||
{
|
{
|
||||||
if( pSession->getPlayer()->getCell() )
|
if( pSession->getPlayer()->getCell() )
|
||||||
removeActor(pSession->getPlayer() );
|
removeActor(pSession->getPlayer() );
|
||||||
|
@ -510,7 +520,7 @@ bool Core::Zone::update( uint32_t currTime )
|
||||||
|
|
||||||
if( changedWeather )
|
if( changedWeather )
|
||||||
{
|
{
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcWeatherChange >
|
Core::Network::Packets::ZoneChannelPacket< Core::Network::Packets::Server::FFXIVIpcWeatherChange >
|
||||||
weatherChangePacket( pSession->getPlayer()->getId() );
|
weatherChangePacket( pSession->getPlayer()->getId() );
|
||||||
weatherChangePacket.data().weatherId = m_currentWeather;
|
weatherChangePacket.data().weatherId = m_currentWeather;
|
||||||
weatherChangePacket.data().delay = 5.0f;
|
weatherChangePacket.data().delay = 5.0f;
|
||||||
|
@ -521,12 +531,6 @@ bool Core::Zone::update( uint32_t currTime )
|
||||||
pSession->update();
|
pSession->update();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBnpcs( tickCount );
|
|
||||||
|
|
||||||
onUpdate( currTime );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::Zone::isCellActive( uint32_t x, uint32_t y )
|
bool Core::Zone::isCellActive( uint32_t x, uint32_t y )
|
||||||
|
|
|
@ -111,6 +111,8 @@ public:
|
||||||
|
|
||||||
bool update( uint32_t currTime );
|
bool update( uint32_t currTime );
|
||||||
|
|
||||||
|
void updateSessions( bool changedWeather );
|
||||||
|
|
||||||
void registerInstanceObj( Entity::InstanceObjectPtr object );
|
void registerInstanceObj( Entity::InstanceObjectPtr object );
|
||||||
Entity::InstanceObjectPtr getInstanceObject( uint32_t objId );
|
Entity::InstanceObjectPtr getInstanceObject( uint32_t objId );
|
||||||
void updateInstanceObj( Entity::InstanceObjectPtr object );
|
void updateInstanceObj( Entity::InstanceObjectPtr object );
|
||||||
|
|
Loading…
Add table
Reference in a new issue