DX8 Sdk Region Error.

Started by
1 comment, last by Efe 12 years, 8 months ago
[font="Verdana"]This code giving close error @
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]
Advertisement
i dont see why that s causeing the error.

what about entering the criticle section before doing any locations.

maybe add ('s and )'s to you logic.
:) :) ;)

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

may be y coordiant or client x,y returned value error?

This topic is closed to new replies.

Advertisement