1
This commit is contained in:
parent
d1f41b2a92
commit
67387583e5
@ -4,9 +4,10 @@
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
|
||||
#include "f8/utils.h"
|
||||
#include "f8/protoutils.h"
|
||||
#include "f8/netmsghandler.h"
|
||||
#include <f8/f8.h>
|
||||
#include <f8/utils.h>
|
||||
#include <f8/protoutils.h>
|
||||
#include <f8/netmsghandler.h>
|
||||
|
||||
namespace f8
|
||||
{
|
||||
|
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <a8/singleton.h>
|
||||
|
||||
#include <f8/protoutils.h>
|
||||
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h>
|
||||
|
@ -12,25 +12,6 @@
|
||||
namespace f8
|
||||
{
|
||||
|
||||
MsgHdr* MsgHdr::Clone()
|
||||
{
|
||||
MsgHdr* hdr = (MsgHdr*)malloc(sizeof(MsgHdr));
|
||||
*hdr = *this;
|
||||
if (hdr->buflen > 0) {
|
||||
hdr->buf = (char*)malloc(hdr->buflen);
|
||||
memmove((void*)hdr->buf, (void*)buf, buflen);
|
||||
}
|
||||
return hdr;
|
||||
}
|
||||
|
||||
void MsgHdr::Destroy(MsgHdr* hdr)
|
||||
{
|
||||
if (hdr->buf) {
|
||||
free((void*)hdr->buf);
|
||||
}
|
||||
free((void*)hdr);
|
||||
}
|
||||
|
||||
int Net_GetMessageId(const ::google::protobuf::Message& msg)
|
||||
{
|
||||
std::string msgname;
|
||||
|
@ -81,22 +81,6 @@ namespace f8
|
||||
unsigned short ext_len;
|
||||
};
|
||||
|
||||
struct MsgHdr
|
||||
{
|
||||
unsigned int seqid;
|
||||
unsigned short msgid;
|
||||
int socket_handle;
|
||||
unsigned long ip_saddr;
|
||||
const char* buf;
|
||||
int buflen;
|
||||
int offset;
|
||||
Player *hum = nullptr;
|
||||
const void* user_data = nullptr;
|
||||
|
||||
MsgHdr* Clone();
|
||||
static void Destroy(MsgHdr* hdr);
|
||||
};
|
||||
|
||||
#ifdef MATCHVS
|
||||
const unsigned int MAGIC_CODE = 0xAABBCCAA;
|
||||
#else
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <a8/singleton.h>
|
||||
|
||||
namespace f8
|
||||
{
|
||||
struct TGLogImpl;
|
||||
|
25
f8/types.cc
25
f8/types.cc
@ -1,6 +1,8 @@
|
||||
#include "precompile.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "f8/types.h"
|
||||
#include <a8/a8.h>
|
||||
|
||||
#include <f8/f8.h>
|
||||
#include <a8/mutable_xobject.h>
|
||||
|
||||
namespace f8
|
||||
@ -25,4 +27,23 @@ namespace f8
|
||||
return a8::HttpResponse(response);
|
||||
}
|
||||
|
||||
MsgHdr* MsgHdr::Clone()
|
||||
{
|
||||
MsgHdr* hdr = (MsgHdr*)malloc(sizeof(MsgHdr));
|
||||
*hdr = *this;
|
||||
if (hdr->buflen > 0) {
|
||||
hdr->buf = (char*)malloc(hdr->buflen);
|
||||
memmove((void*)hdr->buf, (void*)buf, buflen);
|
||||
}
|
||||
return hdr;
|
||||
}
|
||||
|
||||
void MsgHdr::Destroy(MsgHdr* hdr)
|
||||
{
|
||||
if (hdr->buf) {
|
||||
free((void*)hdr->buf);
|
||||
}
|
||||
free((void*)hdr);
|
||||
}
|
||||
|
||||
}
|
||||
|
17
f8/types.h
17
f8/types.h
@ -5,6 +5,7 @@ namespace a8
|
||||
class MutableXObject;
|
||||
}
|
||||
|
||||
class Player;
|
||||
namespace f8
|
||||
{
|
||||
struct JsonHttpRequest
|
||||
@ -34,4 +35,20 @@ namespace f8
|
||||
IM_SysEnd = 99,
|
||||
};
|
||||
|
||||
struct MsgHdr
|
||||
{
|
||||
unsigned int seqid;
|
||||
unsigned short msgid;
|
||||
int socket_handle;
|
||||
unsigned long ip_saddr;
|
||||
const char* buf;
|
||||
int buflen;
|
||||
int offset;
|
||||
Player *hum = nullptr;
|
||||
const void* user_data = nullptr;
|
||||
|
||||
MsgHdr* Clone();
|
||||
static void Destroy(MsgHdr* hdr);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user