Sign in to follow this  

DX8 Sdk Region Error.

This topic is 2318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[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]
[code]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 );
}[/code]


[font="Verdana"]And its npc and monster remove it's work successfully.[/font]


[code]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;
}[/code]


[font="Verdana"]sorry my poor english.[/font]

Share this post


Link to post
Share on other sites

This topic is 2318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this