Mercurial > mm7
diff UI/UICharacter.cpp @ 1460:ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
author | Gloval |
---|---|
date | Wed, 21 Aug 2013 20:58:36 +0400 |
parents | bfe342ae0c1f |
children | 845907a747d3 |
line wrap: on
line diff
--- a/UI/UICharacter.cpp Wed Aug 14 00:40:51 2013 +0400 +++ b/UI/UICharacter.cpp Wed Aug 21 20:58:36 2013 +0400 @@ -563,7 +563,7 @@ //----- (0041A000) -------------------------------------------------------- void CharacterUI_AwardsTab_Draw(Player *player) { - unsigned int result; // eax@1 + int items_per_page; // eax@1 char *v6; // ebx@15 char Source[100]; // [sp+Ch] [bp-C4h]@1 GUIWindow awards_window; // [sp+70h] [bp-60h]@1 @@ -575,7 +575,7 @@ strcat(pTmpBuf.data(), "\f00000"); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0); - result = books_primary_item_per_page; + items_per_page = books_primary_item_per_page; awards_window.uFrameX = 12; awards_window.uFrameY = 48; awards_window.uFrameWidth = 424; @@ -583,31 +583,31 @@ awards_window.uFrameZ = 435; awards_window.uFrameW = 337; if (BtnDown_flag && num_achieved_awards + books_primary_item_per_page < full_num_items_in_book) - result = books_primary_item_per_page++ + 1; - if (BtnUp_flag && result) + items_per_page = books_primary_item_per_page++ + 1; + if (BtnUp_flag && items_per_page) { - --result; - books_primary_item_per_page = result; + --items_per_page; + books_primary_item_per_page = items_per_page; } if ( books_page_number < 0 ) { - result += num_achieved_awards; - books_primary_item_per_page = result; - if ( (signed int)(num_achieved_awards + result) > full_num_items_in_book ) + items_per_page += num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( (signed int)(num_achieved_awards + items_per_page) > full_num_items_in_book ) { - result = full_num_items_in_book - num_achieved_awards; - books_primary_item_per_page = result; + items_per_page = full_num_items_in_book - num_achieved_awards; + books_primary_item_per_page = items_per_page; } } else if ( books_page_number > 0 ) { - result -= num_achieved_awards; - books_primary_item_per_page = result; - if ( (result & 0x80000000u) != 0 ) + items_per_page -= num_achieved_awards; + books_primary_item_per_page = items_per_page; + if ( items_per_page < 0 ) { - result = 0; - books_primary_item_per_page = result; + items_per_page = 0; + books_primary_item_per_page = items_per_page; } } BtnDown_flag = 0; @@ -615,7 +615,7 @@ num_achieved_awards = 0; books_page_number = 0; - for ( int i = result; i < full_num_items_in_book; ++i) + for ( int i = items_per_page; i < full_num_items_in_book; ++i) { v6 = (char *)pAwards[achieved_awards[i]].pText;//(char *)dword_723E80_award_related[v20 / 4]; pTmpBuf[0] = 0; @@ -2345,31 +2345,52 @@ //----- (00419100) -------------------------------------------------------- void FillAwardsData() { - auto pPlayer = pPlayers[uActiveCharacter]; + Player* pPlayer = pPlayers[uActiveCharacter]; - memset(achieved_awards.data(), 0, 4000); - num_achieved_awards = 0; + memset(achieved_awards.data(), 0, 4000); + num_achieved_awards = 0; - memset(pTmpBuf2.data(), 0, 0x7D0u); - BtnDown_flag = 0; - BtnUp_flag = 0; - books_page_number = 0; - books_primary_item_per_page = 0; - for (int i = 0; i < 105; ++i) + memset(pTmpBuf2.data(), 0, 0x7D0u); + BtnDown_flag = 0; + BtnUp_flag = 0; + books_page_number = 0; + books_primary_item_per_page = 0; + for (int i = 1; i < 105; ++i) + { + if ( _449B57_test_bit(pPlayer->_achieved_awards_bits, i) && pAwards[i].pText ) { - if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText ) - { - achieved_awards[num_achieved_awards++] = (AwardType)i; - } + achieved_awards[num_achieved_awards++] = (AwardType)i; } - full_num_items_in_book = num_achieved_awards; - num_achieved_awards = 0; + } + full_num_items_in_book = num_achieved_awards; + num_achieved_awards = 0; + + //sort awards index - //sort awards index - if (full_num_items_in_book > 0) + if (full_num_items_in_book>0) { - std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); + for (int i = 0; i< full_num_items_in_book; ++i) + achieved_awards[full_num_items_in_book+i] = (AwardType)(rand()%16); + for (int i = 1; i< full_num_items_in_book; ++i) + { + for (int j = i; j< full_num_items_in_book; ++j) + { + AwardType tmp; + if (pAwards[achieved_awards[j]].uPriority < pAwards[achieved_awards[i]].uPriority) + { + tmp= achieved_awards[j]; + achieved_awards[j] = achieved_awards[i]; + achieved_awards[i] = tmp; + } + } + } } + + + // if (full_num_items_in_book > 0) + /* { + std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort); + }*/ }