rx<0 || rz<0 || rx>=m_nXRegion || rz>=m_nZRegion
RegionNpcAdd(int rx, int rz, int nid) ' this using add monster to map, x coor, y coor and nid ( monster or npc id )
why to error?[/font]
void C3DMap::RegionNpcAdd(int rx, int rz, int nid)
{
if( rx<0 || rz<0 || rx>=m_nXRegion || rz>=m_nZRegion )
return;
int *pInt = NULL;
EnterCriticalSection( &g_region_critical );
pInt = new int;
*pInt = nid;
m_ppRegion[rx][rz].m_RegionNpcArray.PutData( nid, pInt );
LeaveCriticalSection( &g_region_critical );
}
[font="Verdana"]And its npc and monster remove it's work successfully.[/font]
Iterator C3DMap::RegionNpcRemove(int rx, int rz, int nid)
{
if( rx<0 || rz<0 || rx>=m_nXRegion || rz>=m_nZRegion )
return FALSE;
CRegion *region = NULL;
map < int, int* >::iterator Iter;
EnterCriticalSection( &g_region_critical );
region = &m_ppRegion[rx][rz];
Iter = region->m_RegionNpcArray.DeleteData( nid );
LeaveCriticalSection( &g_region_critical );
return Iter;
}
[font="Verdana"]sorry my poor english.[/font]