# HG changeset patch # User Grumpy7 # Date 1369651517 -7200 # Node ID 3e5d70cfe20ede693696f5e5acb29b67160610b6 # Parent b82375804b5d0ff651f685df7143302101283c05 Award order fix, changed UIMSG_C0 to UIMSG_ClickAwardScrollBar diff -r b82375804b5d -r 3e5d70cfe20e GUIWindow.h --- a/GUIWindow.h Mon May 27 11:19:14 2013 +0100 +++ b/GUIWindow.h Mon May 27 12:45:17 2013 +0200 @@ -152,7 +152,7 @@ UIMSG_BD = 189, UIMSG_CastSpell_BE = 190, UIMSG_BF = 191, - UIMSG_C0 = 192, + UIMSG_ClickAwardScrollBar = 192, UIMSG_C1 = 192, UIMSG_C2 = 192, diff -r b82375804b5d -r 3e5d70cfe20e UICharacter.cpp --- a/UICharacter.cpp Mon May 27 11:19:14 2013 +0100 +++ b/UICharacter.cpp Mon May 27 12:45:17 2013 +0200 @@ -1,5 +1,7 @@ #include +#include + #include "MM7.h" #include "MapInfo.h" @@ -2503,6 +2505,59 @@ pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); } +//Award sort stuff. Should be removed after changing the award container to something other than array +template +typename Cont::iterator begin(Cont& c){ + return c.begin(); +} + +template +typename Cont::iterator end(Cont& c){ + return c.end(); +} + +// overloads for C style arrays +template +T* begin(T (&arr)[N]){ + return &arr[0]; +} + +template +T* end(T (&arr)[N]){ + return arr + N; +} + +bool awardSort (int i,int j) { + if (pAwards[i].uPriority == 0) //none + { + return false; + } + else if (pAwards[j].uPriority == 0) + { + return true; + } + else if(pAwards[i].uPriority == 1) //fines,arena stuff,etc + { + return false; + } + else if(pAwards[j].uPriority == 1) + { + return true; + } + else if(pAwards[i].uPriority == 5) //joined guilds + { + return false; + } + else if(pAwards[j].uPriority == 5) + { + return true; + } + else + { + return (pAwards[i].uPriority_guilds_member_bits, i) && pAwards[i].pText ) + { achieved_awards[num_achieved_awards++] = (AwardType)i; + } } num_achieved_awards_2 = num_achieved_awards; num_achieved_awards = 0; @@ -2527,23 +2584,9 @@ //sort awards index if (num_achieved_awards_2 > 0) { - for(int i=0; iuNumMessages;*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); continue; - case UIMSG_C0: - __debugbreak(); + case UIMSG_ClickAwardScrollBar: dword_50651C = 1; if ( pMouse->GetCursorPos(&v211)->y > 178 ) dword_50651C = -1; @@ -10983,7 +10982,7 @@ 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_ar_dn_up), pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); - ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_C0, 0, 0, "", 0); + ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_ClickAwardScrollBar, 0, 0, "", 0); } }