Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.master
parent
6f4d6cb574
commit
6f2d785d0f
|
@ -79,7 +79,7 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
|
||||||
|
|
||||||
m_camera_mode(CAMERA_MODE_FIRST)
|
m_camera_mode(CAMERA_MODE_FIRST)
|
||||||
{
|
{
|
||||||
//dstream<<__FUNCTION_NAME<<std::endl;
|
//dstream<<FUNCTION_NAME<<std::endl;
|
||||||
|
|
||||||
// note: making the camera node a child of the player node
|
// note: making the camera node a child of the player node
|
||||||
// would lead to unexpected behaviour, so we don't do that.
|
// would lead to unexpected behaviour, so we don't do that.
|
||||||
|
@ -494,7 +494,7 @@ void Camera::updateViewingRange(f32 frametime_in, f32 busytime_in)
|
||||||
return;
|
return;
|
||||||
m_frametime_counter = 0.2; // Same as ClientMap::updateDrawList interval
|
m_frametime_counter = 0.2; // Same as ClientMap::updateDrawList interval
|
||||||
|
|
||||||
/*dstream<<__FUNCTION_NAME
|
/*dstream<<FUNCTION_NAME
|
||||||
<<": Collected "<<m_added_frames<<" frames, total of "
|
<<": Collected "<<m_added_frames<<" frames, total of "
|
||||||
<<m_added_busytime<<"s."<<std::endl;
|
<<m_added_busytime<<"s."<<std::endl;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ MeshUpdateQueue::~MeshUpdateQueue()
|
||||||
*/
|
*/
|
||||||
void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent)
|
void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
assert(data); // pre-condition
|
assert(data); // pre-condition
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ void Client::connect(Address address,
|
||||||
const std::string &address_name,
|
const std::string &address_name,
|
||||||
bool is_local_server)
|
bool is_local_server)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
initLocalMapSaving(address, address_name, is_local_server);
|
initLocalMapSaving(address, address_name, is_local_server);
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void Client::connect(Address address,
|
||||||
|
|
||||||
void Client::step(float dtime)
|
void Client::step(float dtime)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
// Limit a bit
|
// Limit a bit
|
||||||
if(dtime > 2.0)
|
if(dtime > 2.0)
|
||||||
|
@ -824,7 +824,7 @@ void Client::initLocalMapSaving(const Address &address,
|
||||||
|
|
||||||
void Client::ReceiveAll()
|
void Client::ReceiveAll()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
u32 start_ms = porting::getTimeMs();
|
u32 start_ms = porting::getTimeMs();
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -850,7 +850,7 @@ void Client::ReceiveAll()
|
||||||
|
|
||||||
void Client::Receive()
|
void Client::Receive()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
NetworkPacket pkt;
|
NetworkPacket pkt;
|
||||||
m_con.Receive(&pkt);
|
m_con.Receive(&pkt);
|
||||||
ProcessData(&pkt);
|
ProcessData(&pkt);
|
||||||
|
@ -867,7 +867,7 @@ inline void Client::handleCommand(NetworkPacket* pkt)
|
||||||
*/
|
*/
|
||||||
void Client::ProcessData(NetworkPacket *pkt)
|
void Client::ProcessData(NetworkPacket *pkt)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
ToClientCommand command = (ToClientCommand) pkt->getCommand();
|
ToClientCommand command = (ToClientCommand) pkt->getCommand();
|
||||||
u32 sender_peer_id = pkt->getPeerId();
|
u32 sender_peer_id = pkt->getPeerId();
|
||||||
|
@ -1213,7 +1213,7 @@ void Client::sendChangePassword(const std::string &oldpassword,
|
||||||
|
|
||||||
void Client::sendDamage(u8 damage)
|
void Client::sendDamage(u8 damage)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
|
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
|
||||||
pkt << damage;
|
pkt << damage;
|
||||||
|
@ -1222,7 +1222,7 @@ void Client::sendDamage(u8 damage)
|
||||||
|
|
||||||
void Client::sendBreath(u16 breath)
|
void Client::sendBreath(u16 breath)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOSERVER_BREATH, sizeof(u16));
|
NetworkPacket pkt(TOSERVER_BREATH, sizeof(u16));
|
||||||
pkt << breath;
|
pkt << breath;
|
||||||
|
@ -1231,7 +1231,7 @@ void Client::sendBreath(u16 breath)
|
||||||
|
|
||||||
void Client::sendRespawn()
|
void Client::sendRespawn()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOSERVER_RESPAWN, 0);
|
NetworkPacket pkt(TOSERVER_RESPAWN, 0);
|
||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
|
@ -1239,7 +1239,7 @@ void Client::sendRespawn()
|
||||||
|
|
||||||
void Client::sendReady()
|
void Client::sendReady()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOSERVER_CLIENT_READY,
|
NetworkPacket pkt(TOSERVER_CLIENT_READY,
|
||||||
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
|
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
|
||||||
|
|
|
@ -67,7 +67,7 @@ void RemoteClient::GetNextBlocks (
|
||||||
float dtime,
|
float dtime,
|
||||||
std::vector<PrioritySortedBlockTransfer> &dest)
|
std::vector<PrioritySortedBlockTransfer> &dest)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
|
|
||||||
// Increment timers
|
// Increment timers
|
||||||
|
|
|
@ -81,7 +81,7 @@ ClientMap::~ClientMap()
|
||||||
|
|
||||||
MapSector * ClientMap::emergeSector(v2s16 p2d)
|
MapSector * ClientMap::emergeSector(v2s16 p2d)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
// Check that it doesn't exist already
|
// Check that it doesn't exist already
|
||||||
try{
|
try{
|
||||||
return getSectorNoGenerate(p2d);
|
return getSectorNoGenerate(p2d);
|
||||||
|
@ -400,7 +400,7 @@ struct MeshBufListList
|
||||||
|
|
||||||
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
|
bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ void ItemCAO::updateTexture()
|
||||||
}
|
}
|
||||||
catch(SerializationError &e)
|
catch(SerializationError &e)
|
||||||
{
|
{
|
||||||
warningstream<<__FUNCTION_NAME
|
warningstream<<FUNCTION_NAME
|
||||||
<<": error deSerializing itemstring \""
|
<<": error deSerializing itemstring \""
|
||||||
<<m_itemstring<<std::endl;
|
<<m_itemstring<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,9 +154,9 @@ void content_nodemeta_deserialize_legacy(std::istream &is,
|
||||||
|
|
||||||
if(version > 1)
|
if(version > 1)
|
||||||
{
|
{
|
||||||
infostream<<__FUNCTION_NAME<<": version "<<version<<" not supported"
|
infostream<<FUNCTION_NAME<<": version "<<version<<" not supported"
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
throw SerializationError(__FUNCTION_NAME);
|
throw SerializationError(FUNCTION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 count = readU16(is);
|
u16 count = readU16(is);
|
||||||
|
@ -174,7 +174,7 @@ void content_nodemeta_deserialize_legacy(std::istream &is,
|
||||||
|
|
||||||
if(meta->get(p) != NULL)
|
if(meta->get(p) != NULL)
|
||||||
{
|
{
|
||||||
warningstream<<__FUNCTION_NAME<<": "
|
warningstream<<FUNCTION_NAME<<": "
|
||||||
<<"already set data at position"
|
<<"already set data at position"
|
||||||
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
|
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
|
|
|
@ -393,7 +393,7 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)
|
||||||
|
|
||||||
std::string LuaEntitySAO::getStaticData()
|
std::string LuaEntitySAO::getStaticData()
|
||||||
{
|
{
|
||||||
verbosestream<<__FUNCTION_NAME<<std::endl;
|
verbosestream<<FUNCTION_NAME<<std::endl;
|
||||||
std::ostringstream os(std::ios::binary);
|
std::ostringstream os(std::ios::binary);
|
||||||
// version
|
// version
|
||||||
writeU8(os, 1);
|
writeU8(os, 1);
|
||||||
|
|
14
src/debug.h
14
src/debug.h
|
@ -35,13 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <eh.h>
|
#include <eh.h>
|
||||||
#endif
|
#endif
|
||||||
#define __NORETURN __declspec(noreturn)
|
|
||||||
#define __FUNCTION_NAME __FUNCTION__
|
|
||||||
#define NORETURN __declspec(noreturn)
|
#define NORETURN __declspec(noreturn)
|
||||||
#define FUNCTION_NAME __FUNCTION__
|
#define FUNCTION_NAME __FUNCTION__
|
||||||
#else
|
#else
|
||||||
#define __NORETURN __attribute__ ((__noreturn__))
|
|
||||||
#define __FUNCTION_NAME __PRETTY_FUNCTION__
|
|
||||||
#define NORETURN __attribute__ ((__noreturn__))
|
#define NORETURN __attribute__ ((__noreturn__))
|
||||||
#define FUNCTION_NAME __PRETTY_FUNCTION__
|
#define FUNCTION_NAME __PRETTY_FUNCTION__
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,16 +53,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
/* Abort program execution immediately
|
/* Abort program execution immediately
|
||||||
*/
|
*/
|
||||||
__NORETURN extern void fatal_error_fn(
|
NORETURN extern void fatal_error_fn(
|
||||||
const char *msg, const char *file,
|
const char *msg, const char *file,
|
||||||
unsigned int line, const char *function);
|
unsigned int line, const char *function);
|
||||||
|
|
||||||
#define FATAL_ERROR(msg) \
|
#define FATAL_ERROR(msg) \
|
||||||
fatal_error_fn((msg), __FILE__, __LINE__, __FUNCTION_NAME)
|
fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME)
|
||||||
|
|
||||||
#define FATAL_ERROR_IF(expr, msg) \
|
#define FATAL_ERROR_IF(expr, msg) \
|
||||||
((expr) \
|
((expr) \
|
||||||
? fatal_error_fn((msg), __FILE__, __LINE__, __FUNCTION_NAME) \
|
? fatal_error_fn((msg), __FILE__, __LINE__, FUNCTION_NAME) \
|
||||||
: (void)(0))
|
: (void)(0))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -75,14 +71,14 @@ __NORETURN extern void fatal_error_fn(
|
||||||
defined)
|
defined)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__NORETURN extern void sanity_check_fn(
|
NORETURN extern void sanity_check_fn(
|
||||||
const char *assertion, const char *file,
|
const char *assertion, const char *file,
|
||||||
unsigned int line, const char *function);
|
unsigned int line, const char *function);
|
||||||
|
|
||||||
#define SANITY_CHECK(expr) \
|
#define SANITY_CHECK(expr) \
|
||||||
((expr) \
|
((expr) \
|
||||||
? (void)(0) \
|
? (void)(0) \
|
||||||
: sanity_check_fn(#expr, __FILE__, __LINE__, __FUNCTION_NAME))
|
: sanity_check_fn(#expr, __FILE__, __LINE__, FUNCTION_NAME))
|
||||||
|
|
||||||
#define sanity_check(expr) SANITY_CHECK(expr)
|
#define sanity_check(expr) SANITY_CHECK(expr)
|
||||||
|
|
||||||
|
|
|
@ -627,7 +627,7 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
|
||||||
|
|
||||||
void *EmergeThread::run()
|
void *EmergeThread::run()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||||
|
|
||||||
v3s16 pos;
|
v3s16 pos;
|
||||||
|
|
|
@ -70,7 +70,7 @@ Environment::~Environment()
|
||||||
|
|
||||||
void Environment::addPlayer(Player *player)
|
void Environment::addPlayer(Player *player)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
/*
|
/*
|
||||||
Check that peer_ids are unique.
|
Check that peer_ids are unique.
|
||||||
Also check that names are unique.
|
Also check that names are unique.
|
||||||
|
@ -982,7 +982,7 @@ void ServerEnvironment::clearAllObjects()
|
||||||
|
|
||||||
void ServerEnvironment::step(float dtime)
|
void ServerEnvironment::step(float dtime)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
//TimeTaker timer("ServerEnv step");
|
//TimeTaker timer("ServerEnv step");
|
||||||
|
|
||||||
|
@ -2028,7 +2028,7 @@ ClientMap & ClientEnvironment::getClientMap()
|
||||||
|
|
||||||
void ClientEnvironment::addPlayer(Player *player)
|
void ClientEnvironment::addPlayer(Player *player)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
/*
|
/*
|
||||||
It is a failure if player is local and there already is a local
|
It is a failure if player is local and there already is a local
|
||||||
player
|
player
|
||||||
|
@ -2052,7 +2052,7 @@ LocalPlayer * ClientEnvironment::getLocalPlayer()
|
||||||
|
|
||||||
void ClientEnvironment::step(float dtime)
|
void ClientEnvironment::step(float dtime)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
/* Step time of day */
|
/* Step time of day */
|
||||||
stepTimeOfDay(dtime);
|
stepTimeOfDay(dtime);
|
||||||
|
|
|
@ -616,7 +616,7 @@ protected:
|
||||||
|
|
||||||
void *run()
|
void *run()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
CurlHandlePool pool;
|
CurlHandlePool pool;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ ItemStack::ItemStack(std::string name_, u16 count_,
|
||||||
|
|
||||||
void ItemStack::serialize(std::ostream &os) const
|
void ItemStack::serialize(std::ostream &os) const
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
if(empty())
|
if(empty())
|
||||||
return;
|
return;
|
||||||
|
@ -151,7 +151,7 @@ void ItemStack::serialize(std::ostream &os) const
|
||||||
|
|
||||||
void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef)
|
void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
|
|
@ -886,7 +886,7 @@ bool getCraftingResult(Inventory *inv, ItemStack& result,
|
||||||
std::vector<ItemStack> &output_replacements,
|
std::vector<ItemStack> &output_replacements,
|
||||||
bool decrementInput, IGameDef *gamedef)
|
bool decrementInput, IGameDef *gamedef)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
result.clear();
|
result.clear();
|
||||||
|
|
||||||
|
|
36
src/map.cpp
36
src/map.cpp
|
@ -1619,7 +1619,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
|
||||||
|
|
||||||
INodeDefManager *nodemgr = m_gamedef->ndef();
|
INodeDefManager *nodemgr = m_gamedef->ndef();
|
||||||
|
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
//TimeTaker timer("transformLiquids()");
|
//TimeTaker timer("transformLiquids()");
|
||||||
|
|
||||||
u32 loopcount = 0;
|
u32 loopcount = 0;
|
||||||
|
@ -2118,7 +2118,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
|
||||||
m_emerge(emerge),
|
m_emerge(emerge),
|
||||||
m_map_metadata_changed(true)
|
m_map_metadata_changed(true)
|
||||||
{
|
{
|
||||||
verbosestream<<__FUNCTION_NAME<<std::endl;
|
verbosestream<<FUNCTION_NAME<<std::endl;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Try to load map; if not found, create a new one.
|
Try to load map; if not found, create a new one.
|
||||||
|
@ -2205,7 +2205,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
|
||||||
|
|
||||||
ServerMap::~ServerMap()
|
ServerMap::~ServerMap()
|
||||||
{
|
{
|
||||||
verbosestream<<__FUNCTION_NAME<<std::endl;
|
verbosestream<<FUNCTION_NAME<<std::endl;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2421,7 +2421,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
|
||||||
ServerMapSector *ServerMap::createSector(v2s16 p2d)
|
ServerMapSector *ServerMap::createSector(v2s16 p2d)
|
||||||
{
|
{
|
||||||
DSTACKF("%s: p2d=(%d,%d)",
|
DSTACKF("%s: p2d=(%d,%d)",
|
||||||
__FUNCTION_NAME,
|
FUNCTION_NAME,
|
||||||
p2d.X, p2d.Y);
|
p2d.X, p2d.Y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2488,7 +2488,7 @@ MapBlock * ServerMap::generateBlock(
|
||||||
std::map<v3s16, MapBlock*> &modified_blocks
|
std::map<v3s16, MapBlock*> &modified_blocks
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DSTACKF("%s: p=(%d,%d,%d)", __FUNCTION_NAME, p.X, p.Y, p.Z);
|
DSTACKF("%s: p=(%d,%d,%d)", FUNCTION_NAME, p.X, p.Y, p.Z);
|
||||||
|
|
||||||
/*infostream<<"generateBlock(): "
|
/*infostream<<"generateBlock(): "
|
||||||
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
||||||
|
@ -2508,7 +2508,7 @@ MapBlock * ServerMap::generateBlock(
|
||||||
*/
|
*/
|
||||||
if(blockpos_over_limit(p))
|
if(blockpos_over_limit(p))
|
||||||
{
|
{
|
||||||
infostream<<__FUNCTION_NAME<<": Block position over limit"<<std::endl;
|
infostream<<FUNCTION_NAME<<": Block position over limit"<<std::endl;
|
||||||
throw InvalidPositionException("generateBlock(): pos. over limit");
|
throw InvalidPositionException("generateBlock(): pos. over limit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2598,7 +2598,7 @@ MapBlock * ServerMap::generateBlock(
|
||||||
MapBlock * ServerMap::createBlock(v3s16 p)
|
MapBlock * ServerMap::createBlock(v3s16 p)
|
||||||
{
|
{
|
||||||
DSTACKF("%s: p=(%d,%d,%d)",
|
DSTACKF("%s: p=(%d,%d,%d)",
|
||||||
__FUNCTION_NAME, p.X, p.Y, p.Z);
|
FUNCTION_NAME, p.X, p.Y, p.Z);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do not create over-limit
|
Do not create over-limit
|
||||||
|
@ -2657,7 +2657,7 @@ MapBlock * ServerMap::createBlock(v3s16 p)
|
||||||
MapBlock * ServerMap::emergeBlock(v3s16 p, bool create_blank)
|
MapBlock * ServerMap::emergeBlock(v3s16 p, bool create_blank)
|
||||||
{
|
{
|
||||||
DSTACKF("%s: p=(%d,%d,%d), create_blank=%d",
|
DSTACKF("%s: p=(%d,%d,%d), create_blank=%d",
|
||||||
__FUNCTION_NAME,
|
FUNCTION_NAME,
|
||||||
p.X, p.Y, p.Z, create_blank);
|
p.X, p.Y, p.Z, create_blank);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -2880,7 +2880,7 @@ std::string ServerMap::getBlockFilename(v3s16 p)
|
||||||
|
|
||||||
void ServerMap::save(ModifiedState save_level)
|
void ServerMap::save(ModifiedState save_level)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
if(m_map_saving_enabled == false) {
|
if(m_map_saving_enabled == false) {
|
||||||
warningstream<<"Not saving map, saving disabled."<<std::endl;
|
warningstream<<"Not saving map, saving disabled."<<std::endl;
|
||||||
return;
|
return;
|
||||||
|
@ -2992,7 +2992,7 @@ void ServerMap::listAllLoadedBlocks(std::vector<v3s16> &dst)
|
||||||
|
|
||||||
void ServerMap::saveMapMeta()
|
void ServerMap::saveMapMeta()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
createDirs(m_savedir);
|
createDirs(m_savedir);
|
||||||
|
|
||||||
|
@ -3016,7 +3016,7 @@ void ServerMap::saveMapMeta()
|
||||||
|
|
||||||
void ServerMap::loadMapMeta()
|
void ServerMap::loadMapMeta()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
Settings conf;
|
Settings conf;
|
||||||
std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
|
std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
|
||||||
|
@ -3041,7 +3041,7 @@ void ServerMap::loadMapMeta()
|
||||||
|
|
||||||
void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
// Format used for writing
|
// Format used for writing
|
||||||
u8 version = SER_FMT_VER_HIGHEST_WRITE;
|
u8 version = SER_FMT_VER_HIGHEST_WRITE;
|
||||||
// Get destination
|
// Get destination
|
||||||
|
@ -3062,7 +3062,7 @@ void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
||||||
|
|
||||||
MapSector* ServerMap::loadSectorMeta(std::string sectordir, bool save_after_load)
|
MapSector* ServerMap::loadSectorMeta(std::string sectordir, bool save_after_load)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
// Get destination
|
// Get destination
|
||||||
v2s16 p2d = getSectorPos(sectordir);
|
v2s16 p2d = getSectorPos(sectordir);
|
||||||
|
|
||||||
|
@ -3103,7 +3103,7 @@ MapSector* ServerMap::loadSectorMeta(std::string sectordir, bool save_after_load
|
||||||
|
|
||||||
bool ServerMap::loadSectorMeta(v2s16 p2d)
|
bool ServerMap::loadSectorMeta(v2s16 p2d)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
// The directory layout we're going to load from.
|
// The directory layout we're going to load from.
|
||||||
// 1 - original sectors/xxxxzzzz/
|
// 1 - original sectors/xxxxzzzz/
|
||||||
|
@ -3145,7 +3145,7 @@ bool ServerMap::loadSectorMeta(v2s16 p2d)
|
||||||
#if 0
|
#if 0
|
||||||
bool ServerMap::loadSectorFull(v2s16 p2d)
|
bool ServerMap::loadSectorFull(v2s16 p2d)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
MapSector *sector = NULL;
|
MapSector *sector = NULL;
|
||||||
|
|
||||||
|
@ -3284,7 +3284,7 @@ bool ServerMap::saveBlock(MapBlock *block, Database *db)
|
||||||
void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
|
void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
|
||||||
MapSector *sector, bool save_after_load)
|
MapSector *sector, bool save_after_load)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
std::string fullpath = sectordir + DIR_DELIM + blockfile;
|
std::string fullpath = sectordir + DIR_DELIM + blockfile;
|
||||||
try {
|
try {
|
||||||
|
@ -3360,7 +3360,7 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
|
||||||
|
|
||||||
void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load)
|
void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::istringstream is(*blob, std::ios_base::binary);
|
std::istringstream is(*blob, std::ios_base::binary);
|
||||||
|
@ -3428,7 +3428,7 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
|
||||||
|
|
||||||
MapBlock* ServerMap::loadBlock(v3s16 blockpos)
|
MapBlock* ServerMap::loadBlock(v3s16 blockpos)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
v2s16 p2d(blockpos.X, blockpos.Z);
|
v2s16 p2d(blockpos.X, blockpos.Z);
|
||||||
|
|
||||||
|
|
|
@ -796,12 +796,12 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||||
char tmp;
|
char tmp;
|
||||||
is.read(&tmp, 1);
|
is.read(&tmp, 1);
|
||||||
if (is.gcount() != 1)
|
if (is.gcount() != 1)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": not enough input data");
|
+ ": not enough input data");
|
||||||
is_underground = tmp;
|
is_underground = tmp;
|
||||||
is.read((char *)*databuf_nodelist, nodecount * ser_length);
|
is.read((char *)*databuf_nodelist, nodecount * ser_length);
|
||||||
if ((u32)is.gcount() != nodecount * ser_length)
|
if ((u32)is.gcount() != nodecount * ser_length)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": not enough input data");
|
+ ": not enough input data");
|
||||||
} else if (version <= 10) {
|
} else if (version <= 10) {
|
||||||
u8 t8;
|
u8 t8;
|
||||||
|
@ -814,7 +814,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||||
decompress(is, os, version);
|
decompress(is, os, version);
|
||||||
std::string s = os.str();
|
std::string s = os.str();
|
||||||
if (s.size() != nodecount)
|
if (s.size() != nodecount)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": not enough input data");
|
+ ": not enough input data");
|
||||||
for (u32 i = 0; i < s.size(); i++) {
|
for (u32 i = 0; i < s.size(); i++) {
|
||||||
databuf_nodelist[i*ser_length] = s[i];
|
databuf_nodelist[i*ser_length] = s[i];
|
||||||
|
@ -826,7 +826,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||||
decompress(is, os, version);
|
decompress(is, os, version);
|
||||||
std::string s = os.str();
|
std::string s = os.str();
|
||||||
if (s.size() != nodecount)
|
if (s.size() != nodecount)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": not enough input data");
|
+ ": not enough input data");
|
||||||
for (u32 i = 0; i < s.size(); i++) {
|
for (u32 i = 0; i < s.size(); i++) {
|
||||||
databuf_nodelist[i*ser_length + 1] = s[i];
|
databuf_nodelist[i*ser_length + 1] = s[i];
|
||||||
|
@ -839,7 +839,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||||
decompress(is, os, version);
|
decompress(is, os, version);
|
||||||
std::string s = os.str();
|
std::string s = os.str();
|
||||||
if (s.size() != nodecount)
|
if (s.size() != nodecount)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": not enough input data");
|
+ ": not enough input data");
|
||||||
for (u32 i = 0; i < s.size(); i++) {
|
for (u32 i = 0; i < s.size(); i++) {
|
||||||
databuf_nodelist[i*ser_length + 2] = s[i];
|
databuf_nodelist[i*ser_length + 2] = s[i];
|
||||||
|
@ -859,7 +859,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
|
||||||
decompress(is, os, version);
|
decompress(is, os, version);
|
||||||
std::string s = os.str();
|
std::string s = os.str();
|
||||||
if (s.size() != nodecount * 3)
|
if (s.size() != nodecount * 3)
|
||||||
throw SerializationError(std::string(__FUNCTION_NAME)
|
throw SerializationError(std::string(FUNCTION_NAME)
|
||||||
+ ": decompress resulted in size other than nodecount*3");
|
+ ": decompress resulted in size other than nodecount*3");
|
||||||
|
|
||||||
// deserialize nodes from buffer
|
// deserialize nodes from buffer
|
||||||
|
|
|
@ -120,7 +120,7 @@ void NodeMetadataList::deSerialize(std::istream &is, IItemDefManager *item_def_m
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version != 1) {
|
if (version != 1) {
|
||||||
std::string err_str = std::string(__FUNCTION_NAME)
|
std::string err_str = std::string(FUNCTION_NAME)
|
||||||
+ ": version " + itos(version) + " not supported";
|
+ ": version " + itos(version) + " not supported";
|
||||||
infostream << err_str << std::endl;
|
infostream << err_str << std::endl;
|
||||||
throw SerializationError(err_str);
|
throw SerializationError(err_str);
|
||||||
|
|
|
@ -110,7 +110,7 @@ int ModApiServer::l_get_player_ip(lua_State *L)
|
||||||
}
|
}
|
||||||
catch(con::PeerNotFoundException) // unlikely
|
catch(con::PeerNotFoundException) // unlikely
|
||||||
{
|
{
|
||||||
dstream << __FUNCTION_NAME << ": peer was not found" << std::endl;
|
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
|
||||||
lua_pushnil(L); // error
|
lua_pushnil(L); // error
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ int ModApiServer::l_get_player_information(lua_State *L)
|
||||||
}
|
}
|
||||||
catch(con::PeerNotFoundException) // unlikely
|
catch(con::PeerNotFoundException) // unlikely
|
||||||
{
|
{
|
||||||
dstream << __FUNCTION_NAME << ": peer was not found" << std::endl;
|
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
|
||||||
lua_pushnil(L); // error
|
lua_pushnil(L); // error
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ int ModApiServer::l_get_player_information(lua_State *L)
|
||||||
|
|
||||||
#define ERET(code) \
|
#define ERET(code) \
|
||||||
if (!(code)) { \
|
if (!(code)) { \
|
||||||
dstream << __FUNCTION_NAME << ": peer was not found" << std::endl; \
|
dstream << FUNCTION_NAME << ": peer was not found" << std::endl; \
|
||||||
lua_pushnil(L); /* error */ \
|
lua_pushnil(L); /* error */ \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ int ModApiServer::l_ban_player(lua_State *L)
|
||||||
}
|
}
|
||||||
catch(con::PeerNotFoundException) // unlikely
|
catch(con::PeerNotFoundException) // unlikely
|
||||||
{
|
{
|
||||||
dstream << __FUNCTION_NAME << ": peer was not found" << std::endl;
|
dstream << FUNCTION_NAME << ": peer was not found" << std::endl;
|
||||||
lua_pushboolean(L, false); // error
|
lua_pushboolean(L, false); // error
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ private:
|
||||||
|
|
||||||
void *ServerThread::run()
|
void *ServerThread::run()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||||
|
|
||||||
m_server->AsyncRunStep(true);
|
m_server->AsyncRunStep(true);
|
||||||
|
@ -433,7 +433,7 @@ Server::~Server()
|
||||||
|
|
||||||
void Server::start(Address bind_addr)
|
void Server::start(Address bind_addr)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
m_bind_addr = bind_addr;
|
m_bind_addr = bind_addr;
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ void Server::start(Address bind_addr)
|
||||||
|
|
||||||
void Server::stop()
|
void Server::stop()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
infostream<<"Server: Stopping and waiting threads"<<std::endl;
|
infostream<<"Server: Stopping and waiting threads"<<std::endl;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ void Server::stop()
|
||||||
|
|
||||||
void Server::step(float dtime)
|
void Server::step(float dtime)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
// Limit a bit
|
// Limit a bit
|
||||||
if(dtime > 2.0)
|
if(dtime > 2.0)
|
||||||
dtime = 2.0;
|
dtime = 2.0;
|
||||||
|
@ -509,7 +509,7 @@ void Server::step(float dtime)
|
||||||
|
|
||||||
void Server::AsyncRunStep(bool initial_step)
|
void Server::AsyncRunStep(bool initial_step)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
g_profiler->add("Server::AsyncRunStep (num)", 1);
|
g_profiler->add("Server::AsyncRunStep (num)", 1);
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ void Server::AsyncRunStep(bool initial_step)
|
||||||
Player *player = m_env->getPlayer(client->peer_id);
|
Player *player = m_env->getPlayer(client->peer_id);
|
||||||
if(player == NULL) {
|
if(player == NULL) {
|
||||||
// This can happen if the client timeouts somehow
|
// This can happen if the client timeouts somehow
|
||||||
/*warningstream<<__FUNCTION_NAME<<": Client "
|
/*warningstream<<FUNCTION_NAME<<": Client "
|
||||||
<<client->peer_id
|
<<client->peer_id
|
||||||
<<" has no associated player"<<std::endl;*/
|
<<" has no associated player"<<std::endl;*/
|
||||||
continue;
|
continue;
|
||||||
|
@ -746,7 +746,7 @@ void Server::AsyncRunStep(bool initial_step)
|
||||||
// Get object type
|
// Get object type
|
||||||
u8 type = ACTIVEOBJECT_TYPE_INVALID;
|
u8 type = ACTIVEOBJECT_TYPE_INVALID;
|
||||||
if(obj == NULL)
|
if(obj == NULL)
|
||||||
warningstream<<__FUNCTION_NAME
|
warningstream<<FUNCTION_NAME
|
||||||
<<": NULL object"<<std::endl;
|
<<": NULL object"<<std::endl;
|
||||||
else
|
else
|
||||||
type = obj->getSendType();
|
type = obj->getSendType();
|
||||||
|
@ -1021,7 +1021,7 @@ void Server::AsyncRunStep(bool initial_step)
|
||||||
|
|
||||||
void Server::Receive()
|
void Server::Receive()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
SharedBuffer<u8> data;
|
SharedBuffer<u8> data;
|
||||||
u16 peer_id;
|
u16 peer_id;
|
||||||
try {
|
try {
|
||||||
|
@ -1158,7 +1158,7 @@ inline void Server::handleCommand(NetworkPacket* pkt)
|
||||||
|
|
||||||
void Server::ProcessData(NetworkPacket *pkt)
|
void Server::ProcessData(NetworkPacket *pkt)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
// Environment is locked first.
|
// Environment is locked first.
|
||||||
MutexAutoLock envlock(m_env_mutex);
|
MutexAutoLock envlock(m_env_mutex);
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ void Server::SetBlocksNotSent(std::map<v3s16, MapBlock *>& block)
|
||||||
|
|
||||||
void Server::peerAdded(con::Peer *peer)
|
void Server::peerAdded(con::Peer *peer)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
verbosestream<<"Server::peerAdded(): peer->id="
|
verbosestream<<"Server::peerAdded(): peer->id="
|
||||||
<<peer->id<<std::endl;
|
<<peer->id<<std::endl;
|
||||||
|
|
||||||
|
@ -1367,7 +1367,7 @@ void Server::peerAdded(con::Peer *peer)
|
||||||
|
|
||||||
void Server::deletingPeer(con::Peer *peer, bool timeout)
|
void Server::deletingPeer(con::Peer *peer, bool timeout)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
verbosestream<<"Server::deletingPeer(): peer->id="
|
verbosestream<<"Server::deletingPeer(): peer->id="
|
||||||
<<peer->id<<", timeout="<<timeout<<std::endl;
|
<<peer->id<<", timeout="<<timeout<<std::endl;
|
||||||
|
|
||||||
|
@ -1459,7 +1459,7 @@ void Server::Send(NetworkPacket* pkt)
|
||||||
|
|
||||||
void Server::SendMovement(u16 peer_id)
|
void Server::SendMovement(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
std::ostringstream os(std::ios_base::binary);
|
std::ostringstream os(std::ios_base::binary);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_MOVEMENT, 12 * sizeof(float), peer_id);
|
NetworkPacket pkt(TOCLIENT_MOVEMENT, 12 * sizeof(float), peer_id);
|
||||||
|
@ -1496,7 +1496,7 @@ void Server::SendPlayerHPOrDie(PlayerSAO *playersao)
|
||||||
|
|
||||||
void Server::SendHP(u16 peer_id, u8 hp)
|
void Server::SendHP(u16 peer_id, u8 hp)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_HP, 1, peer_id);
|
NetworkPacket pkt(TOCLIENT_HP, 1, peer_id);
|
||||||
pkt << hp;
|
pkt << hp;
|
||||||
|
@ -1505,7 +1505,7 @@ void Server::SendHP(u16 peer_id, u8 hp)
|
||||||
|
|
||||||
void Server::SendBreath(u16 peer_id, u16 breath)
|
void Server::SendBreath(u16 peer_id, u16 breath)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_BREATH, 2, peer_id);
|
NetworkPacket pkt(TOCLIENT_BREATH, 2, peer_id);
|
||||||
pkt << (u16) breath;
|
pkt << (u16) breath;
|
||||||
|
@ -1529,7 +1529,7 @@ void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason,
|
||||||
|
|
||||||
void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
|
void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id);
|
||||||
pkt << reason;
|
pkt << reason;
|
||||||
|
@ -1539,7 +1539,7 @@ void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
|
||||||
void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
|
void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
|
||||||
v3f camera_point_target)
|
v3f camera_point_target)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_DEATHSCREEN, 1 + sizeof(v3f), peer_id);
|
NetworkPacket pkt(TOCLIENT_DEATHSCREEN, 1 + sizeof(v3f), peer_id);
|
||||||
pkt << set_camera_point_target << camera_point_target;
|
pkt << set_camera_point_target << camera_point_target;
|
||||||
|
@ -1549,7 +1549,7 @@ void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
|
||||||
void Server::SendItemDef(u16 peer_id,
|
void Server::SendItemDef(u16 peer_id,
|
||||||
IItemDefManager *itemdef, u16 protocol_version)
|
IItemDefManager *itemdef, u16 protocol_version)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_ITEMDEF, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_ITEMDEF, 0, peer_id);
|
||||||
|
|
||||||
|
@ -1574,7 +1574,7 @@ void Server::SendItemDef(u16 peer_id,
|
||||||
void Server::SendNodeDef(u16 peer_id,
|
void Server::SendNodeDef(u16 peer_id,
|
||||||
INodeDefManager *nodedef, u16 protocol_version)
|
INodeDefManager *nodedef, u16 protocol_version)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_NODEDEF, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_NODEDEF, 0, peer_id);
|
||||||
|
|
||||||
|
@ -1603,7 +1603,7 @@ void Server::SendNodeDef(u16 peer_id,
|
||||||
|
|
||||||
void Server::SendInventory(PlayerSAO* playerSAO)
|
void Server::SendInventory(PlayerSAO* playerSAO)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
UpdateCrafting(playerSAO->getPlayer());
|
UpdateCrafting(playerSAO->getPlayer());
|
||||||
|
|
||||||
|
@ -1624,7 +1624,7 @@ void Server::SendInventory(PlayerSAO* playerSAO)
|
||||||
|
|
||||||
void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
|
void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id);
|
||||||
pkt << message;
|
pkt << message;
|
||||||
|
@ -1640,7 +1640,7 @@ void Server::SendChatMessage(u16 peer_id, const std::wstring &message)
|
||||||
void Server::SendShowFormspecMessage(u16 peer_id, const std::string &formspec,
|
void Server::SendShowFormspecMessage(u16 peer_id, const std::string &formspec,
|
||||||
const std::string &formname)
|
const std::string &formname)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id);
|
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id);
|
||||||
|
|
||||||
|
@ -1655,7 +1655,7 @@ void Server::SendSpawnParticle(u16 peer_id, v3f pos, v3f velocity, v3f accelerat
|
||||||
float expirationtime, float size, bool collisiondetection,
|
float expirationtime, float size, bool collisiondetection,
|
||||||
bool vertical, std::string texture)
|
bool vertical, std::string texture)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_SPAWN_PARTICLE, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_SPAWN_PARTICLE, 0, peer_id);
|
||||||
|
|
||||||
|
@ -1677,7 +1677,7 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 amount, float spawntime, v3
|
||||||
v3f minvel, v3f maxvel, v3f minacc, v3f maxacc, float minexptime, float maxexptime,
|
v3f minvel, v3f maxvel, v3f minacc, v3f maxacc, float minexptime, float maxexptime,
|
||||||
float minsize, float maxsize, bool collisiondetection, bool vertical, std::string texture, u32 id)
|
float minsize, float maxsize, bool collisiondetection, bool vertical, std::string texture, u32 id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_ADD_PARTICLESPAWNER, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_ADD_PARTICLESPAWNER, 0, peer_id);
|
||||||
|
|
||||||
|
@ -1699,7 +1699,7 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 amount, float spawntime, v3
|
||||||
|
|
||||||
void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
|
void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id);
|
NetworkPacket pkt(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id);
|
||||||
|
|
||||||
|
@ -1809,7 +1809,7 @@ void Server::SendOverrideDayNightRatio(u16 peer_id, bool do_override,
|
||||||
|
|
||||||
void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_TIME_OF_DAY, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_TIME_OF_DAY, 0, peer_id);
|
||||||
pkt << time << time_speed;
|
pkt << time << time_speed;
|
||||||
|
@ -1824,7 +1824,7 @@ void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
||||||
|
|
||||||
void Server::SendPlayerHP(u16 peer_id)
|
void Server::SendPlayerHP(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||||
// In some rare case, if the player is disconnected
|
// In some rare case, if the player is disconnected
|
||||||
// while Lua call l_punch, for example, this can be NULL
|
// while Lua call l_punch, for example, this can be NULL
|
||||||
|
@ -1842,7 +1842,7 @@ void Server::SendPlayerHP(u16 peer_id)
|
||||||
|
|
||||||
void Server::SendPlayerBreath(u16 peer_id)
|
void Server::SendPlayerBreath(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||||
assert(playersao);
|
assert(playersao);
|
||||||
|
|
||||||
|
@ -1852,7 +1852,7 @@ void Server::SendPlayerBreath(u16 peer_id)
|
||||||
|
|
||||||
void Server::SendMovePlayer(u16 peer_id)
|
void Server::SendMovePlayer(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
Player *player = m_env->getPlayer(peer_id);
|
Player *player = m_env->getPlayer(peer_id);
|
||||||
assert(player);
|
assert(player);
|
||||||
|
|
||||||
|
@ -2120,7 +2120,7 @@ void Server::setBlockNotSent(v3s16 p)
|
||||||
|
|
||||||
void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version)
|
void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
v3s16 p = block->getPos();
|
v3s16 p = block->getPos();
|
||||||
|
|
||||||
|
@ -2142,7 +2142,7 @@ void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto
|
||||||
|
|
||||||
void Server::SendBlocks(float dtime)
|
void Server::SendBlocks(float dtime)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
MutexAutoLock envlock(m_env_mutex);
|
MutexAutoLock envlock(m_env_mutex);
|
||||||
//TODO check if one big lock could be faster then multiple small ones
|
//TODO check if one big lock could be faster then multiple small ones
|
||||||
|
@ -2212,7 +2212,7 @@ void Server::SendBlocks(float dtime)
|
||||||
|
|
||||||
void Server::fillMediaCache()
|
void Server::fillMediaCache()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
infostream<<"Server: Calculating media file checksums"<<std::endl;
|
infostream<<"Server: Calculating media file checksums"<<std::endl;
|
||||||
|
|
||||||
|
@ -2308,7 +2308,7 @@ void Server::fillMediaCache()
|
||||||
|
|
||||||
void Server::sendMediaAnnouncement(u16 peer_id)
|
void Server::sendMediaAnnouncement(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
verbosestream << "Server: Announcing files to id(" << peer_id << ")"
|
verbosestream << "Server: Announcing files to id(" << peer_id << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -2345,7 +2345,7 @@ struct SendableMedia
|
||||||
void Server::sendRequestedMedia(u16 peer_id,
|
void Server::sendRequestedMedia(u16 peer_id,
|
||||||
const std::vector<std::string> &tosend)
|
const std::vector<std::string> &tosend)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
verbosestream<<"Server::sendRequestedMedia(): "
|
verbosestream<<"Server::sendRequestedMedia(): "
|
||||||
<<"Sending files to client"<<std::endl;
|
<<"Sending files to client"<<std::endl;
|
||||||
|
@ -2452,7 +2452,7 @@ void Server::sendRequestedMedia(u16 peer_id,
|
||||||
void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
|
void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
|
||||||
{
|
{
|
||||||
if(m_detached_inventories.count(name) == 0) {
|
if(m_detached_inventories.count(name) == 0) {
|
||||||
errorstream<<__FUNCTION_NAME<<": \""<<name<<"\" not found"<<std::endl;
|
errorstream<<FUNCTION_NAME<<": \""<<name<<"\" not found"<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Inventory *inv = m_detached_inventories[name];
|
Inventory *inv = m_detached_inventories[name];
|
||||||
|
@ -2477,7 +2477,7 @@ void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
|
||||||
|
|
||||||
void Server::sendDetachedInventories(u16 peer_id)
|
void Server::sendDetachedInventories(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
for(std::map<std::string, Inventory*>::iterator
|
for(std::map<std::string, Inventory*>::iterator
|
||||||
i = m_detached_inventories.begin();
|
i = m_detached_inventories.begin();
|
||||||
|
@ -2494,7 +2494,7 @@ void Server::sendDetachedInventories(u16 peer_id)
|
||||||
|
|
||||||
void Server::DiePlayer(u16 peer_id)
|
void Server::DiePlayer(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||||
assert(playersao);
|
assert(playersao);
|
||||||
|
@ -2514,7 +2514,7 @@ void Server::DiePlayer(u16 peer_id)
|
||||||
|
|
||||||
void Server::RespawnPlayer(u16 peer_id)
|
void Server::RespawnPlayer(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||||
assert(playersao);
|
assert(playersao);
|
||||||
|
@ -2540,7 +2540,7 @@ void Server::RespawnPlayer(u16 peer_id)
|
||||||
|
|
||||||
void Server::DenySudoAccess(u16 peer_id)
|
void Server::DenySudoAccess(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
NetworkPacket pkt(TOCLIENT_DENY_SUDO_MODE, 0, peer_id);
|
NetworkPacket pkt(TOCLIENT_DENY_SUDO_MODE, 0, peer_id);
|
||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
|
@ -2566,7 +2566,7 @@ void Server::DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode
|
||||||
|
|
||||||
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
|
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
SendAccessDenied(peer_id, reason, custom_reason);
|
SendAccessDenied(peer_id, reason, custom_reason);
|
||||||
m_clients.event(peer_id, CSE_SetDenied);
|
m_clients.event(peer_id, CSE_SetDenied);
|
||||||
|
@ -2577,7 +2577,7 @@ void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string
|
||||||
// the minimum version for MT users, maybe in 1 year
|
// the minimum version for MT users, maybe in 1 year
|
||||||
void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
|
void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
SendAccessDenied_Legacy(peer_id, reason);
|
SendAccessDenied_Legacy(peer_id, reason);
|
||||||
m_clients.event(peer_id, CSE_SetDenied);
|
m_clients.event(peer_id, CSE_SetDenied);
|
||||||
|
@ -2586,7 +2586,7 @@ void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
|
||||||
|
|
||||||
void Server::acceptAuth(u16 peer_id, bool forSudoMode)
|
void Server::acceptAuth(u16 peer_id, bool forSudoMode)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
if (!forSudoMode) {
|
if (!forSudoMode) {
|
||||||
RemoteClient* client = getClient(peer_id, CS_Invalid);
|
RemoteClient* client = getClient(peer_id, CS_Invalid);
|
||||||
|
@ -2617,7 +2617,7 @@ void Server::acceptAuth(u16 peer_id, bool forSudoMode)
|
||||||
|
|
||||||
void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
std::wstring message;
|
std::wstring message;
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -2700,7 +2700,7 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
||||||
|
|
||||||
void Server::UpdateCrafting(Player* player)
|
void Server::UpdateCrafting(Player* player)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
// Get a preview for crafting
|
// Get a preview for crafting
|
||||||
ItemStack preview;
|
ItemStack preview;
|
||||||
|
@ -3388,7 +3388,7 @@ PlayerSAO* Server::emergePlayer(const char *name, u16 peer_id, u16 proto_version
|
||||||
|
|
||||||
void dedicated_server_loop(Server &server, bool &kill)
|
void dedicated_server_loop(Server &server, bool &kill)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
verbosestream<<"dedicated_server_loop()"<<std::endl;
|
verbosestream<<"dedicated_server_loop()"<<std::endl;
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ void TestGameDef::defineSomeNodes()
|
||||||
|
|
||||||
void run_tests()
|
void run_tests()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
u32 t1 = porting::getTime(PRECISION_MILLI);
|
u32 t1 = porting::getTime(PRECISION_MILLI);
|
||||||
TestGameDef gamedef;
|
TestGameDef gamedef;
|
||||||
|
|
|
@ -210,7 +210,7 @@ public:
|
||||||
|
|
||||||
void *run()
|
void *run()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||||
|
|
||||||
while (!stopRequested()) {
|
while (!stopRequested()) {
|
||||||
|
|
Loading…
Reference in New Issue