📄 regenlocation.cpp
字号:
#include "stdafx.h"
#include "RegenLocation.h"
#include "RegenParser.h"
#include "ObjectGroupManager.h"
RegenLocation::RegenLocation() : m_pRegenInfo(NULL), m_dwAreaKey(0)
{
}
RegenLocation::~RegenLocation()
{
}
VOID RegenLocation::Init( REGEN_INFO *pRegenInfo, DWORD dwAreaKey )
{
SetRegenInfo( pRegenInfo );
m_dwAreaKey = dwAreaKey;
for( int i = 0; i < MAX_REGEN_MONSTER_KIND; ++i )
{
m_mapAliveNPC.insert( ALIVE_NPC_MAP_PAIR(pRegenInfo->dwMonCode[i], 0) );
}
/*
// Group阑 积己茄饶 Manager俊 眠啊茄促.
memset( m_pObjectGroup, 0, sizeof(ObjectGroup*) * MAX_OBJECTGROUP_PER_AREA );
for( i = 0; i < MAX_OBJECTGROUP_PER_AREA; ++i )
{
if( !pRegenInfo->dwGroupID[i] ) continue;
m_pObjectGroup[0] = ObjectGroupManager::Instance()->AllocGroup( pRegenInfo->dwLocationID, pRegenInfo->dwGroupID[i] );
}
*/
}
VOID RegenLocation::Release()
{
m_mapAliveNPC.clear();
/*
// Group阑 昏力茄促.
for( int i = 0; i < MAX_OBJECTGROUP_PER_AREA; ++i )
{
if( m_pObjectGroup[i] )
{
ObjectGroupManager::Instance()->RemoveGroup( m_pObjectGroup[i] );
}
}
*/
m_pRegenInfo = NULL;
}
DWORD RegenLocation::GetNumberOfAliveNPCs( DWORD dwNPCCode )
{
ALIVE_NPC_MAP_ITER it = m_mapAliveNPC.find( dwNPCCode );
SASSERT( it != m_mapAliveNPC.end(), "[RegenLocation::GetNumberOfAliveNPCs] it == m_mapAliveNPC.end()" );
return it->second;
}
VOID RegenLocation::IncreaseNPC( DWORD dwNPCCode, DWORD dwNum )
{
ALIVE_NPC_MAP_ITER it = m_mapAliveNPC.find( dwNPCCode );
if ( it != m_mapAliveNPC.end() )
{
it->second += dwNum;
}
}
VOID RegenLocation::DecreaseNPC( DWORD dwNPCCode, DWORD dwNum )
{
ALIVE_NPC_MAP_ITER it = m_mapAliveNPC.find( dwNPCCode );
// 捞亥飘侩栏肺 烙狼肺 积己等 各档 乐阑 荐 乐栏聪.. 乐绰 版快父 函版
if ( it != m_mapAliveNPC.end() )
{
it->second -= dwNum;
}
}
ObjectGroup* RegenLocation::JoinGroup( NPC* pNPC )
{
// LinkInfo俊辑 傅农矫难具且 阁胶磐狼 格废苞 泅犁 弊缝狼 阁胶磐 格废阑 厚背秦辑
// 何练茄 何盒俊 措秦辑 pNPC甫 弊缝俊 殿废茄促.
for( int i = 0; i < MAX_OBJECTGROUP_PER_AREA; ++i )
{
if( !m_pObjectGroup[i] ) continue;
// Group俊 秦寸窍绰 后 磊府啊 乐栏搁 眠啊茄促.
if( m_pObjectGroup[i]->AddObject( NPC_OBJECT, pNPC, pNPC->GetBaseInfo()->m_MonsterCode ) )
{
return m_pObjectGroup[i];
}
}
return NULL;
}
DWORD RegenLocation::GetRandomAreaKey()
{
// 罚待窍霸 积己登绰 阁胶磐(府歹)牢 版快
int iMaxIndex = m_vecAreaKeys.size() - 1;
int iSelectIndex = random( 0, iMaxIndex );
return m_vecAreaKeys[iSelectIndex];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -