From facba12feda2cc2eb892fbb7bae98d8f0d059c82 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 2 Mar 2018 11:39:52 +1100 Subject: [PATCH 1/2] fix stupid return type mistake --- src/common/Util/SpawnIndexAllocator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Util/SpawnIndexAllocator.h b/src/common/Util/SpawnIndexAllocator.h index 85875a67..65cc826e 100644 --- a/src/common/Util/SpawnIndexAllocator.h +++ b/src/common/Util/SpawnIndexAllocator.h @@ -34,8 +34,6 @@ namespace Util T freeUsedSpawnIndex( ActorIdType actorId ) { - assert( m_maxSlotId != 0 ); - auto it = m_actorIdToAllocatedMap.find( actorId ); if( it == m_actorIdToAllocatedMap.end() ) return 0; @@ -47,7 +45,7 @@ namespace Util return index; } - bool getNextFreeSpawnIndex( ActorIdType actorId ) + T getNextFreeSpawnIndex( ActorIdType actorId ) { assert( m_maxSlotId != 0 ); @@ -82,6 +80,8 @@ namespace Util protected: void setupQueue() { + assert( m_maxSlotId != 0 ); + while( !m_availableIds.empty() ) m_availableIds.pop(); From 9a0041e093fbd8f15c37caf0e498926ff75359f3 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 2 Mar 2018 15:29:48 +1100 Subject: [PATCH 2/2] set weatheroverride debug command and assert fix in spawnindexallocator --- src/common/Util/SpawnIndexAllocator.h | 4 ++-- .../sapphire_zone/DebugCommand/DebugCommandHandler.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/common/Util/SpawnIndexAllocator.h b/src/common/Util/SpawnIndexAllocator.h index 65cc826e..732f652c 100644 --- a/src/common/Util/SpawnIndexAllocator.h +++ b/src/common/Util/SpawnIndexAllocator.h @@ -24,11 +24,11 @@ namespace Util void init( T maxSlotId, bool reserveFirstSlot = false ) { - setupQueue(); - m_maxSlotId = maxSlotId; m_reserveFirstSlot = reserveFirstSlot; + setupQueue(); + // todo: reserve max slot id in map to prevent any runtime reshashing } diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp index 35e711cd..9a68f69b 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp @@ -304,6 +304,14 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: player.sendDebug( "MSQ Guide updated " ); } + else if( subCommand == "weatheroverride" || subCommand == "wo" ) + { + uint32_t weatherId; + + sscanf( params.c_str(), "%d", &weatherId ); + + player.getCurrentZone()->setWeatherOverride( static_cast< Common::Weather >( weatherId ) ); + } else { player.sendUrgent( subCommand + " is not a valid SET command." ); @@ -569,7 +577,7 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, boos void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command ) { - player.sendDebug( "SapphireServer " + Version::VERSION + "\nRev: " + Version::GIT_HASH ); + player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH ); player.sendDebug( "Compiled: " __DATE__ " " __TIME__ ); player.sendDebug( "Sessions: " + std::to_string( g_serverZone.getSessionCount() ) ); }