1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 21:57:44 +00:00

Merge pull request #260 from GokuWeedLord/actor_rewrite

fix return for nextFreeSpawnIndex
This commit is contained in:
Mordred 2018-03-02 06:10:44 +01:00 committed by GitHub
commit a164e7d3ce
2 changed files with 14 additions and 6 deletions

View file

@ -24,18 +24,16 @@ 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
}
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();

View file

@ -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() ) );
}