添加f8命名空间
This commit is contained in:
parent
51f7f26e4f
commit
83cf86548e
@ -1,5 +1,7 @@
|
|||||||
#include "framework/cpp/dynmodule.h"
|
#include "framework/cpp/dynmodule.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
DynModule::DynModule()
|
DynModule::DynModule()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -39,3 +41,5 @@ void DynModule::CancelPending()
|
|||||||
module_state_.pending = false;
|
module_state_.pending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
struct DynModuleState
|
struct DynModuleState
|
||||||
{
|
{
|
||||||
bool pending = false;
|
bool pending = false;
|
||||||
@ -22,3 +24,5 @@ class DynModule
|
|||||||
DynModuleState module_state_;
|
DynModuleState module_state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,11 @@
|
|||||||
#include "framework/cpp/protoutils.h"
|
#include "framework/cpp/protoutils.h"
|
||||||
#include "framework/cpp/netmsghandler.h"
|
#include "framework/cpp/netmsghandler.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
|
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
|
||||||
unsigned short msgid)
|
unsigned short msgid)
|
||||||
{
|
{
|
||||||
return msgid < MAX_MSG_ID ? handlers->handlers[msgid] : nullptr;
|
return msgid < MAX_MSG_ID ? handlers->handlers[msgid] : nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <google/protobuf/extension_set.h>
|
#include <google/protobuf/extension_set.h>
|
||||||
#include <google/protobuf/unknown_field_set.h>
|
#include <google/protobuf/unknown_field_set.h>
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
const unsigned short MAX_MSG_ID = 2000;
|
const unsigned short MAX_MSG_ID = 2000;
|
||||||
|
|
||||||
struct MsgHdr;
|
struct MsgHdr;
|
||||||
@ -46,7 +48,7 @@ static void RegisterNetMsgHandler(NetMsgHandlerObject* msghandler,
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
MsgType dumy_msg;
|
MsgType dumy_msg;
|
||||||
static int msgid = ::Net_GetMessageId(dumy_msg);
|
static int msgid = f8::Net_GetMessageId(dumy_msg);
|
||||||
assert(msgid >= 0 || msgid < MAX_MSG_ID);
|
assert(msgid >= 0 || msgid < MAX_MSG_ID);
|
||||||
if (msgid < 0 || msgid >= MAX_MSG_ID) {
|
if (msgid < 0 || msgid >= MAX_MSG_ID) {
|
||||||
abort();
|
abort();
|
||||||
@ -85,5 +87,5 @@ static bool ProcessNetMsg(NetMsgHandler* handler,
|
|||||||
|
|
||||||
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
|
NetMsgHandler* GetNetMsgHandler(NetMsgHandlerObject* handlers,
|
||||||
unsigned short msgid);
|
unsigned short msgid);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include <google/protobuf/message.h>
|
#include <google/protobuf/message.h>
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
int Net_GetMessageId(::google::protobuf::Message& msg)
|
int Net_GetMessageId(::google::protobuf::Message& msg)
|
||||||
{
|
{
|
||||||
std::string msgname;
|
std::string msgname;
|
||||||
@ -173,3 +175,4 @@ int Net_SendProxyMsg(a8::TcpListener* tcp_listener, int socket_handle, unsigned
|
|||||||
free(buff);
|
free(buff);
|
||||||
return sizeof(WSProxyPackHead_S) + packlen;
|
return sizeof(WSProxyPackHead_S) + packlen;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class Player;
|
||||||
|
namespace google
|
||||||
|
{
|
||||||
|
namespace protobuf
|
||||||
|
{
|
||||||
|
class Message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace a8
|
||||||
|
{
|
||||||
|
class TcpClient;
|
||||||
|
class TcpListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
//普通消息头部
|
//普通消息头部
|
||||||
struct PackHead
|
struct PackHead
|
||||||
{
|
{
|
||||||
@ -45,7 +62,6 @@ struct WSProxyPackHead_S
|
|||||||
unsigned short reserved;
|
unsigned short reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Player;
|
|
||||||
struct MsgHdr
|
struct MsgHdr
|
||||||
{
|
{
|
||||||
unsigned int seqid;
|
unsigned int seqid;
|
||||||
@ -61,20 +77,6 @@ struct MsgHdr
|
|||||||
|
|
||||||
const unsigned short MAGIC_CODE = (((unsigned short)'S') << 8) | ((unsigned short)'K');
|
const unsigned short MAGIC_CODE = (((unsigned short)'S') << 8) | ((unsigned short)'K');
|
||||||
|
|
||||||
namespace google
|
|
||||||
{
|
|
||||||
namespace protobuf
|
|
||||||
{
|
|
||||||
class Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace a8
|
|
||||||
{
|
|
||||||
class TcpClient;
|
|
||||||
class TcpListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Net_GetMessageId(::google::protobuf::Message& msg);
|
int Net_GetMessageId(::google::protobuf::Message& msg);
|
||||||
|
|
||||||
void Net_PackMsg(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out);
|
void Net_PackMsg(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out);
|
||||||
@ -91,3 +93,4 @@ int Net_SendProxyCMsg(a8::TcpClient* tcp_client, unsigned short msgid, ::google:
|
|||||||
|
|
||||||
int Net_SendProxyMsg(a8::TcpListener* tcp_tlistener, int socket_handle, unsigned int seqid, unsigned short error_code,
|
int Net_SendProxyMsg(a8::TcpListener* tcp_tlistener, int socket_handle, unsigned int seqid, unsigned short error_code,
|
||||||
unsigned short msgid, ::google::protobuf::Message& msg);
|
unsigned short msgid, ::google::protobuf::Message& msg);
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "scriptengine.h"
|
#include "scriptengine.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
void ScriptEngine::Init()
|
void ScriptEngine::Init()
|
||||||
{
|
{
|
||||||
engine_ = new a8::PyEngine();
|
engine_ = new a8::PyEngine();
|
||||||
@ -86,3 +88,4 @@ std::tuple<bool, a8::XValue> ScriptEngine::CallModuleFunc(const char* module_nam
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -5,6 +5,8 @@ namespace a8
|
|||||||
class PyEngine;
|
class PyEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
class ScriptEngine : public a8::Singleton<ScriptEngine>
|
class ScriptEngine : public a8::Singleton<ScriptEngine>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -28,3 +30,5 @@ class ScriptEngine : public a8::Singleton<ScriptEngine>
|
|||||||
a8::PyEngine *engine_ = nullptr;
|
a8::PyEngine *engine_ = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <a8/mutable_xobject.h>
|
#include <a8/mutable_xobject.h>
|
||||||
#include "tglog.h"
|
#include "tglog.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
static const char* const TGLOG_ROOT = "/data/logs/%s/upload/";
|
static const char* const TGLOG_ROOT = "/data/logs/%s/upload/";
|
||||||
static const char* const POLY_TGLOG_ROOT = "/data/logs/%s/%s/upload/";
|
static const char* const POLY_TGLOG_ROOT = "/data/logs/%s/%s/upload/";
|
||||||
static const char* const TGLOG_FILENAME = "log_$pid_%Y%m%d%H.log";
|
static const char* const TGLOG_FILENAME = "log_$pid_%Y%m%d%H.log";
|
||||||
@ -193,3 +195,4 @@ void TGLog::SaveToFileThreadProc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
struct TGLogImpl;
|
struct TGLogImpl;
|
||||||
class TGLog : public a8::Singleton<TGLog>
|
class TGLog : public a8::Singleton<TGLog>
|
||||||
{
|
{
|
||||||
@ -23,3 +25,4 @@ public:
|
|||||||
bool is_poly_log_ = false;
|
bool is_poly_log_ = false;
|
||||||
TGLogImpl* impl_ = nullptr;
|
TGLogImpl* impl_ = nullptr;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <a8/stringlist.h>
|
#include <a8/stringlist.h>
|
||||||
#include "framework/cpp/tiledmap.h"
|
#include "framework/cpp/tiledmap.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
a8::XValue TiledObject::GetProperty(const std::string& prop_name)
|
a8::XValue TiledObject::GetProperty(const std::string& prop_name)
|
||||||
{
|
{
|
||||||
auto itr = prop_hash.find(prop_name);
|
auto itr = prop_hash.find(prop_name);
|
||||||
@ -458,3 +460,4 @@ void TiledMap::SetGridCellSpeedByAreaId(std::map<int,int>& area_speed_hash)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
class TiledObject
|
class TiledObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -85,3 +87,4 @@ class TiledMap
|
|||||||
|
|
||||||
std::map<std::string, std::vector<GridCell>> grid_cell_hash; //key 11|2 坐标
|
std::map<std::string, std::vector<GridCell>> grid_cell_hash; //key 11|2 坐标
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "framework/cpp/utils.h"
|
#include "framework/cpp/utils.h"
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
bool ReadCsvMetaFile(const std::string& filename,
|
bool ReadCsvMetaFile(const std::string& filename,
|
||||||
google::protobuf::Message* prototype,
|
google::protobuf::Message* prototype,
|
||||||
std::function<void (google::protobuf::Message*)> push_back_func)
|
std::function<void (google::protobuf::Message*)> push_back_func)
|
||||||
@ -175,3 +177,4 @@ int ExtractChannelIdFromAccountId(const std::string& accountid)
|
|||||||
std::string gameid = strings[1];
|
std::string gameid = strings[1];
|
||||||
return a8::XValue(channelid);
|
return a8::XValue(channelid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -17,6 +17,8 @@ namespace a8
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace f8
|
||||||
|
{
|
||||||
bool ReadCsvMetaFile(const std::string& filename,
|
bool ReadCsvMetaFile(const std::string& filename,
|
||||||
google::protobuf::Message* prototype,
|
google::protobuf::Message* prototype,
|
||||||
std::function<void (google::protobuf::Message*)> push_back_func);
|
std::function<void (google::protobuf::Message*)> push_back_func);
|
||||||
@ -82,3 +84,4 @@ time_t ExtractRegisterTimeFromSessionId(const std::string& sessionid);
|
|||||||
bool IsValidSessionId(const std::string& accountid, const std::string& sessionid);
|
bool IsValidSessionId(const std::string& accountid, const std::string& sessionid);
|
||||||
int ExtractGameIdFromAccountId(const std::string& accountid);
|
int ExtractGameIdFromAccountId(const std::string& accountid);
|
||||||
int ExtractChannelIdFromAccountId(const std::string& accountid);
|
int ExtractChannelIdFromAccountId(const std::string& accountid);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user