Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
- {
- if (!(item = m_apItems[i]))
- continue;
- if (item->IsDragonSoul())
- {
- if (!victim->DragonSoul_IsQualified())
- {
- return false;
- }
- if (!bDSInitialized)
- {
- bDSInitialized = true;
- victim->CopyDragonSoulItemGrid(s_vDSGrid);
- }
- bool bExistEmptySpace = false;
- WORD wBasePos = DSManager::instance().GetBasePosition(item);
- if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
- return false;
- for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
- {
- WORD wPos = wBasePos + i;
- if (0 == s_vDSGrid[wBasePos])
- {
- bool bEmpty = true;
- for (int j = 1; j < item->GetSize(); j++)
- {
- if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
- {
- bEmpty = false;
- break;
- }
- }
- if (bEmpty)
- {
- for (int j = 0; j < item->GetSize(); j++)
- {
- s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1;
- }
- bExistEmptySpace = true;
- break;
- }
- }
- if (bExistEmptySpace)
- break;
- }
- if (!bExistEmptySpace)
- return false;
- }
- else
- {
- int iPos = s_grid1.FindBlank(1, item->GetSize());
- if (iPos >= 0)
- {
- s_grid1.Put(iPos, 1, item->GetSize());
- }
- else
- {
- iPos = s_grid2.FindBlank(1, item->GetSize());
- if (iPos >= 0)
- {
- s_grid2.Put(iPos, 1, item->GetSize());
- }
- else
- {
- return false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement