Bool HsGame::OnException(Int32 iCode) { static XIDVector vXID; //系统异常, 通知玩家进行存储 ObjMan* pUserMan = GetObjMan(HSO_PLAYER); if (pUserMan) { vXID.clear(); if (!pUserMan->CollectObjKey(vXID)) return false; PostException(vXID, iCode); } //系统异常, 通知各个管理器进行存储 ObjMan* pManagerMan = GetObjMan(HSO_MANAGER); if (pManagerMan) { vXID.clear(); if (!pManagerMan->CollectObjKey(vXID)) return false; PostException(vXID, iCode); } return true; }
CAppObj* CApp::CreateObj(const XID& sXid, SID iSid) { if(!sXid.IsValid()) return 0; ObjMan* pObjMan = GetObjMan(sXid.Type); Assert(pObjMan); CAppObj* pObj = g_App->AppCreateObj(sXid); if (pObj) { if(pObjMan->AllocObject(sXid, pObj)) { if(iSid) BindSidXid(iSid, sXid); return pObj; } DEF_RELEASE(pObj); return 0; } Assert(false && "Create Obj Null."); return 0; }
CApp::ObjMan* CApp::CreateObjMan(UInt32 iType) { ObjMan* pObjMan = GetObjMan(iType); if (!pObjMan) { pObjMan = new ObjMan; m_mObjMan[iType] = pObjMan; } return pObjMan; }
Bool CApp::DeleteObj(const XID& sXid) { if (sXid.IsValid()) { ObjMan* pObjMan = GetObjMan(sXid.Type); Assert(pObjMan); return pObjMan->FreeObject(sXid); } return true; }
Bool HsGame::TickManagers() { ObjMan* pManagerMan = GetObjMan(HSO_MANAGER); if (pManagerMan) { static XIDVector vXID; vXID.clear(); if (!pManagerMan->CollectObjKey(vXID)) return false; return PostTick(vXID); } return false; }
Bool HsGame::TickPlayers() { ObjMan* pUserMan = GetObjMan(HSO_PLAYER); if (pUserMan) { static XIDVector vXID; vXID.clear(); if (!pUserMan->CollectObjKey(vXID)) return false; return PostTick(vXID); } return false; }