New server command "unload" to manually unload unused chunks
git-svn-id: http://mc-server.googlecode.com/svn/trunk@280 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
2928cb6853
commit
eefe71f593
@ -436,6 +436,7 @@ void cServer::ServerCommand( const char * a_Cmd )
|
||||
printf("help - Shows this message\n");
|
||||
printf("save-all - Saves all loaded chunks to disk\n");
|
||||
printf("list - Lists all players currently in server\n");
|
||||
printf("unload - Unloads all unused chunks\n");
|
||||
printf("numchunks - Shows number of chunks currently loaded\n");
|
||||
printf("say - Sends a chat message to all players\n");
|
||||
printf("restart - Kicks all clients, and saves everything\n");
|
||||
@ -453,6 +454,13 @@ void cServer::ServerCommand( const char * a_Cmd )
|
||||
cRoot::Get()->GetWorld()->SaveAllChunks(); // TODO - Force ALL worlds to save their chunks
|
||||
return;
|
||||
}
|
||||
if (split[0].compare("unload") == 0)
|
||||
{
|
||||
LOG("Num loaded chunks before: %i", cRoot::Get()->GetTotalChunkCount() );
|
||||
cRoot::Get()->GetDefaultWorld()->UnloadUnusedChunks(); // TODO: Iterate through ALL worlds
|
||||
LOG("Num loaded chunks after: %i", cRoot::Get()->GetTotalChunkCount() );
|
||||
return;
|
||||
}
|
||||
if( split[0].compare( "list" ) == 0 )
|
||||
{
|
||||
class cPlayerLogger : public cPlayerListCallback
|
||||
@ -468,7 +476,7 @@ void cServer::ServerCommand( const char * a_Cmd )
|
||||
}
|
||||
if( split[0].compare( "numchunks" ) == 0 )
|
||||
{
|
||||
printf("Num loaded chunks: %i\n", cRoot::Get()->GetTotalChunkCount() );
|
||||
LOG("Num loaded chunks: %i\n", cRoot::Get()->GetTotalChunkCount() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
void GetChunkData (int a_ChunkX, int a_ChunkY, int a_ChunkZ, cChunkDataCallback * a_Callback);
|
||||
bool IsChunkValid (int a_ChunkX, int a_ChunkY, int a_ChunkZ) const;
|
||||
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkY, int a_ChunkZ) const;
|
||||
void UnloadUnusedChunks(void);
|
||||
|
||||
// MOTD
|
||||
const AString & GetDescription(void) const {return m_Description; }
|
||||
@ -262,7 +263,6 @@ private:
|
||||
void TickSpawnMobs(float a_Dt); // Handles mob spawning each tick
|
||||
|
||||
void RemoveEntity( cEntity * a_Entity );
|
||||
void UnloadUnusedChunks();
|
||||
}; //tolua_export
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user