From f9e351fc8e7a5ae71305c3b8837bf9c0ad725493 Mon Sep 17 00:00:00 2001 From: M Date: Wed, 19 Jun 2019 10:20:44 +0800 Subject: [PATCH] commit --- Server/Src/LogicServer/GuildManager.h | 1 - Server/Src/LogicServer/PlayerObject.h | 4 ++- Server/Src/ServerData/GuildData.h | 9 ++--- Server/Src/ServerData/RoleData.h | 42 +++++++++++----------- Server/Src/ServerData/ServerDefine.h | 1 + Server/Src/ServerEngine/EventFuncManager.h | 38 +++++++++++++------- Server/Src/ServerEngine/TimerManager.cpp | 1 - Server/Src/ServerEngine/TimerManager.h | 11 ------ 8 files changed, 55 insertions(+), 52 deletions(-) diff --git a/Server/Src/LogicServer/GuildManager.h b/Server/Src/LogicServer/GuildManager.h index 3f3a11d5..3c071b5d 100644 --- a/Server/Src/LogicServer/GuildManager.h +++ b/Server/Src/LogicServer/GuildManager.h @@ -15,7 +15,6 @@ class CGuildManager CGuild* GetGuildByID(UINT64 u64ID); - CGuild* CreateGuild(UINT64 uRoleID, std::string& strName, INT32 nIcon); BOOL RemoveGuild(UINT64 uGuildID); diff --git a/Server/Src/LogicServer/PlayerObject.h b/Server/Src/LogicServer/PlayerObject.h index ad547f0e..aa7ba45b 100644 --- a/Server/Src/LogicServer/PlayerObject.h +++ b/Server/Src/LogicServer/PlayerObject.h @@ -40,7 +40,7 @@ class CPlayerObject //向玩家所在的场景服发消息 BOOL SendMsgToScene(UINT32 dwMsgID, const google::protobuf::Message& pdata); - BOOL ToTransferData(TransferDataItem *pTransItem); + BOOL ToTransferData(TransferDataItem* pTransItem); BOOL NotifyTaskEvent(UINT32 dwEventID, UINT32 dwParam1, UINT32 dwParm2); @@ -95,6 +95,8 @@ class CPlayerObject BOOL m_IsOnline; std::vector m_MoudleList; + + public: UINT32 m_dwCopyGuid; //当前的副本ID UINT32 m_dwCopyID; //当前的副本类型 diff --git a/Server/Src/ServerData/GuildData.h b/Server/Src/ServerData/GuildData.h index 99fb5474..f2d620ed 100644 --- a/Server/Src/ServerData/GuildData.h +++ b/Server/Src/ServerData/GuildData.h @@ -13,10 +13,11 @@ struct GuildDataObject : public ShareObject memset(m_szNotice, 0, GUILD_NOTICE_LEN); } - UINT64 m_uGuid; //格子的guid - CHAR m_szName[GUILD_NAME_LEN]; - CHAR m_szNotice[GUILD_NOTICE_LEN]; - INT32 m_Level; + INT32 m_Level; //等级 + UINT64 m_uGuid; //guid + CHAR m_szName[GUILD_NAME_LEN]; //名字 + CHAR m_szNotice[GUILD_NOTICE_LEN]; //公告 + UINT64 m_ApplyRoles[GUILD_MAX_APPLY_NUM]; //申请id BOOL Create(IDBInterface* pDB) { diff --git a/Server/Src/ServerData/RoleData.h b/Server/Src/ServerData/RoleData.h index 39190aef..ab1d9dcf 100644 --- a/Server/Src/ServerData/RoleData.h +++ b/Server/Src/ServerData/RoleData.h @@ -23,29 +23,29 @@ struct RoleDataObject : public ShareObject memset(m_szName, 0, ROLE_NAME_LEN); } - UINT64 m_uRoleID; //角色ID - UINT64 m_uAccountID; //账号ID - CHAR m_szName[ROLE_NAME_LEN]; //角色名 - INT32 m_CarrerID; //职业ID - INT32 m_Level; //等级 - INT64 m_Action[ACTION_NUM]; //所有的体力 - INT64 m_Actime[ACTION_NUM]; //体力恢复时间 - INT64 m_Exp; //经验 - INT32 m_nLangID; //语言ID - INT64 m_u64Fight; //战力 - INT32 m_VipLvl; //VIP等级 - INT32 m_VipExp; //VIP经验 - INT32 m_CityCopyID; //主城副本类型 - BOOL m_bDelete; //是否删除 - INT64 m_uQQ; //QQ号 - UINT64 m_uCreateTime; //角色创建时间 - UINT64 m_uLogonTime; //本次登录时间 - UINT64 m_uLogoffTime; //离线时间 + UINT64 m_uRoleID; //角色ID + UINT64 m_uAccountID; //账号ID + CHAR m_szName[ROLE_NAME_LEN];//角色名 + INT32 m_CarrerID; //职业ID + INT32 m_Level; //等级 + INT64 m_Action[ACTION_NUM]; //所有的体力 + INT64 m_Actime[ACTION_NUM]; //体力恢复时间 + INT64 m_Exp; //经验 + INT32 m_nLangID; //语言ID + INT64 m_u64Fight; //战力 + INT32 m_VipLvl; //VIP等级 + INT32 m_VipExp; //VIP经验 + INT32 m_CityCopyID; //主城副本类型 + BOOL m_bDelete; //是否删除 + INT64 m_uQQ; //QQ号 + UINT64 m_uCreateTime; //角色创建时间 + UINT64 m_uLogonTime; //本次登录时间 + UINT64 m_uLogoffTime; //离线时间 //签到数据 - INT32 m_nSignNum; //签到天数 - UINT32 m_nSignDay; //最新的签到时间 - UINT32 m_RecvAction; //领取体力标记 + INT32 m_nSignNum; //签到天数 + UINT32 m_nSignDay; //最新的签到时间 + UINT32 m_RecvAction; //领取体力标记 BOOL Create(IDBInterface* pDB) { diff --git a/Server/Src/ServerData/ServerDefine.h b/Server/Src/ServerData/ServerDefine.h index 24efc6bb..e09e41dc 100644 --- a/Server/Src/ServerData/ServerDefine.h +++ b/Server/Src/ServerData/ServerDefine.h @@ -19,6 +19,7 @@ //公会名长度 #define GUILD_NAME_LEN 255 #define GUILD_NOTICE_LEN 1024 +#define GUILD_MAX_APPLY_NUM 50 //语言数 #define MAX_LANGUAGE_NUM 15 diff --git a/Server/Src/ServerEngine/EventFuncManager.h b/Server/Src/ServerEngine/EventFuncManager.h index 4a8aae1a..ddafb2fb 100644 --- a/Server/Src/ServerEngine/EventFuncManager.h +++ b/Server/Src/ServerEngine/EventFuncManager.h @@ -5,10 +5,15 @@ class CFunctionSlotBase { public: virtual ~CFunctionSlotBase() {} - virtual BOOL operator()(void* pdata) { return TRUE; } - virtual UINT32 GetParam() { return 0; } - virtual VOID* GetThisAddr() { return 0; } - virtual VOID EmptyThisAddr() {} + virtual BOOL operator()(void* pdata) + { + return TRUE; + } + virtual UINT32 GetParam() = 0; + + virtual VOID* GetThisAddr() = 0; + + virtual VOID EmptyThisAddr() = 0; }; @@ -33,12 +38,12 @@ class CFunctionSlot : public CFunctionSlotBase return true; } else - { - return false; + { + return false; } } - virtual UINT32 getParma() + virtual UINT32 GetParma() { return m_dwParam; } @@ -60,6 +65,8 @@ class CFunctionSlot : public CFunctionSlotBase UINT32 m_dwParam; }; +typedef std::map< int, std::vector* > FUNC_MAP_TYPE; + class CEventFuncManager { public: @@ -105,7 +112,7 @@ class CEventFuncManager } template - bool UnregisterMessageHandle(int nMsgID, T* pObj) + bool UnregisterMessageHandle(int nMsgID, T* pObj, int nParam = 0) { std::vector* vec = NULL; FUNC_MAP_TYPE::iterator it = m_FuncMap.find(nMsgID); @@ -120,12 +127,18 @@ class CEventFuncManager for (std::vector::iterator itor = vec->begin(); itor != vec->end(); ++itor) { - if ((*itor)->GetThisAddr() == reinterpret_cast(pObj)) + if ((*itor)->GetThisAddr() != reinterpret_cast(pObj)) + { + continue; + } + + if ((*itor)->GetParam() != nParam) { - //反注册并不真实删除,只是将this指针置空 - (*itor)->EmptyThisAddr(); + continue; } + //反注册并不真实删除,只是将this指针置空 + (*itor)->EmptyThisAddr(); } return true; } @@ -149,8 +162,7 @@ class CEventFuncManager } protected: - std::map* > m_FuncMap; - typedef std::map< int, std::vector* > FUNC_MAP_TYPE; + FUNC_MAP_TYPE m_FuncMap; }; #endif // _EVENT_MANAGER_H__ diff --git a/Server/Src/ServerEngine/TimerManager.cpp b/Server/Src/ServerEngine/TimerManager.cpp index 1eb7c64a..75cbdbb5 100644 --- a/Server/Src/ServerEngine/TimerManager.cpp +++ b/Server/Src/ServerEngine/TimerManager.cpp @@ -41,7 +41,6 @@ BOOL TimerManager::DelTimer(UINT32 dwSec, UINT32 dwData) pDelEvent = pDelEvent->m_pNext; } - if(pDelEvent == m_pUsedHead) { m_pUsedHead = m_pUsedHead->m_pNext; diff --git a/Server/Src/ServerEngine/TimerManager.h b/Server/Src/ServerEngine/TimerManager.h index 04ddb63c..f69dc4b1 100644 --- a/Server/Src/ServerEngine/TimerManager.h +++ b/Server/Src/ServerEngine/TimerManager.h @@ -142,17 +142,6 @@ class EngineClass TimerManager m_pUsedHead->m_pPrev = NULL; } - //TimeEvent *pInserPos = m_pHead; - //while(pInserPos != NULL) - //{ - // if(pNewEvent->dwFireTime < pInserPos->dwFireTime) - // { - // - // - // return TRUE; - // } - //} - return TRUE; }