Mercurial > mm7
comparison Player.cpp @ 1349:e721754db8ee
Player::ItemsEnchant slight simplification
author | Grumpy7 |
---|---|
date | Sat, 13 Jul 2013 01:30:40 +0200 |
parents | 3ed6dcf82912 |
children | 8baf20c8f805 |
comparison
equal
deleted
inserted
replaced
1348:3ed6dcf82912 | 1349:e721754db8ee |
---|---|
477 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | 477 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 |
478 | 478 |
479 avalible_items = 0; | 479 avalible_items = 0; |
480 memset (item_index_tabl,0,sizeof(item_index_tabl)); | 480 memset (item_index_tabl,0,sizeof(item_index_tabl)); |
481 | 481 |
482 for (i=0; i<138; ++i) | 482 for (i = 0; i < 138; ++i) |
483 { | 483 { |
484 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | 484 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) |
485 item_index_tabl[avalible_items++] = i; | 485 item_index_tabl[avalible_items++] = i; |
486 } | 486 } |
487 | 487 |
488 if ( avalible_items ) | 488 if ( avalible_items ) |
489 { | 489 { |
490 if ( enchant_count ) | 490 if ( enchant_count ) |
491 { | 491 { |
492 for ( i = 0; i < enchant_count; ++i ) | 492 for ( i = 0; i < enchant_count; ++i ) |
493 { | 493 { |
494 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | 494 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
495 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | 495 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
496 } | 496 } |
497 | |
498 } | 497 } |
499 else | 498 else |
500 { | 499 { |
501 for ( i = 0; i < avalible_items; ++i ) | 500 for ( i = 0; i < avalible_items; ++i ) |
502 { | 501 { |
503 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | 502 pInventoryItems[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
504 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | 503 } |
505 } | 504 } |
506 } | 505 } |
507 } | |
508 ; | |
509 } | 506 } |
510 | 507 |
511 //----- (004948B1) -------------------------------------------------------- | 508 //----- (004948B1) -------------------------------------------------------- |
512 void Player::PlaySound(PlayerSpeech speech, int a3) | 509 void Player::PlaySound(PlayerSpeech speech, int a3) |
513 { | 510 { |