diff UICharacter.cpp @ 1202:0dbf6c4dd029

arrays to std::arrays phase 1
author Grumpy7
date Sat, 08 Jun 2013 21:33:22 +0200
parents 29a8defbad9e
children 8c02e6f74b29
line wrap: on
line diff
--- a/UICharacter.cpp	Sat Jun 08 19:34:33 2013 +0200
+++ b/UICharacter.cpp	Sat Jun 08 21:33:22 2013 +0200
@@ -41,7 +41,7 @@
 unsigned int ui_character_bonus_text_color_neg;
 unsigned int ui_character_skill_upgradeable_color;
 unsigned int ui_character_skill_default_color;
-unsigned int ui_character_award_color[6];
+std::array<unsigned int, 6> ui_character_award_color;
 
 unsigned int ui_game_minimap_outline_color;
 unsigned int ui_game_minimap_actor_friendly_color;
@@ -50,7 +50,7 @@
 unsigned int ui_game_minimap_decoration_color_1;
 unsigned int ui_game_minimap_projectile_color;
 unsigned int ui_game_minimap_treasure_color;
-unsigned int ui_game_character_record_playerbuff_colors[24];
+std::array<unsigned int, 24> ui_game_character_record_playerbuff_colors;
 
 unsigned int ui_gamemenu_video_gamma_title_color;
 unsigned int ui_gamemenu_keys_action_name_color;
@@ -2508,28 +2508,6 @@
         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<class Cont>
-typename Cont::iterator begin(Cont& c){
-    return c.begin();
-}
-
-template<class Cont>
-typename Cont::iterator end(Cont& c){
-    return c.end();
-}
-
-// overloads for C style arrays
-template<class T, std::size_t N>
-T* begin(T (&arr)[N]){
-    return &arr[0];
-}
-
-template<class T, std::size_t N>
-T* end(T (&arr)[N]){
-    return arr + N;
-}
-
 bool awardSort (int i,int j) { 
     if (pAwards[i].uPriority == 0)  //none
     {
@@ -2566,7 +2544,7 @@
 {
         auto pPlayer = pPlayers[uActiveCharacter];
 
-        memset(achieved_awards, 0, 4000);
+        memset(achieved_awards.data(), 0, 4000);
         num_achieved_awards = 0;
 
         memset(pTmpBuf2, 0, 0x7D0u);
@@ -2587,7 +2565,7 @@
         //sort awards index 
         if (num_achieved_awards_2 > 0)
         {
-            std::stable_sort(begin(achieved_awards), end(achieved_awards), awardSort);
+            std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
         }
     }