Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/* TODO : REMOVE HERE
|
||||
#include "stdafx.h"
|
||||
#include "ObjectInfo.h"
|
||||
|
||||
using namespace BroadcastInfo;
|
||||
|
||||
|
||||
CObjectInfo::CObjectInfo()
|
||||
: m_dwLastUpdateTick(0)
|
||||
{
|
||||
}
|
||||
|
||||
void CObjectInfo::Update(const SObject& object, unsigned long dwLastUpdateTick)
|
||||
{
|
||||
m_Object = object;
|
||||
m_dwLastUpdateTick = dwLastUpdateTick;
|
||||
}
|
||||
|
||||
|
||||
CAggresiveCreatureInfo::CAggresiveCreatureInfo()
|
||||
: m_nNowHP(0)
|
||||
{
|
||||
}
|
||||
|
||||
void CAggresiveCreatureInfo::Update(const SObject& object, unsigned long dwLastUpdateTick)
|
||||
{
|
||||
CObjectInfo::Update(object, dwLastUpdateTick);
|
||||
|
||||
if(IsAggresiveCreatureInfo(object.GetDataType()))
|
||||
{
|
||||
std::copy(static_cast<const SAggresiveCreature&>(object).m_EnchantInfo.m_dwStatusFlag,
|
||||
static_cast<const SAggresiveCreature&>(object).m_EnchantInfo.m_dwStatusFlag + EnchantInfo::MAX_ARRAY,
|
||||
m_EnchantInfo.m_dwStatusFlag);
|
||||
m_nNowHP = static_cast<const SAggresiveCreature&>(object).m_nNowHP;
|
||||
}
|
||||
}
|
||||
|
||||
CAggresiveCreatureInfo* CAggresiveCreatureInfo::DowncastToAggresiveCreatureInfo(CObjectInfo* lpObjectInfo)
|
||||
{
|
||||
return (NULL != lpObjectInfo && IsAggresiveCreatureInfo(lpObjectInfo->GetObjectType()))
|
||||
? static_cast<CAggresiveCreatureInfo*>(lpObjectInfo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
CMonsterInfo::CMonsterInfo()
|
||||
{
|
||||
}
|
||||
|
||||
void CMonsterInfo::Update(const SObject& object, unsigned long dwLastUpdateTick)
|
||||
{
|
||||
CAggresiveCreatureInfo::Update(object, dwLastUpdateTick);
|
||||
}
|
||||
|
||||
CMonsterInfo* CMonsterInfo::DowncastToMonsterInfo(CObjectInfo* lpObjectInfo)
|
||||
{
|
||||
return (NULL != lpObjectInfo && IsMonsterInfo(lpObjectInfo->GetObjectType()))
|
||||
? static_cast<CMonsterInfo*>(lpObjectInfo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
CSummonMonsterInfo::CSummonMonsterInfo()
|
||||
: m_dwMasterID(0)
|
||||
{
|
||||
}
|
||||
|
||||
void CSummonMonsterInfo::Update(const SObject& object, unsigned long dwLastUpdateTick)
|
||||
{
|
||||
CMonsterInfo::Update(object, dwLastUpdateTick);
|
||||
|
||||
if(IsSummonMonsterInfo(object.GetDataType()))
|
||||
{
|
||||
m_dwMasterID = static_cast<const Monster::SSummonMonster&>(object).m_dwMasterID;
|
||||
}
|
||||
}
|
||||
|
||||
CSummonMonsterInfo* CSummonMonsterInfo::DowncastToSummonMonsterInfo(CObjectInfo* lpObjectInfo)
|
||||
{
|
||||
return (NULL != lpObjectInfo && IsSummonMonsterInfo(lpObjectInfo->GetObjectType()))
|
||||
? static_cast<CSummonMonsterInfo*>(lpObjectInfo) : NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,123 @@
|
||||
/* TODO : REMOVE HERE
|
||||
#ifndef _OBJECT_INFO_H_
|
||||
#define _OBJECT_INFO_H_
|
||||
|
||||
#include <Network/Packet/PacketStruct/CharBroadcastPacket.h>
|
||||
|
||||
|
||||
namespace BroadcastInfo
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
class CObjectInfo;
|
||||
class CAggresiveCreatureInfo;
|
||||
class CMonsterInfo;
|
||||
class CSummonMonsterInfo;
|
||||
|
||||
// <20><><EFBFBD>ε<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD>
|
||||
struct IProcessBroadcastInfo
|
||||
{
|
||||
// <20><> ó<><C3B3> <20><>ƾ<EFBFBD><C6BE> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD> <20><>. Ÿ<>Կ<EFBFBD> <20><><EFBFBD>缭 <20>Լ<EFBFBD><D4BC><EFBFBD> ȣ<><C8A3><EFBFBD>ȴ<EFBFBD>.
|
||||
virtual void Process(CObjectInfo& objectInfo) = 0;
|
||||
virtual void Process(CAggresiveCreatureInfo& aggresiveCreatureInfo) = 0;
|
||||
virtual void Process(CMonsterInfo& monsterInfo) = 0;
|
||||
virtual void Process(CSummonMonsterInfo& monsterInfo) = 0;
|
||||
};
|
||||
|
||||
class CObjectInfo
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~CObjectInfo() { }
|
||||
virtual void Update(const SObject& object, unsigned long dwLastUpdateTick);
|
||||
virtual void Process(IProcessBroadcastInfo& processBroadcastInfo) { processBroadcastInfo.Process(*this); }
|
||||
|
||||
unsigned long GetCID() const { return m_Object.m_dwCID; }
|
||||
const CNetworkPos& GetNetworkPos() const { return m_Object.m_NetworkPos; }
|
||||
const ObjectType::Type GetObjectType() const { return m_Object.GetObjectType(); }
|
||||
unsigned long GetLastUpdateTick() const { return m_dwLastUpdateTick; }
|
||||
|
||||
struct LessCID
|
||||
{
|
||||
bool operator () (const BroadcastInfo::CObjectInfo& lhs, const BroadcastInfo::CObjectInfo& rhs) { return lhs.GetCID() < rhs.GetCID(); }
|
||||
bool operator () (const BroadcastInfo::CObjectInfo& lhs, unsigned long dwCID) { return lhs.GetCID() < dwCID; }
|
||||
bool operator () (unsigned long dwCID, const BroadcastInfo::CObjectInfo& rhs) { return dwCID < rhs.GetCID(); }
|
||||
|
||||
bool operator () (const BroadcastInfo::CObjectInfo* lhs, const BroadcastInfo::CObjectInfo* rhs) { return lhs->GetCID() < rhs->GetCID(); }
|
||||
bool operator () (const BroadcastInfo::CObjectInfo* lhs, unsigned long dwCID) { return lhs->GetCID() < dwCID; }
|
||||
bool operator () (unsigned long dwCID, const BroadcastInfo::CObjectInfo* rhs) { return dwCID < rhs->GetCID(); }
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
CObjectInfo();
|
||||
|
||||
SObject m_Object;
|
||||
unsigned long m_dwLastUpdateTick;
|
||||
|
||||
friend class CObjectInfoMgr;
|
||||
};
|
||||
|
||||
|
||||
class CAggresiveCreatureInfo : public CObjectInfo
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Update(const SObject& object, unsigned long dwLastUpdateTick);
|
||||
virtual void Process(IProcessBroadcastInfo& processBroadcastInfo) { processBroadcastInfo.Process(*this); }
|
||||
|
||||
unsigned short GetNowHP() { return m_nNowHP; }
|
||||
EnchantInfo& GetEnchantInfo() { return m_EnchantInfo; }
|
||||
|
||||
static CAggresiveCreatureInfo* DowncastToAggresiveCreatureInfo(CObjectInfo* lpObjectInfo);
|
||||
|
||||
protected:
|
||||
|
||||
CAggresiveCreatureInfo();
|
||||
|
||||
EnchantInfo m_EnchantInfo;
|
||||
unsigned short m_nNowHP;
|
||||
|
||||
friend class CObjectInfoMgr;
|
||||
};
|
||||
|
||||
|
||||
class CMonsterInfo : public CAggresiveCreatureInfo
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Update(const SObject& object, unsigned long dwLastUpdateTick);
|
||||
virtual void Process(IProcessBroadcastInfo& processBroadcastInfo) { processBroadcastInfo.Process(*this); }
|
||||
|
||||
static CMonsterInfo* DowncastToMonsterInfo(CObjectInfo* lpObjectInfo);
|
||||
|
||||
protected:
|
||||
|
||||
CMonsterInfo();
|
||||
|
||||
friend class CObjectInfoMgr;
|
||||
};
|
||||
|
||||
|
||||
class CSummonMonsterInfo : public CMonsterInfo
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Update(const SObject& object, unsigned long dwLastUpdateTick);
|
||||
virtual void Process(IProcessBroadcastInfo& processBroadcastInfo) { processBroadcastInfo.Process(*this); }
|
||||
|
||||
unsigned long GetMasterID() { return m_dwMasterID; }
|
||||
|
||||
static CSummonMonsterInfo* DowncastToSummonMonsterInfo(CObjectInfo* lpObjectInfo);
|
||||
|
||||
protected:
|
||||
|
||||
CSummonMonsterInfo();
|
||||
|
||||
unsigned long m_dwMasterID;
|
||||
|
||||
friend class CObjectInfoMgr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -0,0 +1,101 @@
|
||||
/* TODO : REMOVE HERE
|
||||
#include "stdafx.h"
|
||||
#include "ObjectInfoFactory.h"
|
||||
|
||||
#include <Creature/AggresiveCreature.h>
|
||||
#include <Creature/Character/Character.h>
|
||||
#include <Creature/Monster/Monster.h>
|
||||
#include <Creature/Monster/PatternMonster.h>
|
||||
|
||||
#include <Community/Guild/GuildMgr.h>
|
||||
#include <Community/Guild/Guild.h>
|
||||
|
||||
using namespace BroadcastInfo;
|
||||
|
||||
bool BroadcastInfo::SerializeOutAggresiveCreatureInfo(CAggresiveCreature& AggresiveCreature, DataType::Type eDataType,
|
||||
char* szBuffer_Out, unsigned long& dwBufferSize_InOut)
|
||||
{
|
||||
// <20>⺻ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||||
unsigned long dwObjectSize = GetObjectSize(eDataType);
|
||||
|
||||
if (0 != dwObjectSize && dwObjectSize <= dwBufferSize_InOut)
|
||||
{
|
||||
const Position& Pos = AggresiveCreature.GetCurrentPos();
|
||||
|
||||
SObject* lpObjectInfo = new (szBuffer_Out) SObject(AggresiveCreature.GetCID());
|
||||
|
||||
const MotionInfo& motionInfo = AggresiveCreature.GetMotionInfo();
|
||||
|
||||
lpObjectInfo->m_NetworkPos.Initialize(Pos.m_fPointX, Pos.m_fPointY, Pos.m_fPointZ,
|
||||
motionInfo.m_fDirection, (0 == motionInfo.m_dwFrame) ? 0.0f : motionInfo.m_fVelocity / motionInfo.m_dwFrame);
|
||||
|
||||
lpObjectInfo->SetObjectType(ObjectType::AGGRESIVE_CREATURE);
|
||||
lpObjectInfo->SetDataType(eDataType);
|
||||
|
||||
if (IsAggresiveCreatureInfo(eDataType))
|
||||
{
|
||||
SAggresiveCreature* lpAggresiveCreatureInfo = static_cast<SAggresiveCreature*>(lpObjectInfo);
|
||||
std::copy(AggresiveCreature.GetEnchantInfo().m_dwStatusFlag,
|
||||
AggresiveCreature.GetEnchantInfo().m_dwStatusFlag + EnchantInfo::MAX_ARRAY,
|
||||
lpAggresiveCreatureInfo->m_EnchantInfo.m_dwStatusFlag);
|
||||
lpAggresiveCreatureInfo->m_nNowHP = AggresiveCreature.GetStatus().m_nNowHP;
|
||||
}
|
||||
|
||||
dwBufferSize_InOut = dwObjectSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
dwBufferSize_InOut = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool BroadcastInfo::SerializeOutMonsterInfo(CMonster& Monster, DataType::Type eDataType,
|
||||
char* szBuffer_Out, unsigned long& dwBufferSize_InOut)
|
||||
{
|
||||
if (BroadcastInfo::SerializeOutAggresiveCreatureInfo(Monster, eDataType, szBuffer_Out, dwBufferSize_InOut))
|
||||
{
|
||||
SObject* lpObjectInfo = reinterpret_cast<SObject*>(szBuffer_Out);
|
||||
lpObjectInfo->SetObjectType(ObjectType::MONSTER);
|
||||
|
||||
if (IsMonsterInfo(eDataType))
|
||||
{
|
||||
Monster::SMonster* lpMonsterInfo = static_cast<Monster::SMonster*>(lpObjectInfo);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool BroadcastInfo::SerializeOutSummonMonsterInfo(CSummonMonster& SummonMonster, DataType::Type eDataType,
|
||||
char* szBuffer_Out, unsigned long& dwBufferSize_InOut)
|
||||
{
|
||||
if (BroadcastInfo::SerializeOutMonsterInfo(SummonMonster, eDataType, szBuffer_Out, dwBufferSize_InOut))
|
||||
{
|
||||
SObject* lpObjectInfo = reinterpret_cast<SObject*>(szBuffer_Out);
|
||||
|
||||
if (IsSummonMonsterInfo(eDataType))
|
||||
{
|
||||
Monster::SSummonMonster* lpSummonMonsterInfo = static_cast<Monster::SSummonMonster*>(lpObjectInfo);
|
||||
|
||||
CCharacter* lpMaster = SummonMonster.GetMaster();
|
||||
if (NULL == lpMaster)
|
||||
{
|
||||
// <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF> <20><>ȯ<EFBFBD><C8AF>
|
||||
return true;
|
||||
}
|
||||
|
||||
lpSummonMonsterInfo->m_dwMasterID = lpMaster->GetCID();
|
||||
}
|
||||
|
||||
lpObjectInfo->SetObjectType(ObjectType::SUMMON_MONSTER);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,30 @@
|
||||
/* TODO : REMOVE HERE
|
||||
#ifndef _OBJECT_INFO_FACTORY_H_
|
||||
#define _OBJECT_INFO_FACTORY_H_
|
||||
|
||||
|
||||
#include <Network/Packet/PacketStruct/CharBroadcastPacket.h>
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
class CAggresiveCreature;
|
||||
class CCharacter;
|
||||
class CMonster;
|
||||
class CSummonMonster;
|
||||
|
||||
|
||||
namespace BroadcastInfo
|
||||
{
|
||||
bool SerializeOutAggresiveCreatureInfo(CAggresiveCreature& AggresiveCreature,
|
||||
DataType::Type eDataType, char* szBuffer_Out, unsigned long& dwBufferSize_InOut);
|
||||
|
||||
bool SerializeOutMonsterInfo(CMonster& Monster,
|
||||
DataType::Type eDataType, char* szBuffer_Out, unsigned long& dwBufferSize_InOut);
|
||||
|
||||
bool SerializeOutSummonMonsterInfo(CSummonMonster& SummonMonster,
|
||||
DataType::Type eDataType, char* szBuffer_Out, unsigned long& dwBufferSize_InOut);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -0,0 +1,204 @@
|
||||
/* TODO : REMOVE HERE
|
||||
#include "stdafx.h"
|
||||
#include "ObjectInfo.h"
|
||||
#include "ObjectInfoMgr.h"
|
||||
#include <algorithm>
|
||||
#include <mmsystem.h>
|
||||
|
||||
|
||||
using namespace BroadcastInfo;
|
||||
|
||||
|
||||
CObjectInfo* CObjectInfoMgr::Create(const SObject& object)
|
||||
{
|
||||
CObjectInfo* lpNewObjectInfo = NULL;
|
||||
|
||||
switch(object.GetObjectType())
|
||||
{
|
||||
case ObjectType::OBJECT: lpNewObjectInfo = new CObjectInfo; break;
|
||||
case ObjectType::AGGRESIVE_CREATURE: lpNewObjectInfo = new CAggresiveCreatureInfo; break;
|
||||
case ObjectType::MONSTER: lpNewObjectInfo = new CMonsterInfo; break;
|
||||
case ObjectType::SUMMON_MONSTER: lpNewObjectInfo = new CSummonMonsterInfo; break;
|
||||
// case ObjectType::CHARACTER: lpNewObjectInfo = new CCharacterInfo; break;
|
||||
}
|
||||
|
||||
return lpNewObjectInfo;
|
||||
}
|
||||
|
||||
|
||||
CObjectInfoMgr::~CObjectInfoMgr()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void CObjectInfoMgr::clear()
|
||||
{
|
||||
ObjectIterator first = m_ObjectArray.begin(), last = m_ObjectArray.end();
|
||||
|
||||
for(;first != last; ++first)
|
||||
{
|
||||
delete (*first);
|
||||
}
|
||||
|
||||
m_ObjectArray.clear();
|
||||
|
||||
}
|
||||
|
||||
bool CObjectInfoMgr::Update(const char* szBuffer_In, unsigned long dwBufferSize, bool bRemove)
|
||||
{
|
||||
const char* szObjectInfo = szBuffer_In;
|
||||
const char* szPastEnd = szBuffer_In + dwBufferSize;
|
||||
|
||||
unsigned long dwCurrentTime = timeGetTime();
|
||||
|
||||
for(; szObjectInfo + sizeof(SObject) <= szPastEnd; )
|
||||
{
|
||||
const SObject* lpSObject = reinterpret_cast<const SObject*>(szObjectInfo);
|
||||
CObjectInfo* lpUpdateObjectInfo = NULL;
|
||||
CObjectInfo* lpNewObjectInfo = NULL;
|
||||
|
||||
ObjectIterator finditr = std::lower_bound(m_ObjectArray.begin(), m_ObjectArray.end(),
|
||||
lpSObject->m_dwCID, CObjectInfo::LessCID());
|
||||
|
||||
if(finditr != m_ObjectArray.end() && lpSObject->m_dwCID == (*finditr)->GetCID())
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><>.
|
||||
lpUpdateObjectInfo = *finditr;
|
||||
}
|
||||
|
||||
if(NULL != lpUpdateObjectInfo)
|
||||
{
|
||||
lpUpdateObjectInfo->Update(*lpSObject, dwCurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpNewObjectInfo = Create(*lpSObject);
|
||||
|
||||
if(NULL != lpNewObjectInfo)
|
||||
{
|
||||
lpNewObjectInfo->Update(*lpSObject, dwCurrentTime);
|
||||
m_ObjectArray.insert(finditr, lpNewObjectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long dwObjectSize = GetObjectSize(*lpSObject);
|
||||
if(0 == dwObjectSize)
|
||||
{
|
||||
// <20>߸<EFBFBD><DFB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>.
|
||||
break;
|
||||
}
|
||||
|
||||
szObjectInfo += dwObjectSize;
|
||||
}
|
||||
|
||||
if(bRemove)
|
||||
{
|
||||
Eliminate(dwCurrentTime);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CObjectInfoMgr::Process(IProcessBroadcastInfo& processBroadcastInfo)
|
||||
{
|
||||
ObjectIterator first = m_ObjectArray.begin(), last = m_ObjectArray.end();
|
||||
for(;first != last; ++first)
|
||||
{
|
||||
(*first)->Process(processBroadcastInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
CObjectInfo* CObjectInfoMgr::GetObjectInfo(unsigned long dwCID)
|
||||
{
|
||||
ObjectIterator finditr = std::lower_bound(m_ObjectArray.begin(), m_ObjectArray.end(),
|
||||
dwCID, CObjectInfo::LessCID());
|
||||
|
||||
if(finditr != m_ObjectArray.end() && dwCID == (*finditr)->GetCID())
|
||||
{
|
||||
return *finditr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
CObjectInfo* CObjectInfoMgr::CreateOrUpdate(const SObject& object, unsigned long dwCurrentTime)
|
||||
{
|
||||
CObjectInfo* lpObjectInfo = NULL;
|
||||
|
||||
ObjectIterator finditr = std::lower_bound(m_ObjectArray.begin(), m_ObjectArray.end(),
|
||||
object.m_dwCID, CObjectInfo::LessCID());
|
||||
|
||||
if(finditr != m_ObjectArray.end() && object.m_dwCID == (*finditr)->GetCID())
|
||||
{
|
||||
lpObjectInfo = *finditr;
|
||||
lpObjectInfo->Update(object, dwCurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpObjectInfo = Create(object);
|
||||
if(NULL != lpObjectInfo)
|
||||
{
|
||||
lpObjectInfo->Update(object, dwCurrentTime);
|
||||
m_ObjectArray.insert(finditr, lpObjectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return lpObjectInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CObjectInfoMgr::Remove(unsigned long dwCID)
|
||||
{
|
||||
ObjectIterator finditr = std::lower_bound(m_ObjectArray.begin(), m_ObjectArray.end(),
|
||||
dwCID, CObjectInfo::LessCID());
|
||||
|
||||
if(finditr != m_ObjectArray.end() && dwCID == (*finditr)->GetCID())
|
||||
{
|
||||
CObjectInfo* lpObjectInfo = *finditr;
|
||||
delete lpObjectInfo;
|
||||
|
||||
m_ObjectArray.erase(finditr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CObjectInfoMgr::Eliminate(unsigned long dwExceptTime)
|
||||
{
|
||||
// <20>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD>ŵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20>ƴϸ<C6B4> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
ObjectArray objectArray;
|
||||
objectArray.reserve(m_ObjectArray.size());
|
||||
|
||||
ObjectIterator first = m_ObjectArray.begin();
|
||||
ObjectIterator last = m_ObjectArray.end();
|
||||
|
||||
for(;first != last; ++first)
|
||||
{
|
||||
CObjectInfo* lpObjectInfo = *first;
|
||||
|
||||
if(dwExceptTime == lpObjectInfo->GetLastUpdateTick())
|
||||
{
|
||||
objectArray.push_back(lpObjectInfo);
|
||||
*first = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_ObjectArray.swap(objectArray);
|
||||
|
||||
for(first = objectArray.begin(), last = objectArray.end(); first != last; ++first)
|
||||
{
|
||||
CObjectInfo* lpObjectInfo = *first;
|
||||
if(NULL != lpObjectInfo)
|
||||
{
|
||||
delete lpObjectInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,48 @@
|
||||
/* TODO : REMOVE HERE
|
||||
|
||||
#ifndef _BROADCAST_PACKET_H
|
||||
#define _BROADCAST_PACKET_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace BroadcastInfo
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
struct SObject;
|
||||
class CObjectInfo;
|
||||
struct IProcessBroadcastInfo;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20>˻<EFBFBD>, Iteration<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
|
||||
class CObjectInfoMgr
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<CObjectInfo*> ObjectArray;
|
||||
typedef ObjectArray::iterator ObjectIterator;
|
||||
|
||||
CObjectInfoMgr() { }
|
||||
virtual ~CObjectInfoMgr();
|
||||
|
||||
bool Update(const char* szBuffer_In, unsigned long dwBufferSize, bool bRemove = true);
|
||||
void Process(IProcessBroadcastInfo& processBroadcastInfo);
|
||||
CObjectInfo* GetObjectInfo(unsigned long dwCID);
|
||||
unsigned long GetObjectNum() { return static_cast<unsigned long>(m_ObjectArray.size()); }
|
||||
|
||||
CObjectInfo* CreateOrUpdate(const SObject& object, unsigned long dwCurrentTime);
|
||||
void Remove(unsigned long dwCID);
|
||||
|
||||
ObjectIterator begin() { return m_ObjectArray.begin(); }
|
||||
ObjectIterator end() { return m_ObjectArray.end(); }
|
||||
void clear();
|
||||
|
||||
private:
|
||||
|
||||
void Eliminate(unsigned long dwExceptTime);
|
||||
|
||||
CObjectInfo* Create(const SObject& object);
|
||||
ObjectArray m_ObjectArray;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
Reference in New Issue
Block a user