comparison Chest.cpp @ 608:653724e9c234

m
author Ritor1
date Wed, 06 Mar 2013 18:22:07 +0600
parents ec3546510fa1
children 7bae884b7cd0
comparison
equal deleted inserted replaced
546:0193f10fecbf 608:653724e9c234
579 579
580 pRenderer->ClearZBuffer(0, 479); 580 pRenderer->ClearZBuffer(0, 479);
581 uChestArea = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID]; 581 uChestArea = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID];
582 memset(chest_cells_map, 0, 144); 582 memset(chest_cells_map, 0, 144);
583 //fill cell map at random positions 583 //fill cell map at random positions
584 for (items_counter = 0; items_counter<uChestArea; ++items_counter) 584 for ( items_counter = 0; items_counter < uChestArea; ++items_counter )
585 { 585 {
586 //get random position in chest 586 //get random position in chest
587 do 587 do
588 random_chest_pos = (unsigned __int8)rand(); 588 random_chest_pos = (unsigned __int8)rand();
589 while ( random_chest_pos >= uChestArea ); 589 while ( random_chest_pos >= uChestArea );
590 //if this pos occupied move to next 590 //if this pos occupied move to next
591 while ( chest_cells_map[random_chest_pos] ) 591 while ( chest_cells_map[random_chest_pos] )
592 { 592 {
593 ++random_chest_pos; 593 ++random_chest_pos;
594 if ( random_chest_pos == uChestArea ) 594 if ( random_chest_pos == uChestArea )
595 random_chest_pos = 0; 595 random_chest_pos = 0;
596 } 596 }
597 chest_cells_map[random_chest_pos] = items_counter; 597 chest_cells_map[random_chest_pos] = items_counter;
598 } 598 }
599 items_counter = 0; 599 items_counter = 0;
600 600
601 for (items_counter = 0; items_counter<uChestArea; ++items_counter) 601 for (items_counter = 0; items_counter<uChestArea; ++items_counter)
602 { 602 {
603 chest_item_id = pChests[uChestID].igChestItems[items_counter].uItemID; 603 chest_item_id = pChests[uChestID].igChestItems[items_counter].uItemID;