1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00

log a warning to world log/player in the event an actor wasn't spawned

This commit is contained in:
NotAdam 2019-01-28 21:02:51 +11:00
parent ebec29563f
commit 2478b0b264

View file

@ -534,7 +534,20 @@ void Sapphire::Entity::Player::initSpawnIdQueue()
uint8_t Sapphire::Entity::Player::getSpawnIdForActorId( uint32_t actorId )
{
return m_actorSpawnIndexAllocator.getNextFreeSpawnIndex( actorId );
auto index = m_actorSpawnIndexAllocator.getNextFreeSpawnIndex( actorId );
if( index == m_actorSpawnIndexAllocator.getAllocFailId() )
{
Logger::warn( "Failed to spawn Chara#{0} for Player#{1} - no remaining spawn indexes available. "
"Consider lowering InRangeDistance in world config.",
actorId, getId() );
sendUrgent( "Failed to spawn Chara#{0} for you - no remaining spawn slots. See world log.", actorId );
return index;
}
return index;
}
bool Sapphire::Entity::Player::isActorSpawnIdValid( uint8_t spawnIndex )
@ -1835,7 +1848,20 @@ void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId, FrameworkPtr
uint8_t Sapphire::Entity::Player::getNextObjSpawnIndexForActorId( uint32_t actorId )
{
return m_objSpawnIndexAllocator.getNextFreeSpawnIndex( actorId );
auto index = m_objSpawnIndexAllocator.getNextFreeSpawnIndex( actorId );
if( index == m_objSpawnIndexAllocator.getAllocFailId() )
{
Logger::warn( "Failed to spawn EObj#{0} for Player#{1} - no remaining spawn indexes available. "
"Consider lowering InRangeDistance in world config.",
actorId, getId() );
sendUrgent( "Failed to spawn EObj#{0} for you - no remaining spawn slots. See world log.", actorId );
return index;
}
return index;
}
void Sapphire::Entity::Player::resetObjSpawnIndex()