Fixed a few obsoleted functions
git-svn-id: http://mc-server.googlecode.com/svn/trunk@397 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
f90a8928e7
commit
219be8186c
@ -58,7 +58,6 @@
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cmath>
|
||||
#pragma warning(disable:4996;disable:4800)
|
||||
|
||||
class MTRand {
|
||||
// Data
|
||||
|
@ -306,7 +306,7 @@ void cClientHandle::Authenticate(void)
|
||||
LoginResponse.m_MapSeed = cRoot::Get()->GetWorld()->GetWorldSeed();
|
||||
#endif
|
||||
LoginResponse.m_Dimension = 0;
|
||||
LoginResponse.m_MaxPlayers = (unsigned char)cRoot::Get()->GetWorld()->GetMaxPlayers();
|
||||
LoginResponse.m_MaxPlayers = (unsigned char)cRoot::Get()->GetDefaultWorld()->GetMaxPlayers();
|
||||
LoginResponse.m_Difficulty = 2;
|
||||
Send(LoginResponse);
|
||||
|
||||
@ -627,11 +627,11 @@ void cClientHandle::HandlePing(void)
|
||||
// Somebody tries to retrieve information about the server
|
||||
AString Reply;
|
||||
Printf(Reply, "%s%s%i%s%i",
|
||||
cRoot::Get()->GetWorld()->GetDescription().c_str(),
|
||||
cRoot::Get()->GetDefaultWorld()->GetDescription().c_str(),
|
||||
cChatColor::Delimiter.c_str(),
|
||||
cRoot::Get()->GetWorld()->GetNumPlayers(),
|
||||
cRoot::Get()->GetDefaultWorld()->GetNumPlayers(),
|
||||
cChatColor::Delimiter.c_str(),
|
||||
cRoot::Get()->GetWorld()->GetMaxPlayers()
|
||||
cRoot::Get()->GetDefaultWorld()->GetMaxPlayers()
|
||||
);
|
||||
Kick(Reply.c_str());
|
||||
}
|
||||
@ -656,7 +656,7 @@ void cClientHandle::HandleHandshake(cPacket_Handshake * a_Packet)
|
||||
|
||||
LOG("HANDSHAKE %s", m_Username.c_str());
|
||||
|
||||
if (cRoot::Get()->GetWorld()->GetNumPlayers() >= cRoot::Get()->GetWorld()->GetMaxPlayers())
|
||||
if (cRoot::Get()->GetDefaultWorld()->GetNumPlayers() >= cRoot::Get()->GetDefaultWorld()->GetMaxPlayers())
|
||||
{
|
||||
Kick("The server is currently full :(-- Try again later");
|
||||
return;
|
||||
@ -1647,8 +1647,10 @@ void cClientHandle::HandleKeepAlive(cPacket_KeepAlive * a_Packet)
|
||||
|
||||
bool cClientHandle::CheckBlockInteractionsRate(void)
|
||||
{
|
||||
ASSERT(m_Player != NULL);
|
||||
ASSERT(m_Player->GetWorld() != NULL);
|
||||
int LastActionCnt = m_Player->GetLastBlockActionCnt();
|
||||
if ((cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime()) < 0.1)
|
||||
if ((m_Player->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime()) < 0.1)
|
||||
{
|
||||
// Limit the number of block interactions per tick
|
||||
m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time.
|
||||
|
@ -506,7 +506,7 @@ cPlayer * cMonster::FindClosestPlayer(void)
|
||||
|
||||
void cMonster::GetMonsterConfig(const char* pm_name)
|
||||
{
|
||||
cRoot::Get()->GetMonsterConfig()->Get()->AssignAttributes(this, pm_name);
|
||||
cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, pm_name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,11 +112,3 @@ void cMonsterConfig::AssignAttributes(cMonster *m, const char* n)
|
||||
|
||||
|
||||
|
||||
// _X: WTF?
|
||||
cMonsterConfig *cMonsterConfig::Get() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,9 +7,6 @@ public:
|
||||
cMonsterConfig(void);
|
||||
~cMonsterConfig();
|
||||
|
||||
// _X: WTF? shouldn't this be static? Setting to OBSOLETE
|
||||
OBSOLETE cMonsterConfig *Get();
|
||||
|
||||
void AssignAttributes(cMonster *m, const char* n);
|
||||
|
||||
private:
|
||||
|
@ -463,7 +463,10 @@ void cPlayer::CloseWindow(char a_WindowType)
|
||||
|
||||
void cPlayer::SetLastBlockActionTime()
|
||||
{
|
||||
m_LastBlockActionTime = cRoot::Get()->GetWorld()->GetTime();
|
||||
if (m_World != NULL)
|
||||
{
|
||||
m_LastBlockActionTime = m_World->GetTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,3 +364,31 @@ int cRoot::GetTotalChunkCount(void)
|
||||
|
||||
|
||||
|
||||
|
||||
void cRoot::SaveAllChunks(void)
|
||||
{
|
||||
for (WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr)
|
||||
{
|
||||
itr->second->SaveAllChunks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback)
|
||||
{
|
||||
for (WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr)
|
||||
{
|
||||
if (!itr->second->ForEachPlayer(a_Callback))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,6 +19,8 @@ class cWebAdmin;
|
||||
class cPluginManager;
|
||||
class cServer;
|
||||
class cWorld;
|
||||
class cPlayer;
|
||||
typedef cItemCallback<cPlayer> cPlayerListCallback;
|
||||
|
||||
|
||||
|
||||
@ -56,6 +58,12 @@ public:
|
||||
|
||||
int GetTotalChunkCount(void); // tolua_export
|
||||
|
||||
/// Saves all chunks in all worlds
|
||||
void SaveAllChunks(void);
|
||||
|
||||
/// Calls the callback for each player in all worlds
|
||||
bool ForEachPlayer(cPlayerListCallback & a_Callback);
|
||||
|
||||
private:
|
||||
void LoadGlobalSettings();
|
||||
|
||||
|
@ -520,7 +520,7 @@ void cServer::ServerCommand( const char * a_Cmd )
|
||||
}
|
||||
if( split[0].compare( "save-all" ) == 0 )
|
||||
{
|
||||
cRoot::Get()->GetWorld()->SaveAllChunks(); // TODO - Force ALL worlds to save their chunks
|
||||
cRoot::Get()->SaveAllChunks(); // TODO - Force ALL worlds to save their chunks
|
||||
return;
|
||||
}
|
||||
if (split[0].compare("unload") == 0)
|
||||
@ -540,7 +540,7 @@ void cServer::ServerCommand( const char * a_Cmd )
|
||||
return false;
|
||||
}
|
||||
} Logger;
|
||||
cRoot::Get()->GetWorld()->ForEachPlayer(Logger);
|
||||
cRoot::Get()->ForEachPlayer(Logger);
|
||||
return;
|
||||
}
|
||||
if( split[0].compare( "numchunks" ) == 0 )
|
||||
@ -596,7 +596,7 @@ void cServer::Shutdown()
|
||||
m_bRestarting = true;
|
||||
m_pState->RestartEvent.Wait();
|
||||
|
||||
cRoot::Get()->GetWorld()->SaveAllChunks();
|
||||
cRoot::Get()->SaveAllChunks();
|
||||
|
||||
cCSLock Lock(m_CSClients);
|
||||
for( ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr )
|
||||
|
@ -213,7 +213,7 @@ void cWebAdmin::Request_Handler(webserver::http_request* r)
|
||||
Content += "<h4>Players:</h4><ul>";
|
||||
|
||||
cPlayerAccum PlayerAccum;
|
||||
cWorld * World = cRoot::Get()->GetWorld(); // TODO - Create a list of worlds and players
|
||||
cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
|
||||
World->ForEachPlayer(PlayerAccum);
|
||||
Content.append(PlayerAccum.m_Contents);
|
||||
Content += "</ul><br>";
|
||||
|
@ -132,8 +132,8 @@ protected:
|
||||
|
||||
cWorld* cWorld::GetWorld()
|
||||
{
|
||||
LOGWARN("WARNING: Using deprecated function cWorld::GetWorld() use cRoot::Get()->GetWorld() instead!");
|
||||
return cRoot::Get()->GetWorld();
|
||||
LOGWARN("WARNING: Using deprecated function cWorld::GetWorld() use cRoot::Get()->GetDefaultWorld() instead!");
|
||||
return cRoot::Get()->GetDefaultWorld();
|
||||
}
|
||||
|
||||
|
||||
@ -296,8 +296,13 @@ cWorld::cWorld( const AString & a_WorldName )
|
||||
g_BlockTransparent[ E_BLOCK_TORCH ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_SIGN_POST ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_WALLSIGN ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_TALL_GRASS ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_YELLOW_FLOWER ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_RED_ROSE ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_RED_MUSHROOM ] = true;
|
||||
g_BlockTransparent[ E_BLOCK_BROWN_MUSHROOM ] = true;
|
||||
|
||||
// TODO: Also set flowers, mushrooms etc as transparent
|
||||
// TODO: Any other transparent blocks?
|
||||
|
||||
// One hit break blocks
|
||||
g_BlockOneHitDig[ E_BLOCK_SAPLING ] = true;
|
||||
|
@ -48,7 +48,7 @@ class cWorld //tolua_export
|
||||
{ //tolua_export
|
||||
public:
|
||||
|
||||
static cWorld* GetWorld(); //tolua_export
|
||||
OBSOLETE static cWorld* GetWorld(); //tolua_export
|
||||
|
||||
// Return time in seconds
|
||||
inline static float GetTime() //tolua_export
|
||||
|
Loading…
Reference in New Issue
Block a user