aboutsummaryrefslogtreecommitdiff
path: root/src/network/clientpackethandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r--src/network/clientpackethandler.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 0498f4048..411982f69 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;
@@ -634,7 +634,6 @@ void Client::handleCommand_AnnounceMedia(NetworkPacket* pkt)
m_media_downloader->addFile(name, sha1_raw);
}
- std::vector<std::string> remote_media;
try {
std::string str;
@@ -812,9 +811,7 @@ void Client::handleCommand_StopSound(NetworkPacket* pkt)
*pkt >> server_id;
- std::map<s32, int>::iterator i =
- m_sounds_server_to_client.find(server_id);
-
+ UNORDERED_MAP<s32, int>::iterator i = m_sounds_server_to_client.find(server_id);
if (i != m_sounds_server_to_client.end()) {
int client_id = i->second;
m_sound->stopSound(client_id);
@@ -842,7 +839,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
@@ -898,8 +895,10 @@ void Client::handleCommand_SpawnParticle(NetworkPacket* pkt)
bool collisiondetection = readU8(is);
std::string texture = deSerializeLongString(is);
bool vertical = false;
+ bool collision_removal = false;
try {
vertical = readU8(is);
+ collision_removal = readU8(is);
} catch (...) {}
ClientEvent event;
@@ -910,6 +909,7 @@ void Client::handleCommand_SpawnParticle(NetworkPacket* pkt)
event.spawn_particle.expirationtime = expirationtime;
event.spawn_particle.size = size;
event.spawn_particle.collisiondetection = collisiondetection;
+ event.spawn_particle.collision_removal = collision_removal;
event.spawn_particle.vertical = vertical;
event.spawn_particle.texture = new std::string(texture);
@@ -942,8 +942,13 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
*pkt >> id;
bool vertical = false;
+ bool collision_removal = false;
+ u16 attached_id = 0;
try {
*pkt >> vertical;
+ *pkt >> collision_removal;
+ *pkt >> attached_id;
+
} catch (...) {}
ClientEvent event;
@@ -961,6 +966,8 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
event.add_particlespawner.minsize = minsize;
event.add_particlespawner.maxsize = maxsize;
event.add_particlespawner.collisiondetection = collisiondetection;
+ event.add_particlespawner.collision_removal = collision_removal;
+ event.add_particlespawner.attached_id = attached_id;
event.add_particlespawner.vertical = vertical;
event.add_particlespawner.texture = new std::string(texture);
event.add_particlespawner.id = id;
@@ -1093,7 +1100,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;
@@ -1117,7 +1124,7 @@ void Client::handleCommand_HudSetParam(NetworkPacket* pkt)
*pkt >> param >> value;
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
if (param == HUD_PARAM_HOTBAR_ITEMCOUNT && value.size() == 4) {
@@ -1126,10 +1133,10 @@ void Client::handleCommand_HudSetParam(NetworkPacket* pkt)
player->hud_hotbar_itemcount = hotbar_itemcount;
}
else if (param == HUD_PARAM_HOTBAR_IMAGE) {
- ((LocalPlayer *) player)->hotbar_image = value;
+ player->hotbar_image = value;
}
else if (param == HUD_PARAM_HOTBAR_SELECTED_IMAGE) {
- ((LocalPlayer *) player)->hotbar_selected_image = value;
+ player->hotbar_selected_image = value;
}
}