1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 00:47:45 +00:00

fix some warnings & world shouldn't crash when warming up object cache

This commit is contained in:
NotAdam 2020-01-11 18:20:06 +11:00
parent 2cf93ce861
commit a70f381e68
4 changed files with 12 additions and 13 deletions

View file

@ -38,7 +38,7 @@ private:
public:
ChasingShadows() : Sapphire::ScriptAPI::QuestBattleScript( 11 ) {}
void onPlayerSetup( Sapphire::QuestBattle& instance, Entity::Player& player )
void onPlayerSetup( Sapphire::QuestBattle& instance, Entity::Player& player ) override
{
player.setRot( 3.f );
player.setPos( { 323.f, -1.28f, -320.f } );

View file

@ -72,7 +72,7 @@ class SubFst034 : public Sapphire::ScriptAPI::EventScript
}
void onBNpcKill( uint32_t npcId, Entity::Player& player )
void onBNpcKill( uint32_t npcId, Entity::Player& player ) override
{
switch( npcId )
{

View file

@ -80,18 +80,18 @@ Sapphire::InstanceObjectCache::InstanceObjectCache( std::shared_ptr< Framework >
{
if( pEntry->getType() == LgbEntryType::MapRange )
{
auto pMapRange = reinterpret_cast< LGB_MAP_RANGE_ENTRY* >( pEntry.get() );
m_mapRangeCache.insert( id, *pMapRange );
auto pMapRange = std::reinterpret_pointer_cast< LGB_MAP_RANGE_ENTRY >( pEntry );
m_mapRangeCache.insert( id, pMapRange );
}
else if( pEntry->getType() == LgbEntryType::ExitRange )
{
auto pExitRange = reinterpret_cast< LGB_EXIT_RANGE_ENTRY* >( pEntry.get() );
m_exitRangeCache.insert( id, *pExitRange);
auto pExitRange = std::reinterpret_pointer_cast< LGB_EXIT_RANGE_ENTRY >( pEntry );
m_exitRangeCache.insert( id, pExitRange );
}
else if( pEntry->getType() == LgbEntryType::PopRange )
{
auto pPopRange = reinterpret_cast< LGB_POP_RANGE_ENTRY* >( pEntry.get() );
m_popRangeCache.insert( id, *pPopRange );
auto pPopRange = std::reinterpret_pointer_cast< LGB_POP_RANGE_ENTRY >( pEntry );
m_popRangeCache.insert( id, pPopRange );
}
}
}

View file

@ -38,19 +38,18 @@ namespace Sapphire
return nullptr;
}
void insert( uint16_t zoneId, T& entry )
void insert( uint16_t zoneId, std::shared_ptr< T > entry )
{
auto pShared = std::make_shared< T >( entry );
if( m_objectCache.find( zoneId ) == m_objectCache.end() )
{
ObjectMap cache;
cache[ entry.header.instanceId ] = pShared;
cache[ entry->header.instanceId ] = std::move( entry );
m_objectCache[ zoneId ] = cache;
}
else
{
auto it = m_objectCache.find( zoneId );
it->second[ entry.header.instanceId ] = pShared;
it->second[ entry->header.instanceId ] = std::move( entry );
}
}
@ -67,7 +66,7 @@ namespace Sapphire
using ExitRangePtr = std::shared_ptr< LGB_EXIT_RANGE_ENTRY >;
using PopRangePtr = std::shared_ptr< LGB_POP_RANGE_ENTRY >;
InstanceObjectCache( std::shared_ptr< Framework > pFramework );
explicit InstanceObjectCache( std::shared_ptr< Framework > pFramework );
~InstanceObjectCache() = default;
MapRangePtr getMapRange( uint16_t zoneId, uint32_t mapRangeId );