Beispiel #1
0
int Mineserver::Network_Protocol_Notch_Packet_0x34::_read(Mineserver::Network_Protocol_Notch_PacketStream& ps, Mineserver::Network_Message** message)
{
  Mineserver::Network_Message_0x34* msg = new Mineserver::Network_Message_0x34;
  *message = msg;

  ps >> msg->mid >> msg->x >> msg->z >> msg->num;
  msg->coordinate.reserve(msg->num*2);
  ps.bytesTo(reinterpret_cast<uint8_t*>(&(msg->coordinate[0])), msg->num*2);
  msg->type.reserve(msg->num);
  ps.bytesTo(reinterpret_cast<uint8_t*>(&(msg->type[0])), msg->num);
  msg->meta.reserve(msg->num);
  ps.bytesTo(reinterpret_cast<uint8_t*>(&(msg->meta[0])), msg->num);

  return STATE_GOOD;
}
Beispiel #2
0
int Mineserver::Network_Protocol_Notch_Packet_0x33::_read(Mineserver::Network_Protocol_Notch_PacketStream& ps, Mineserver::Network_Message** message)
{
  Mineserver::Network_Message_Chunk* msg = new Mineserver::Network_Message_Chunk;
  *message = msg;

  int16_t bytes;
  std::vector<uint8_t> data;

  ps >> msg->mid >> msg->posX >> msg->posY >> msg->posZ >> msg->sizeX >> msg->sizeY >> msg->sizeZ >> bytes;
  data.reserve(bytes);
  ps.bytesTo(reinterpret_cast<uint8_t*>(&(data[0])), bytes);

  return STATE_GOOD;
}