blob: 609cfa7763a023d33c5bdacdc2b861253380ce88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include "stdafx.h"
#include <iostream>
#include "ArrayWithLength.h"
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "RemoveEntitiesPacket.h"
RemoveEntitiesPacket::RemoveEntitiesPacket()
{
}
RemoveEntitiesPacket::RemoveEntitiesPacket(intArray ids)
{
this->ids = ids;
}
RemoveEntitiesPacket::~RemoveEntitiesPacket()
{
delete ids.data;
}
void RemoveEntitiesPacket::read(DataInputStream *dis) //throws IOException
{
ids = intArray(dis->readByte());
for(unsigned int i = 0; i < ids.length; ++i)
{
ids[i] = dis->readInt();
}
}
void RemoveEntitiesPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeByte(ids.length);
for(unsigned int i = 0; i < ids.length; ++i)
{
dos->writeInt(ids[i]);
}
}
void RemoveEntitiesPacket::handle(PacketListener *listener)
{
listener->handleRemoveEntity(shared_from_this());
}
int RemoveEntitiesPacket::getEstimatedSize()
{
return 1 + (ids.length * 4);
}
/*
4J: These are necesary on the PS3.
(and 4).
*/
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
const int RemoveEntitiesPacket::MAX_PER_PACKET;
#endif
|