aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2016-10-08 16:31:22 +0200
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-08 22:27:44 +0200
commitfd5a130b86c08f0b3190c3d81affd4869c139fb7 (patch)
tree8300ec1e77cfd8c38292f5b81e8e0fb82de0d53d /src/network
parent067766eec213918b6cb5b2533d0c78eceb3949ec (diff)
downloadminetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.tar.gz
minetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.tar.bz2
minetest-fd5a130b86c08f0b3190c3d81affd4869c139fb7.zip
More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects * Use RemotePlayer and LocalPlayer everywhere it's possible * Minor code style fixes * Drop Client::getBreath() unused function
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp18
-rw-r--r--src/network/serverpackethandler.cpp6
2 files changed, 12 insertions, 12 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 35e350f20..b39356e92 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -110,7 +110,7 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
playerpos -= v3f(0, BS / 2, 0);
// Set player position
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->setPosition(playerpos);
@@ -176,7 +176,7 @@ void Client::handleCommand_InitLegacy(NetworkPacket* pkt)
// Set player position
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->setPosition(playerpos_f);
@@ -333,7 +333,7 @@ void Client::handleCommand_Inventory(NetworkPacket* pkt)
std::string datastring(pkt->getString(0), pkt->getSize());
std::istringstream is(datastring, std::ios_base::binary);
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->inventory.deSerialize(is);
@@ -486,7 +486,7 @@ void Client::handleCommand_ActiveObjectMessages(NetworkPacket* pkt)
void Client::handleCommand_Movement(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
float mad, maa, maf, msw, mscr, msf, mscl, msj, lf, lfs, ls, g;
@@ -511,7 +511,7 @@ void Client::handleCommand_Movement(NetworkPacket* pkt)
void Client::handleCommand_HP(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
u8 oldhp = player->hp;
@@ -532,7 +532,7 @@ void Client::handleCommand_HP(NetworkPacket* pkt)
void Client::handleCommand_Breath(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
u16 breath;
@@ -544,7 +544,7 @@ void Client::handleCommand_Breath(NetworkPacket* pkt)
void Client::handleCommand_MovePlayer(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
v3f pos;
@@ -840,7 +840,7 @@ void Client::handleCommand_Privileges(NetworkPacket* pkt)
void Client::handleCommand_InventoryFormSpec(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
// Store formspec in LocalPlayer
@@ -1098,7 +1098,7 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt)
*pkt >> flags >> mask;
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
bool was_minimap_visible = player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE;
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 6ef768295..554025747 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -1052,7 +1052,7 @@ void Server::handleCommand_ChatMessage(NetworkPacket* pkt)
message += (wchar_t)tmp_wchar;
}
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()
@@ -1179,7 +1179,7 @@ void Server::handleCommand_Password(NetworkPacket* pkt)
newpwd += c;
}
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()
@@ -1255,7 +1255,7 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt)
void Server::handleCommand_Respawn(NetworkPacket* pkt)
{
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()