aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/server.cpp b/src/server.cpp
index dee8a3d70..67dbe1545 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -692,7 +692,7 @@ void Server::AsyncRunStep(bool initial_step)
if (client->getState() < CS_DefinitionsSent)
continue;
- Player *player = m_env->getPlayer(client->peer_id);
+ RemotePlayer *player = m_env->getPlayer(client->peer_id);
if (player == NULL) {
// This can happen if the client timeouts somehow
/*warningstream<<FUNCTION_NAME<<": Client "
@@ -1857,7 +1857,7 @@ void Server::SendPlayerBreath(u16 peer_id)
void Server::SendMovePlayer(u16 peer_id)
{
DSTACK(FUNCTION_NAME);
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
NetworkPacket pkt(TOCLIENT_MOVE_PLAYER, sizeof(v3f) + sizeof(f32) * 2, peer_id);
@@ -1896,7 +1896,7 @@ void Server::SendEyeOffset(u16 peer_id, v3f first, v3f third)
}
void Server::SendPlayerPrivileges(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
if(player->peer_id == PEER_ID_INEXISTENT)
return;
@@ -1917,7 +1917,7 @@ void Server::SendPlayerPrivileges(u16 peer_id)
void Server::SendPlayerInventoryFormspec(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
if(player->peer_id == PEER_ID_INEXISTENT)
return;
@@ -1962,7 +1962,7 @@ s32 Server::playSound(const SimpleSoundSpec &spec,
std::vector<u16> dst_clients;
if(params.to_player != "")
{
- Player *player = m_env->getPlayer(params.to_player.c_str());
+ RemotePlayer *player = m_env->getPlayer(params.to_player.c_str());
if(!player){
infostream<<"Server::playSound: Player \""<<params.to_player
<<"\" not found"<<std::endl;
@@ -1978,13 +1978,12 @@ s32 Server::playSound(const SimpleSoundSpec &spec,
else {
std::vector<u16> clients = m_clients.getClientIDs();
- for(std::vector<u16>::iterator
- i = clients.begin(); i != clients.end(); ++i) {
- Player *player = m_env->getPlayer(*i);
- if(!player)
+ for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
+ RemotePlayer *player = m_env->getPlayer(*i);
+ if (!player)
continue;
- if(pos_exists) {
+ if (pos_exists) {
if(player->getPosition().getDistanceFrom(pos) >
params.max_hear_distance)
continue;
@@ -2048,7 +2047,7 @@ void Server::sendRemoveNode(v3s16 p, u16 ignore_id,
i != clients.end(); ++i) {
if (far_players) {
// Get player
- if(Player *player = m_env->getPlayer(*i)) {
+ if (RemotePlayer *player = m_env->getPlayer(*i)) {
// If player is far away, only set modified blocks not sent
v3f player_pos = player->getPosition();
if(player_pos.getDistanceFrom(p_f) > maxd) {
@@ -2076,7 +2075,7 @@ void Server::sendAddNode(v3s16 p, MapNode n, u16 ignore_id,
if(far_players) {
// Get player
- if(Player *player = m_env->getPlayer(*i)) {
+ if (RemotePlayer *player = m_env->getPlayer(*i)) {
// If player is far away, only set modified blocks not sent
v3f player_pos = player->getPosition();
if(player_pos.getDistanceFrom(p_f) > maxd) {
@@ -2661,8 +2660,8 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
for(std::vector<u16>::iterator i = clients.begin();
i != clients.end(); ++i) {
// Get player
- Player *player = m_env->getPlayer(*i);
- if(!player)
+ RemotePlayer *player = m_env->getPlayer(*i);
+ if (!player)
continue;
// Get name of player
@@ -2842,8 +2841,8 @@ RemoteClient* Server::getClientNoEx(u16 peer_id, ClientState state_min)
std::string Server::getPlayerName(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
- if(player == NULL)
+ RemotePlayer *player = m_env->getPlayer(peer_id);
+ if (player == NULL)
return "[id="+itos(peer_id)+"]";
return player->getName();
}
@@ -2870,13 +2869,12 @@ std::wstring Server::getStatusString()
bool first = true;
os<<L", clients={";
std::vector<u16> clients = m_clients.getClientIDs();
- for(std::vector<u16>::iterator i = clients.begin();
- i != clients.end(); ++i) {
+ for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
// Get player
- Player *player = m_env->getPlayer(*i);
+ RemotePlayer *player = m_env->getPlayer(*i);
// Get name of player
std::wstring name = L"unknown";
- if(player != NULL)
+ if (player != NULL)
name = narrow_to_wide(player->getName());
// Add name to information string
if(!first)
@@ -2912,12 +2910,11 @@ void Server::reportPrivsModified(const std::string &name)
std::vector<u16> clients = m_clients.getClientIDs();
for(std::vector<u16>::iterator i = clients.begin();
i != clients.end(); ++i) {
- Player *player = m_env->getPlayer(*i);
+ RemotePlayer *player = m_env->getPlayer(*i);
reportPrivsModified(player->getName());
}
} else {
- RemotePlayer *player =
- dynamic_cast<RemotePlayer *>(m_env->getPlayer(name.c_str()));
+ RemotePlayer *player = m_env->getPlayer(name.c_str());
if (!player)
return;
SendPlayerPrivileges(player->peer_id);
@@ -2932,8 +2929,8 @@ void Server::reportPrivsModified(const std::string &name)
void Server::reportInventoryFormspecModified(const std::string &name)
{
- Player *player = m_env->getPlayer(name.c_str());
- if(!player)
+ RemotePlayer *player = m_env->getPlayer(name.c_str());
+ if (!player)
return;
SendPlayerInventoryFormspec(player->peer_id);
}
@@ -2963,7 +2960,7 @@ void Server::notifyPlayer(const char *name, const std::wstring &msg)
m_admin_chat->outgoing_queue.push_back(new ChatEventChat("", msg));
}
- Player *player = m_env->getPlayer(name);
+ RemotePlayer *player = m_env->getPlayer(name);
if (!player) {
return;
}
@@ -2981,7 +2978,7 @@ bool Server::showFormspec(const char *playername, const std::string &formspec,
if (!m_env)
return false;
- Player *player = m_env->getPlayer(playername);
+ RemotePlayer *player = m_env->getPlayer(playername);
if (!player)
return false;
@@ -3152,7 +3149,7 @@ void Server::spawnParticle(const std::string &playername, v3f pos,
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return;
peer_id = player->peer_id;
@@ -3176,7 +3173,7 @@ u32 Server::addParticleSpawner(u16 amount, float spawntime,
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return -1;
peer_id = player->peer_id;
@@ -3199,7 +3196,7 @@ void Server::deleteParticleSpawner(const std::string &playername, u32 id)
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return;
peer_id = player->peer_id;