Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
  2. {
  3. if (!(item = m_apItems[i]))
  4. continue;
  5.  
  6. if (item->IsDragonSoul())
  7. {
  8. if (!victim->DragonSoul_IsQualified())
  9. {
  10. return false;
  11. }
  12.  
  13. if (!bDSInitialized)
  14. {
  15. bDSInitialized = true;
  16. victim->CopyDragonSoulItemGrid(s_vDSGrid);
  17. }
  18.  
  19. bool bExistEmptySpace = false;
  20. WORD wBasePos = DSManager::instance().GetBasePosition(item);
  21. if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
  22. return false;
  23.  
  24. for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
  25. {
  26. WORD wPos = wBasePos + i;
  27. if (0 == s_vDSGrid[wBasePos])
  28. {
  29. bool bEmpty = true;
  30. for (int j = 1; j < item->GetSize(); j++)
  31. {
  32. if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
  33. {
  34. bEmpty = false;
  35. break;
  36. }
  37. }
  38. if (bEmpty)
  39. {
  40. for (int j = 0; j < item->GetSize(); j++)
  41. {
  42. s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1;
  43. }
  44. bExistEmptySpace = true;
  45. break;
  46. }
  47. }
  48. if (bExistEmptySpace)
  49. break;
  50. }
  51. if (!bExistEmptySpace)
  52. return false;
  53. }
  54. else
  55. {
  56. int iPos = s_grid1.FindBlank(1, item->GetSize());
  57.  
  58. if (iPos >= 0)
  59. {
  60. s_grid1.Put(iPos, 1, item->GetSize());
  61. }
  62. else
  63. {
  64. iPos = s_grid2.FindBlank(1, item->GetSize());
  65.  
  66. if (iPos >= 0)
  67. {
  68. s_grid2.Put(iPos, 1, item->GetSize());
  69. }
  70. else
  71. {
  72. return false;
  73. }
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement