📄 cell.cpp
字号:
DWORD dwDN = 0;
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
CPoint ptCell;
pUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pUser == NULL || pUser->m_state != STATE_GAMESTARTED || pUser->m_curz != m_Zone) return;
if(pUser->m_NowZoneChanging) bZoneChanging = TRUE;
for(nX = -1; nX <= 1; nX++)
{
for(nY = -1; nY <= 1; nY++)
{
cx = pt.x + nX;
cy = pt.y + nY;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
m_pCell[cx][cy].GetItem(arCellItem); // 甘惑俊辑狼 酒捞袍 困摹甫...
iSize = arCellItem.GetSize(); // 茄 伎俊辑狼 酒捞袍 困摹 荐
if(!bZoneChanging)
{
for(i = 0; i < iSize; i++) // 葛电 酒捞袍 困摹沥焊甫 焊辰促.
{
dwDN = 0;
ptCell = arCellItem[i];
if(!GetViewMapItemList(arMapItem, dwDN, ptCell, pUser->m_ZoneIndex)) continue;
if(dwDN > 0) pUser->GetMapMoneyInfo(dwDN, ptCell);
// if(arMapItem.GetSize() > 0) pUser->GetMapItemInfo(arMapItem, ptCell, -1, ITEM_INFO_DEL);
arMapItem.RemoveAll();
}
}
for(i = 0; i < nSize; i++)
{
nUid = arUid.GetAt(i);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendUserInfo(pUser, INFO_DELETE); // Other <- Me
if(!bZoneChanging) pUser->SendUserInfo(pSendUser, INFO_DELETE); // Other -> Me
}
if(nUid >= NPC_BAND)
{
pNpc = pUser->GetNpc(nUid - NPC_BAND);
if(!pNpc) continue;
if(!bZoneChanging) pUser->SendNpcInfo(pNpc, INFO_DELETE); // 粮眉牢瘤啊 绝阑锭父 焊辰促.
}
}
}
}
}
else if(nUid >= NPC_BAND)
{
pNpc = GetNpc(nUid - NPC_BAND);
if(pNpc == NULL) return;
for(nX = -1; nX <= 1; nX++)
{
for(nY = -1; nY <= 1; nY++)
{
cx = pt.x + nX;
cy = pt.y + nY;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(i = 0; i < nSize; i++)
{
nUid = arUid.GetAt(i);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendNpcInfo(pNpc, INFO_DELETE);
// TRACE("Delete Cell\n");
}
}
}
}
}
arUid.RemoveAll();
}
/////////////////////////////////////////////////////////////////////////
// User 唱 NPC 狼 矫具(Cell)捞 函版灯阑 版快狼 贸府
//
void CELL::ChangeCell(CPoint ptOld, CPoint ptNew, int nUid)
{
CCellItemArray arCellItem;
ItemInfoArray arMapItem;
arMapItem.RemoveAll();
// Delete User ID at Old Cell
m_pCell[ptOld.x][ptOld.y].Delete(nUid);
// Add User ID to New Cell
m_pCell[ptNew.x][ptNew.y].Add(nUid);
// Get Direction
int nDirection = GetDirection(ptOld.x, ptOld.y, ptNew.x, ptNew.y);
ASSERT(nDirection >= 1 && nDirection <= 8);
CCellUidArray arUid;
USER* pUser = NULL;
USER* pSendUser = NULL;
CNpc* pNpc = NULL;
int nSize = 0, iSize = 0;
int i, j;
int cx, cy;
DWORD dwDN = 0;
CPoint ptCell;
BOOL bZoneChanging = FALSE;
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pUser == NULL || pUser->m_state != STATE_GAMESTARTED || pUser->m_curz != m_Zone) return;
int nD = nDirection - 1;
int xx = 0, yy = 0;
for(i = 0; i < 5; i++)
{
if(g_add[nD][i].x == 100) break;
// Add ...
xx = g_add[nD][i].x;
yy = g_add[nD][i].y;
cx = ptOld.x + xx;
cy = ptOld.y + yy;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].GetItem(arCellItem); // 甘惑俊辑狼 酒捞袍 困摹甫...
iSize = arCellItem.GetSize(); // 茄 伎俊辑狼 酒捞袍 困摹 荐
for(j = 0; j < iSize; j++) // 葛电 酒捞袍 困摹沥焊甫 焊辰促.
{
dwDN = 0;
ptCell = arCellItem[j];
if(!GetViewMapItemList(arMapItem, dwDN, ptCell, pUser->m_ZoneIndex)) continue;
if(dwDN > 0) pUser->GetMapMoneyInfo(dwDN, ptCell);
// if(arMapItem.GetSize() > 0) pUser->GetMapItemInfo(arMapItem, ptCell, -1, ITEM_INFO_MODIFY);
arMapItem.RemoveAll();
}
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(j = 0; j < nSize; j++)
{
nUid = arUid.GetAt(j);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendUserInfo(pUser, INFO_MODIFY); // Other <- Me
pUser->SendUserInfo(pSendUser, INFO_MODIFY); // Other -> Me
}
if(nUid >= NPC_BAND)
{
pNpc = pUser->GetNpc(nUid - NPC_BAND);
if(!pNpc) continue;
pUser->SendNpcInfo(pNpc, INFO_MODIFY);
}
}
}
if(pUser->m_NowZoneChanging) bZoneChanging = TRUE;
for(i = 0; i < 5; i++)
{
if(g_add[nD][i].x == 100) break;
// Del ...
xx = g_del[nD][i].x;
yy = g_del[nD][i].y;
cx = ptOld.x + xx;
cy = ptOld.y + yy;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].GetItem(arCellItem); // 甘惑俊辑狼 酒捞袍 困摹甫...
iSize = arCellItem.GetSize(); // 茄 伎俊辑狼 酒捞袍 困摹 荐
if(!bZoneChanging)
{
for(j = 0; j < iSize; j++) // 葛电 酒捞袍 困摹沥焊甫 焊辰促.
{
dwDN = 0;
ptCell = arCellItem[j];
if(!GetViewMapItemList(arMapItem, dwDN, ptCell, pUser->m_ZoneIndex)) continue;
if(dwDN > 0) pUser->GetMapMoneyInfo(dwDN, ptCell);
// if(arMapItem.GetSize() > 0) pUser->GetMapItemInfo(arMapItem, ptCell, -1, ITEM_INFO_DEL);
arMapItem.RemoveAll();
}
}
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(j = 0; j < nSize; j++)
{
nUid = arUid.GetAt(j);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendUserInfo(pUser, INFO_DELETE); // Other <- Me
pUser->SendUserInfo(pSendUser, INFO_DELETE); // Other -> Me
}
if(nUid >= NPC_BAND)
{
pNpc = pUser->GetNpc(nUid - NPC_BAND);
if(!pNpc) continue;
pUser->SendNpcInfo(pNpc, INFO_DELETE);
}
}
}
}
else if(nUid >= NPC_BAND)
{
pNpc = GetNpc(nUid - NPC_BAND);
if(pNpc == NULL) return;
int nD = nDirection - 1;
int xx = 0, yy = 0;
for(i = 0; i < 5; i++)
{
if(g_add[nD][i].x == 100) break;
// Add ...
xx = g_add[nD][i].x;
yy = g_add[nD][i].y;
cx = ptOld.x + xx;
cy = ptOld.y + yy;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(j = 0; j < nSize; j++)
{
nUid = arUid.GetAt(j);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendNpcInfo(pNpc, INFO_MODIFY);
}
}
}
for(i = 0; i < 5; i++)
{
if(g_add[nD][i].x == 100) break;
// Del ...
xx = g_del[nD][i].x;
yy = g_del[nD][i].y;
cx = ptOld.x + xx;
cy = ptOld.y + yy;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(j = 0; j < nSize; j++)
{
nUid = arUid.GetAt(j);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->SendNpcInfo(pNpc, INFO_DELETE);
}
}
}
}
arUid.RemoveAll();
}
////////////////////////////////////////////////////////////////////////
// Cell俊 甘俊辑狼 酒捞袍 昏力甫 葛电 蜡历俊霸 舅赴促.
//
void CELL::DeleteItemCell(CPoint pt, CPoint MapPt) // 伎谅钎, 甘谅钎
{
/* CCellUidArray arUid;
ItemListArray arItem;
USER* pSendUser = NULL;
USER* pUser = NULL;
CPoint iCurpt;
int nSize = 0;
int i, nX, nY;
int cx, cy;
int nUid = 0;
for(nX = -1; nX <= 1; nX++) // 9伎 荤捞俊 乐绰 蜡历俊霸 沥焊傈价
{
for(nY = -1; nY <= 1; nY++)
{
cx = pt.x + nX;
cy = pt.y + nY;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(i = 0; i < nSize; i++)
{
nUid = arUid.GetAt(i);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->user_array[nUid - USER_BAND];
if(pSendUser == NULL || pSendUser->m_state != STATE_GAMESTARTED || pSendUser->m_curz != m_Zone) continue;
pSendUser->GetMapItemInfo(arItem, FALSE, MapPt, ITEM_INFO_ALL_DELETE);
}
}
}
}
arItem.RemoveAll();
arUid.RemoveAll();
*/
}
////////////////////////////////////////////////////////////////////////
// Cell俊 甘俊辑狼 酒捞袍 谅钎昏力.
//
void CELL::DeleteCellCoordinate(CPoint ptCell, CPoint pt)
{
m_pCell[ptCell.x][ptCell.y].DeleteItem(pt);
}
////////////////////////////////////////////////////////////////////////
// Cell俊 甘俊辑狼 酒捞袍 函拳甫 葛电 蜡历俊霸 舅赴促.
//
void CELL::ChangeItemCell(ItemListArray &arItem, CPoint pt, CPoint ptMap, int uid)//(伎谅钎, 甘谅钎)
{
CCellUidArray arUid;
USER* pSendUser = NULL;
// USER* pUser = NULL;
int nSize = 0;
int i, nX, nY;
int cx, cy;
int nUid = 0;
for(nX = -1; nX <= 1; nX++) // 9伎 荤捞俊 乐绰 蜡历俊霸 沥焊傈价
{
for(nY = -1; nY <= 1; nY++)
{
cx = pt.x + nX;
cy = pt.y + nY;
if(cx < 0 || cx >= m_sizeCell.cx) continue;
if(cy < 0 || cy >= m_sizeCell.cy) continue;
m_pCell[cx][cy].Get(arUid);
nSize = arUid.GetSize();
for(i = 0; i < nSize; i++)
{
nUid = arUid.GetAt(i);
if(nUid >= USER_BAND && nUid < NPC_BAND)
{
pSendUser = m_pCom->GetUserUid(nUid - USER_BAND);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -