This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
48 lines
885 B
C++
48 lines
885 B
C++
#include "stdafx.h"
|
|
#include <iostream>
|
|
#include "InputOutputStream.h"
|
|
#include "SharedConstants.h"
|
|
#include "PacketListener.h"
|
|
#include "DisconnectPacket.h"
|
|
|
|
|
|
|
|
DisconnectPacket::DisconnectPacket()
|
|
{
|
|
reason = eDisconnect_None;
|
|
}
|
|
|
|
DisconnectPacket::DisconnectPacket(eDisconnectReason reason)
|
|
{
|
|
this->reason = reason;
|
|
}
|
|
|
|
void DisconnectPacket::read(DataInputStream *dis) //throws IOException
|
|
{
|
|
reason = (eDisconnectReason)dis->readInt();
|
|
}
|
|
|
|
void DisconnectPacket::write(DataOutputStream *dos) //throws IOException
|
|
{
|
|
dos->writeInt((int)reason);
|
|
}
|
|
|
|
void DisconnectPacket::handle(PacketListener *listener)
|
|
{
|
|
listener->handleDisconnect(shared_from_this());
|
|
}
|
|
|
|
int DisconnectPacket::getEstimatedSize()
|
|
{
|
|
return sizeof(eDisconnectReason);
|
|
}
|
|
|
|
bool DisconnectPacket::canBeInvalidated()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool DisconnectPacket::isInvalidatedBy(shared_ptr<Packet> packet)
|
|
{
|
|
return true;
|
|
} |