From 4b998cfedc51cb33595608e2e79c08f02737276c Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Wed, 31 Oct 2012 20:47:09 +0000 Subject: [PATCH] Pickups no longer crash clients. Removed some unnecessary includes. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1020 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol142.cpp | 21 +++++++++++++++++++++ source/Protocol/Protocol142.h | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/source/Protocol/Protocol142.cpp b/source/Protocol/Protocol142.cpp index 6784a8ea4..b4b2b66c1 100644 --- a/source/Protocol/Protocol142.cpp +++ b/source/Protocol/Protocol142.cpp @@ -42,6 +42,7 @@ typedef unsigned char Byte; enum { PACKET_UPDATE_TIME = 0x04, + PACKET_PICKUP_SPAWN = 0x15, PACKET_SOUND_PARTICLE_EFFECT = 0x3d } ; @@ -85,6 +86,26 @@ int cProtocol142::ParseLogin(void) +void cProtocol142::SendPickupSpawn(const cPickup & a_Pickup) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_PICKUP_SPAWN); + WriteInt (a_Pickup.GetUniqueID()); + WriteShort (a_Pickup.GetItem()->m_ItemType); + WriteByte (a_Pickup.GetItem()->m_ItemCount); + WriteShort (a_Pickup.GetItem()->m_ItemDamage); + WriteShort (-1); //TODO: Implement item metadata + WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32)); + WriteByte ((char)(a_Pickup.GetSpeed().x * 8)); + WriteByte ((char)(a_Pickup.GetSpeed().y * 8)); + WriteByte ((char)(a_Pickup.GetSpeed().z * 8)); + Flush(); +} + + + + + void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) { cCSLock Lock(m_CSPacket); diff --git a/source/Protocol/Protocol142.h b/source/Protocol/Protocol142.h index e84cab72c..8b2205e44 100644 --- a/source/Protocol/Protocol142.h +++ b/source/Protocol/Protocol142.h @@ -10,8 +10,6 @@ #pragma once #include "Protocol132.h" -#include "../../CryptoPP/modes.h" -#include "../../CryptoPP/aes.h" @@ -27,6 +25,7 @@ public: virtual ~cProtocol142(); // Sending commands (alphabetically sorted): + virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendTimeUpdate (Int64 a_WorldTime) override;