代码拉取完成,页面将自动刷新
同步操作将从 likecg/kbengine 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SERVER_COMMON_H__
#define __SERVER_COMMON_H__
// common include
#include "cstdkbe/timer.hpp"
#include "cstdkbe/cstdkbe.hpp"
#include "server/server_errors.hpp"
// windows include
#if KBE_PLATFORM == PLATFORM_WIN32
#else
// linux include
#endif
namespace KBEngine {
// 消息转发到某个组件
#define MERCURY_MESSAGE_FORWARD(SEND_INTERFACE, SENDBUNDLE, FORWARDBUNDLE, MYCOMPONENT_ID, FORWARD_COMPONENT_ID) \
SENDBUNDLE.newMessage(SEND_INTERFACE::forwardMessage); \
SENDBUNDLE << MYCOMPONENT_ID << FORWARD_COMPONENT_ID; \
FORWARDBUNDLE.finish(true); \
SENDBUNDLE.append(FORWARDBUNDLE); \
// cellapp转发消息给客户端
#define MERCURY_ENTITY_MESSAGE_FORWARD_CLIENT(ENTITYID, SENDBUNDLE, FORWARDBUNDLE) \
SENDBUNDLE.newMessage(BaseappInterface::forwardMessageToClientFromCellapp); \
SENDBUNDLE << ENTITYID; \
FORWARDBUNDLE.finish(true); \
SENDBUNDLE.append(FORWARDBUNDLE); \
// cellapp转发消息给cellapp
#define MERCURY_ENTITY_MESSAGE_FORWARD_CELLAPP(ENTITYID, SENDBUNDLE, FORWARDBUNDLE) \
SENDBUNDLE.newMessage(BaseappInterface::forwardMessageToCellappFromCellapp); \
SENDBUNDLE << ENTITYID; \
FORWARDBUNDLE.finish(true); \
SENDBUNDLE.append(FORWARDBUNDLE);
// cellapp转发消息给客户端开始
#define MERCURY_ENTITY_MESSAGE_FORWARD_CLIENT_START(ENTITYID, SENDBUNDLE) \
SENDBUNDLE.newMessage(BaseappInterface::forwardMessageToClientFromCellapp); \
SENDBUNDLE << ENTITYID; \
// cellapp转发消息给客户端消息包追加消息
#define MERCURY_ENTITY_MESSAGE_FORWARD_CLIENT_APPEND(SENDBUNDLE, FORWARDBUNDLE) \
FORWARDBUNDLE.finish(true); \
SENDBUNDLE.append(FORWARDBUNDLE); \
// 公共消息
#define COMMON_MERCURY_MESSAGE(COMPONENTTYPE, BUNDLE, MESSAGENAME) \
switch(COMPONENTTYPE) \
{ \
case CELLAPPMGR_TYPE: \
{ \
BUNDLE.newMessage(CellappmgrInterface::MESSAGENAME); \
} \
break; \
case BASEAPPMGR_TYPE: \
{ \
BUNDLE.newMessage(BaseappmgrInterface::MESSAGENAME); \
} \
break; \
case DBMGR_TYPE: \
{ \
BUNDLE.newMessage(DbmgrInterface::MESSAGENAME); \
} \
break; \
case CELLAPP_TYPE: \
{ \
BUNDLE.newMessage(CellappInterface::MESSAGENAME); \
} \
break; \
case BASEAPP_TYPE: \
{ \
BUNDLE.newMessage(BaseappInterface::MESSAGENAME); \
} \
break; \
case LOGINAPP_TYPE: \
{ \
BUNDLE.newMessage(LoginappInterface::MESSAGENAME); \
} \
break; \
case MESSAGELOG_TYPE: \
{ \
BUNDLE.newMessage(MessagelogInterface::MESSAGENAME); \
} \
break; \
case RESOURCEMGR_TYPE: \
{ \
BUNDLE.newMessage(ResourcemgrInterface::MESSAGENAME); \
} \
break; \
case BILLING_TYPE: \
{ \
BUNDLE.newMessage(BillingSystemInterface::MESSAGENAME); \
} \
break; \
default: \
ERROR_MSG(boost::format("not support componentType=%1%(%2%)\n") \
% COMPONENTTYPE % COMPONENT_NAME_EX(COMPONENTTYPE)); \
KBE_ASSERT(false && "not support componentType!\n"); \
break; \
}; \
#define ENTITTAPP_COMMON_MERCURY_MESSAGE(COMPONENTTYPE, BUNDLE, MESSAGENAME) \
switch(COMPONENTTYPE) \
{ \
case CELLAPP_TYPE: \
{ \
BUNDLE.newMessage(CellappInterface::MESSAGENAME); \
} \
break; \
case BASEAPP_TYPE: \
{ \
BUNDLE.newMessage(BaseappInterface::MESSAGENAME); \
} \
break; \
default: \
ERROR_MSG(boost::format("not support componentType=%1%(%2%)") \
% COMPONENTTYPE % COMPONENT_NAME_EX(COMPONENTTYPE)); \
KBE_ASSERT(false && "not support componentType!\n"); \
break; \
}; \
/**
将秒转换为tick
@lowerBound: 最少不低于Ntick
*/
int32 secondsToTicks(float seconds, int lowerBound);
/**
将秒为单位的时间转换为每秒所耗的stamps
*/
inline uint64 secondsToStamps(float seconds)
{
return (uint64)(seconds * stampsPerSecondD());
}
/*
账号和密码最大长度
*/
#define ACCOUNT_NAME_MAX_LENGTH 64
#define ACCOUNT_PASSWD_MAX_LENGTH 64
// 登录注册时附带的信息最大长度
#define ACCOUNT_DATA_MAX_LENGTH 1024
// 被用来描述任何只做一次后自动设置为不做的选项
#define KBE_NEXT_ONLY 2
/** c/c++数据类别转换成KBEDataTypeID */
uint16 datatype2id(std::string datatype);
}
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。