changeset 1288:7adc8b9b6a25

Слияние
author Ritor1
date Mon, 10 Jun 2013 09:30:21 +0600
parents d439d5cb6837 (current diff) 6279bf7a4d1a (diff)
children 772f805df4f7
files stru9.cpp
diffstat 77 files changed, 3725 insertions(+), 3989 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Actor.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -40,7 +40,7 @@
 
 
 
-Actor pActors[500];
+std::array<Actor, 500> pActors;
 int uNumActors;
 
 stru319 stru_50C198; // idb
@@ -1362,13 +1362,13 @@
   int v5; // ST1C_4@8
   int v6; // eax@8
 
-  auto victim = pActors + uActorID;
+  auto victim = &pActors[uActorID];
   if ( a2 == 1 )
     BYTE2(victim->uAttributes) |= 8u;
 
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto actor = pActors + i;
+    auto actor = &pActors[i];
     if (!actor->CanAct() || i == uActorID)
       continue;
 
@@ -1935,7 +1935,7 @@
 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4)
 {
   assert(uActorID < uNumActors);
-  auto actor = pActors + uActorID;
+  auto actor = &pActors[uActorID];
   
   AIDirection a3;
   if (!a4)
@@ -2352,9 +2352,9 @@
   result = pPlayer->CanAct();
   if ( result )
   {
-    pCastSpellInfo->_427D48(v1);
+    pCastSpellInfo.data()->_427D48(v1);
     v4 = 0;
-    v5 = pMapStats->GetMapInfo(pCurrentMapName);
+    v5 = pMapStats->GetMapInfo(pCurrentMapName.data());
     if ( v5 )
       v4 = pMapStats->pInfos[v5]._steal_perm;
     v6 = &pOutdoor->ddm;
@@ -2972,7 +2972,7 @@
   unsigned int v9; // eax@3
   
   assert(uActorID < uNumActors);
-  auto actor = pActors + uActorID;
+  auto actor = &pActors[uActorID];
   
   AIDirection a3; // [sp+Ch] [bp-5Ch]@2
   if (!a4)
@@ -3476,11 +3476,11 @@
   //v24 = v3->uLastCharacterIDToHit;
   //v26 = 0;
   assert(uActorID < uNumActors);
-  auto _this = pActors + uActorID;
+  auto _this = &pActors[uActorID];
 
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto actor = pActors + i;
+    auto actor = &pActors[i];
 	  //v7 = pActors;
 	  //do
 	  //{
--- a/Actor.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Actor.h	Mon Jun 10 09:30:21 2013 +0600
@@ -275,5 +275,5 @@
 //extern Actor pMonsterInfoUI_Doll;
 
 
-extern Actor pActors[500];
+extern std::array<Actor, 500> pActors;
 extern int uNumActors;
\ No newline at end of file
--- a/Arcomage.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Arcomage.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -23,39 +23,39 @@
 
 
 
-void sub_409BE8();
-
-
-void am_409FE9();
-char __cdecl am_40A198();
-void am_40A255();
-void  am_40A283(int a1);
+void SetStartConditions();
+
+
+void SetStartGameData();
+void FillPlayerDeck();
+void InitalHandsFill();
+void GetNextCardFromDeck(int player_num);
 int  GetEmptyCardSlotIndex(int player_num);
-void am_40A346(int player_num);
+void IncreaseResourcesInTurn(int player_num);
 void __cdecl am_40A383();
-bool  am_40A514();
+bool  IsGameOver();
 char __thiscall am_40A560(unsigned int _this);
-void  am_blts(int a1); // idb
+void DrawGameUI(int a1); // idb
 void am_40AA4E();
-void __cdecl am_chroma_blts();
-void __cdecl am_DrawUI();
-void __fastcall am_40B102(int a1, char *a2, POINT *pXY); // idb
-void  am_40B17E(int a1, char* a2, POINT *pXY); // idb
-void am_40B1F3(int a1, char* a2, POINT* a3);
-void  am_40B268(int a1, char *a2, POINT *pXY); // idb
-void __cdecl am_chroma_and_copy_blts();
-void __cdecl am_chroma_blt();
-void __cdecl am_40B4B9();
-void __fastcall am_40B76F(int a1);
+void DrawRectanglesForText();
+void DrawPlayersText();
+void DrawPlayerLevels(int a1, char *text, POINT *pXY); // idb
+void DrawBricksCount(int a1, char* text, POINT *pXY); // idb
+void DrawGemsCount(int a1, char* text, POINT* pXY);
+void DrawBeastsCount(int a1, char *text, POINT *pXY); // idb
+void DrawPlayersTowers();
+void DrawPlayersWall();
+void DrawCards();
+void DrawCardAnimation(int a1);
 int GetPlayerHandCardCount(int player_num);
-signed int __fastcall am_40BB67(int a1);
-char __fastcall am_40BCFB(int a1, signed int a2);
-bool __fastcall am_40BE0E(int a1, signed int a2);
-bool  am_40BF15(int player_num, int hand_card_indx);
-void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb
+signed int  DrawCardsRectangles(int player_num);
+bool  am_40BCFB(int player_num, signed int card_slot_index);
+bool PlayCard(int player_num, signed int card_slot_num);
+bool CanCardBePlayed(int player_num, int hand_card_indx);
+void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb
 int  am_40D2B4(POINT* a1, int a2); // weak
-int __fastcall am_40D402(int, int); // weak
-int __cdecl am_40D444();
+int  am_40D402(int player_num, int damage); // weak
+void GameResultsApply();
 
 void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY);
 void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
@@ -65,28 +65,26 @@
 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb
 void  SetPixel(POINT *pTargetXY, unsigned __int16 uColor);
 int __fastcall rand_interval(int a, int b); // idb
-char *__fastcall inv_strcat(const char *Source, char *Dest);
-char *__fastcall inv_strcpy(const char *Source, char *Dest);
 void __fastcall intToString(int val, char *pOut);
 
 /*  388 */
 #pragma pack(push, 1)
-struct stru348
+struct ArcomageStartConditions
 {
-  __int16 field_0;
-  __int16 field_2;
-  __int16 field_4;
-  __int16 field_6;
-  __int16 field_8;
-  __int16 field_A;
-  __int16 field_C;
-  __int16 field_E;
-  __int16 field_10;
-  __int16 field_12;
+  __int16 max_tower;
+  __int16 max_resources;
+  __int16 tower_height;
+  __int16 wall_height;
+  __int16 quarry_level;
+  __int16 magic_level;
+  __int16 zoo_level;
+  __int16 bricks_amount;
+  __int16 gems_amount;
+  __int16 beasts_amount;
   int field_14;
 };
 #pragma pack(pop)
-stru348 stru_4E1890[13] =
+ArcomageStartConditions start_conditions[13] =
 {
   { 30, 100, 15,  5,  2,  2,  2, 10, 10, 10,  0},
   { 50, 150, 20,  5,  2,  2,  2,  5,  5,  5,  1},
@@ -107,24 +105,18 @@
 #define SIG_xxxx  0x78787878
 
 ArcomageGame *pArcomageGame = new ArcomageGame;
-//ArcomageCard pCards[87];
+
 ArcomagePlayer am_Players[2];
-
-Acromage_st1 struct_st1[10];
-
+Acromage_st1 shown_cards[10]; //amuint_4FAA78; // weak
 stru272 array_4FABD0[10];
 
-char byte_5052A8[108];
-int dword_505314[108]; // weak
-
-char byte_5054C8[32]; // idb
-char byte_5054E8[108];
-int dword_505554[108]; 
-
-char pArcomagePlayer2Name[8];
-char pArcomagePlayer1Name[8];
-char pDeckMaster[12];
-
+
+ArcomageDeck playDeck;
+ArcomageDeck deckMaster;
+
+char Player2Name[] = "Enemy";
+char Player1Name[] = "Player";
+char pDeckMaster[] = "Master Deck";
 
 /*  267 */
 #pragma pack(push, 1)
@@ -143,35 +135,51 @@
 #pragma pack(pop)
 
 
-
-char am_byte_4E185D; // weak
-
-int amuint_4E1860; // weak
-int amuint_4E1864; // weak
-int amuint_4E1868; // weak
-int amuint_4E186C; // weak
-int amuint_4E1870; // weak
-
-
-int dword_4E1874  = 5; // weak
-int dword_4E1878  = 1; // weak
-int dword_4E187C  = 1; // weak
-int dword_4E1880  = 1; // weak
-int dword_4E1884 = 50; // weak
-int dword_4E1888 = 100 ; // weak
+char byte_4E185C  = 1; // weak
+char am_byte_4E185D = 1; // weak
+char byte_4E185E = 1; // weak
+
+int start_tower_height;
+int start_wall_height; 
+int start_quarry_level; 
+int start_magic_level; 
+int start_zoo_level; 
+
+
+int minimum_cards_at_hand  = 5; 
+int quarry_bonus           = 1; 
+int magic_bonus            = 1; 
+int zoo_bonus              = 1; 
+
+int max_tower_height       = 50; 
+int max_resources_amount   = 100 ; 
 
 int dword_4DF3A4; // weak
 
 char byte_4FAA2C; // weak
 char byte_4FAA2D; // weak
 
-int amuint_4FAA6C; // idb
+int current_player_num; // idb
 char am_byte_4FAA77; // weak
 
-signed int dword_4FABBC; // idb
-unsigned int amuint_4FABC0; // idb
-
-int dword_4FABC8; // weak
+signed int current_card_slot_index; 
+int played_card_id; // idb 4FABC0
+int uCardID; // idb 4FAA50
+
+int deck_walk_index; 
+
+int start_bricks_amount; 
+int start_gems_amount; 
+int start_beasts_amount; 
+
+POINT amuint_4FAA3C_blt_xy;
+POINT am_uint_4FAA44_blt_xy;
+POINT amuint_4FAA54_blt_xy;
+POINT amuint_4FAA5C_blt_xy;
+
+
+
+int dword_4FABB8; // weak
 
 
 //----- (0040DD2F) --------------------------------------------------------
@@ -198,7 +206,7 @@
 }
 
 //----- (0040DFD1) --------------------------------------------------------
-void stru272_stru0::_40DFD1(stru272_stru0 *a1)
+void stru272_stru0::Ctor(stru272_stru0 *a1)
     {
     stru272_stru0 *v2; // eax@1
     v2 = (stru272_stru0 *)malloc(0x5Cu);
@@ -211,7 +219,7 @@
     }
 
 //----- (0040DFFE) --------------------------------------------------------
-int stru272_stru0::_40DFFE()
+int stru272_stru0::Dtor()
     {
 
     if ( this->signature == SIG_trpg )
@@ -255,7 +263,7 @@
     }
 
 //----- (0040E0F5) --------------------------------------------------------
-int stru272_stru0::_40E0F5(char a2, char a3)
+int stru272_stru0::Empty(char a2, char a3)
     {
     if ( signature == SIG_trpg)
         {
@@ -621,7 +629,7 @@
 
 if ( blend_mode == 2 )
     {
-        uSrcPitch = 2 * (uSrcPitch - src_width);
+        uSrcPitch =  (uSrcPitch - src_width);
         for (int i=0; i< src_height; ++i)
             {
             for (int j=0; j< src_width; ++j)
@@ -637,7 +645,7 @@
     }
 else 
     {
-    uSrcPitch = 2 * (uSrcPitch - src_width);
+    uSrcPitch = (uSrcPitch - src_width);
     for (int i=0; i< src_height; ++i)
         {
         for (int j=0; j< src_width; ++j)
@@ -696,7 +704,7 @@
 
     if ( blend_mode == 2 )
         {
-        uSrcPitch = 2 * (uSrcPitch - src_width);
+        uSrcPitch =  (uSrcPitch - src_width);
         for (int i=0; i< src_height; ++i)
             {
             for (int j=0; j< src_width; ++j)
@@ -711,7 +719,7 @@
         }
     else 
         {
-        uSrcPitch = 2 * (uSrcPitch - src_width);
+        uSrcPitch =  (uSrcPitch - src_width);
         for (int i=0; i< src_height; ++i)
             {
             for (int j=0; j< src_width; ++j)
@@ -1548,20 +1556,20 @@
   stru272 *v3; // esi@17
   __int16 *v4; // esi@23
 
-  while ( !pArcomageGame->field_F5 )
+  while ( !pArcomageGame->GameOver )
   {
     pArcomageGame->field_F6 = 1;
     byte_4FAA24 = 1;
-    am_40A346(amuint_4FAA6C);
+    IncreaseResourcesInTurn(current_player_num);
 LABEL_8:
     while ( byte_4FAA24 )
     {
-      amuint_4FABC0 = -1;
-      am_40A283(amuint_4FAA6C);
+      played_card_id = -1;
+      GetNextCardFromDeck(current_player_num);
       while ( 1 )
       {
-        byte_4FAA24 = am_40A560(amuint_4FAA6C);
-        if ( GetPlayerHandCardCount(amuint_4FAA6C) <= dword_4E1874 )
+        byte_4FAA24 = am_40A560(current_player_num);
+        if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand )
           break;
         am_byte_4FAA77 = 1;
         if ( pArcomageGame->field_F4 )
@@ -1569,13 +1577,13 @@
       }
       am_byte_4FAA77 = 0;
     }
-    pArcomageGame->field_F5 = am_40A514();
-    if ( !pArcomageGame->field_F5 )
+    pArcomageGame->GameOver = IsGameOver();
+    if ( !pArcomageGame->GameOver )
       am_40A383();
     if ( pArcomageGame->field_F4 )
-      pArcomageGame->field_F5 = 1;
+      pArcomageGame->GameOver = 1;
   }
-  am_40D444();
+  GameResultsApply();
   if ( byte_4FAA2C )
   {
    // v2 = retzero_sub_40DFA7((int)dword_4FAA28);
@@ -1591,8 +1599,8 @@
 
   for(int i=0; i<10; ++i)
       {
-      array_4FABD0[i].field_40->_40E0F5(1,1);
-      array_4FABD0[i].field_40->_40DFFE();
+      array_4FABD0[i].field_40->Empty(1,1);
+      array_4FABD0[i].field_40->Dtor();
       }
 
   pArcomageGame->pGameBackground.Release();
@@ -1610,67 +1618,62 @@
 
 
 //----- (00409FE9) --------------------------------------------------------
-void am_409FE9()
+void SetStartGameData()
     {
-  signed int v0; // edi@1
-  signed int v1; // esi@4
-  int *v2; // ecx@7
-  int *v3; // eax@7
-  signed int v4; // edx@7
-  int v5; // edx@13
-  signed int v6; // ecx@13
-  signed int v7; // eax@13
-
-  amuint_4FAA6C = dword_505890;
-  sub_409BE8();
-  for(v0=0; v0<2; ++v0 )
+
+  signed int j; // edx@7
+  int card_id_counter; // edx@13
+  signed int i; // ecx@13
+  signed int card_dispenser_counter; // eax@13
+
+  current_player_num = dword_505890;
+  SetStartConditions();
+  for(i=0; i<2; ++i )
   {
-    if ( v0 )
+    if ( i )
     {
-      inv_strcpy(pArcomageGame->pPlayer2Name, am_Players[1].pPlayerName);
+      strcpy(am_Players[1].pPlayerName, pArcomageGame->pPlayer2Name);
       if ( byte_4E185C )
-        am_Players[1].field_20 = 0;
+        am_Players[1].IsHisTurn = 0;
       else
-        am_Players[1].field_20 = 1;
+        am_Players[1].IsHisTurn = 1;
     }
     else
     {
-      inv_strcpy(pArcomageGame->pPlayer1Name, am_Players[0].pPlayerName);
-      am_Players[0].field_20 = 1;
+      strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name);
+      am_Players[0].IsHisTurn = 1;
     }
-    am_Players[v0].field_24 = amuint_4E1860;
-    am_Players[v0].field_28 = amuint_4E1864;
-    am_Players[v0].field_2C = amuint_4E1868;
-    am_Players[v0].field_30 = amuint_4E186C;
-    am_Players[v0].field_34 = amuint_4E1870;
-    am_Players[v0].field_38 = amuint_505884;
-    am_Players[v0].field_3C = amuint_505888;
-    am_Players[v0].field_40 = amuint_50588C;
-
-    for (v4=0; v4<10; ++v4 )
+    am_Players[i].tower_height    = start_tower_height;
+    am_Players[i].wall_height     = start_wall_height;
+    am_Players[i].quarry_level    = start_quarry_level;
+    am_Players[i].magic_level     = start_magic_level;
+    am_Players[i].zoo_level       = start_zoo_level;
+    am_Players[i].resource_bricks = start_bricks_amount;
+    am_Players[i].resource_gems   = start_gems_amount;
+    am_Players[i].resource_beasts = start_beasts_amount;
+
+    for (j=0; j<10; ++j )
     {
-      am_Players[v0].cards_at_hand[v4] = -1;
+      am_Players[i].cards_at_hand[j] = -1;
       if ( am_byte_4E185D )
       {
-        am_Players[v0].arr_6C[v4].field_0 = -1;
-        am_Players[v0].arr_6C[v4].field_4 = -1;
+        am_Players[i].arr_6C[j].field_0 = -1;
+        am_Players[i].arr_6C[j].field_4 = -1;
       }
       else
       {
-      am_Players[v0].arr_6C[v4].field_0 = 0;
-      am_Players[v0].arr_6C[v4].field_4 = 0;
+      am_Players[i].arr_6C[j].field_0 = 0;
+      am_Players[i].arr_6C[j].field_4 = 0;
       }
     }
    
   }
-
-
-  inv_strcpy(pDeckMaster, byte_5054C8);
-  for (v6=0, v7=-2, v5=0; v6<108; ++v6, ++v7)
+  strcpy(deckMaster.name, pDeckMaster);
+  for (i=0, card_dispenser_counter=-2, card_id_counter=0; i<DECK_SIZE; ++i, ++card_dispenser_counter)
       {
-      byte_5054E8[v6] = 0;
-      dword_505554[v6] =v5;
-      switch ( v7 )
+      deckMaster.cardsInUse[i] = 0;
+      deckMaster.cards_IDs[i] =card_id_counter;
+      switch ( card_dispenser_counter )
           {
       case 0:
       case 2:
@@ -1695,102 +1698,71 @@
       case 89:
           break;
       default:
-          ++v5;
+          ++card_id_counter;
           }
       }
 
-   am_40A198();
+   FillPlayerDeck();
 }
-// 4E185C: using guessed type char byte_4E185C;
-// 4E185D: using guessed type char am_byte_4E185D;
-// 4E1860: using guessed type int amuint_4E1860;
-// 4E1864: using guessed type int amuint_4E1864;
-// 4E1868: using guessed type int amuint_4E1868;
-// 4E186C: using guessed type int amuint_4E186C;
-// 4E1870: using guessed type int amuint_4E1870;
-// 505554: using guessed type int dword_505554[];
-// 505884: using guessed type int amuint_505884;
-// 505888: using guessed type int amuint_505888;
-// 50588C: using guessed type int amuint_50588C;
-// 505890: using guessed type int dword_505890;
 
 //----- (0040A198) --------------------------------------------------------
-char __cdecl am_40A198()
-{
-  int *v0; // edi@1
-  int *v1; // edx@2
-  signed int v2; // esi@2
+void FillPlayerDeck()
+    {
+ 
   signed int v3; // eax@4
-  signed int v4; // esi@12
-  int v5; // eax@13
   int v6; // edx@13
-  char *v7; // eax@13
-  char result; // al@14
-  char v9[108]; // [sp+8h] [bp-6Ch]@1
-
-  ArcomageGame::PlaySound(0x14u);
-  memset(byte_5054E8, 0, sizeof(byte_5054E8));
-  memset(v9, 0, sizeof(v9));
-  v0 = am_Players[0].cards_at_hand;//variable incorrect
-  do
+  char v7; // eax@13
+  char card_taken_flags[DECK_SIZE]; // [sp+8h] [bp-6Ch]@1
+  int i,j;
+
+  ArcomageGame::PlaySound(20);
+  memset(deckMaster.cardsInUse, 0,DECK_SIZE );
+  memset(card_taken_flags, 0, DECK_SIZE);
+
+  for (i=0; i<2; ++i)
   {
-    v1 = v0;
-    v2 = 10;
-    do
+    for (j=0; j<10; ++j)
     {
-      if ( *v1 > -1 )
+      if ( am_Players[i].cards_at_hand[j] > -1 )
       {
-        v3 = 0;
-        while ( dword_505554[v3] != *v1 || byte_5054E8[v3] )
-        {
-          ++v3;
-          if ( v3 >= 108 )
-            goto LABEL_10;
-        }
-        byte_5054E8[v3] = 1;
+        for (v3 = 0; v3<DECK_SIZE; ++v3)
+            {
+            if (deckMaster.cards_IDs[v3] == am_Players[i].cards_at_hand[j] && deckMaster.cardsInUse[v3] == 0)
+                {
+                    deckMaster.cardsInUse[v3] = 1;
+                    break;
+                }
+            }
       }
-LABEL_10:
-      ++v1;
-      --v2;
     }
-    while ( v2 );
-    v0 += 47;
   }
-  while ( (signed int)v0 < 2 );//(signed int)&pArcomageGame->msg.pt.y );
-  v4 = 0;
-  do
+
+  for (i=0; i<DECK_SIZE; ++i)
   {
     do
     {
-      v5 = rand();
-      v6 = v5 % 108;
-      v7 = &v9[v5 % 108];
+      v6 = rand() % DECK_SIZE;
+      v7 = card_taken_flags[v6];
     }
-    while ( *v7 == 1 );
-    *v7 = 1;
-    dword_505314[v4] = dword_505554[v6];
-    result = byte_5054E8[v6];
-    //array_4FABD0[9].field_4[v4++ + 4232] = result;// pArcomageGame
+    while ( v7 == 1 );
+    card_taken_flags[v6]=1;
+    playDeck.cards_IDs[i]  = deckMaster.cards_IDs[v6];
+    playDeck.cardsInUse[i] = deckMaster.cardsInUse[v6];
   }
-  while ( v4 < 108 );
-  dword_4FABC8 = 0;
+
+  deck_walk_index = 0;
   amuint_4FABC4 = -1;
   pArcomageGame->field_F6 = 1;
-  return result;
+
 }
-// 4FABC4: using guessed type int amuint_4FABC4;
-// 4FABC8: using guessed type int dword_4FABC8;
-// 505314: using guessed type int dword_505314[];
-// 505554: using guessed type int dword_505554[];
-// 40A198: using guessed type char var_6C[108];
 
 //----- (0040A255) --------------------------------------------------------
-void am_40A255()
+void InitalHandsFill()
     {
-  for (int i = 0; i < dword_4E1874; ++i )
+  for (int i = 0; i < minimum_cards_at_hand; ++i )
   {
-      am_40A283(0);
-      am_40A283(1);
+      GetNextCardFromDeck(0);
+      GetNextCardFromDeck(1);
   }
   pArcomageGame->field_F6 = 1;
 
@@ -1798,43 +1770,39 @@
 // 4E1874: using guessed type int dword_4E1874;
 
 //----- (0040A283) --------------------------------------------------------
-void am_40A283( int a1 )
+void GetNextCardFromDeck( int player_num )
     {
-  signed int v2; // eax@1
-  int v3; // edi@1
-  int v4; // esi@1
-  char v5; // bl@1
-  signed int result; // eax@7
-  int v7; // esi@8
-
-  v2 = dword_4FABC8;
-  v3 = a1;
-  v4 = a1;
-  v5 = 0;
-  do
+  signed int deck_index; // eax@1
+  int new_card_id; // edi@1
+  signed int card_slot_indx; // eax@7
+
+  deck_index = deck_walk_index;
+  for(;;)
   {
-    if ( v2 >= 108 )
+    if ( deck_index >= DECK_SIZE )
     {
-      am_40A198();
-      v2 = dword_4FABC8;
+      FillPlayerDeck();
+      deck_index = deck_walk_index;
     }
-    if ( !byte_5052A8[v2] )
+    if ( !playDeck.cardsInUse[deck_index] )
         {
-        v3 = dword_505314[v2];
-        v5 = 1;
+        new_card_id = playDeck.cards_IDs[deck_index];
+        ++deck_index;
+        deck_walk_index = deck_index;
+        break;
         }
-    ++v2;
-    dword_4FABC8 = v2;
+    ++deck_index;
+    deck_walk_index = deck_index;
   }
-  while ( !v5 );
-  ArcomageGame::PlaySound(0x15u);
-  result = GetEmptyCardSlotIndex(v4);
-  if ( result != -1 )
+  
+  ArcomageGame::PlaySound(21);
+  card_slot_indx = GetEmptyCardSlotIndex(player_num);
+  if ( card_slot_indx != -1 )
   {
-    amuint_4FAA4C = result;
-    am_Players[a1].cards_at_hand[result] = v3;
-    am_Players[a1].arr_6C[result].field_0 = rand_interval(-4, 4);
-    am_Players[a1].arr_6C[result].field_4 = rand_interval(-4, 4);
+    amuint_4FAA4C = card_slot_indx;
+    am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id;
+    am_Players[player_num].arr_6C[card_slot_indx].field_0 = rand_interval(-4, 4);
+    am_Players[player_num].arr_6C[card_slot_indx].field_4 = rand_interval(-4, 4);
     pArcomageGame->field_F6 = 1;
     byte_4FAA2D = 1;
   }
@@ -1858,11 +1826,11 @@
 }
 
 //----- (0040A346) --------------------------------------------------------
-void am_40A346( int player_num )
+void IncreaseResourcesInTurn( int player_num )
 {
-  am_Players[player_num].field_38 += dword_4E1878 + am_Players[player_num].field_2C;
-  am_Players[player_num].field_3C += dword_4E187C + am_Players[player_num].field_30;
-  am_Players[player_num].field_40 += dword_4E1880 + am_Players[player_num].field_34;
+  am_Players[player_num].resource_bricks += quarry_bonus + am_Players[player_num].quarry_level;
+  am_Players[player_num].resource_gems   += magic_bonus  + am_Players[player_num].magic_level;
+  am_Players[player_num].resource_beasts += zoo_bonus  + am_Players[player_num].zoo_level;
 }
 
 
@@ -1875,50 +1843,46 @@
   unsigned __int8 v3; // of@4
   int v4; // eax@6
   char Dest[64]; // [sp+4h] [bp-64h]@4
-  int v6; // [sp+44h] [bp-24h]@6
-  int v7; // [sp+48h] [bp-20h]@6
-  int v8; // [sp+4Ch] [bp-1Ch]@6
-  int v9; // [sp+50h] [bp-18h]@6
+  RECT v6; // [sp+44h] [bp-24h]@6
+ 
   ArcomageGame_stru1 v10; // [sp+54h] [bp-14h]@7
-  int v11[2]; // [sp+60h] [bp-8h]@4
+  POINT v11; // [sp+60h] [bp-8h]@4
 
   if ( !pArcomageGame->field_F4 )
   {
-    if ( LOBYTE(am_Players[0].field_20) != 1 || LOBYTE(am_Players[1].field_20) != 1 )
+    if ( am_Players[0].IsHisTurn != 1 || am_Players[1].IsHisTurn != 1 )
     {
-      ++amuint_4FAA6C;
+      ++current_player_num;
       am_byte_4FAA75 = 1;
-      if ( amuint_4FAA6C >= 2 )
-        amuint_4FAA6C = 0;
+      if ( current_player_num >= 2 )
+        current_player_num = 0;
     }
     else
     {
       //nullsub_1();
-      v11[0] = 0;
-      v11[1] = 0;
-      inv_strcpy("", Dest);
-      v0 = 0;
-      v11[1] = 200;
-      v11[0] = 320 - 12 * v0 / 2;
-    //  pPrimaryWindow_draws_text(-1, Dest, v11);
+   //   v11.x = 0;
+   //   v11.y = 0;
+      strcpy(Dest,"The Next Player is: ");//""
+     // v0 = 0;
+      v11.y = 200;
+      v11.x = 320; // - 12 * v0 / 2;
+      pPrimaryWindow_draws_text(-1, Dest, &v11);
       am_byte_4FAA75 = 1;
-      v1 = amuint_4FAA6C + 1;
-      v3 = __OFSUB__(amuint_4FAA6C + 1, 2);
-      v2 = amuint_4FAA6C++ - 1 < 0;
-      if ( !(v2 ^ v3) )
+      v1 = ++current_player_num;
+      if ( v1 >= 2  )
       {
         v1 = 0;
-        amuint_4FAA6C = 0;
+        current_player_num = 0;
       }
-      inv_strcpy(am_Players[v1].pPlayerName, Dest);
-      v4 = 0;
-      v11[1] = 260;
-      v11[0] = 320 - 12 * v4 / 2;
-     // pPrimaryWindow_draws_text(-1, Dest, v11);
-      v6 = 0;
-      v8 = 640;
-      v7 = 0;
-      v9 = 480;
+      strcpy(Dest, am_Players[v1].pPlayerName);
+     // v4 = 0;
+      v11.y = 260;
+      v11.x = 320;// - 12 * v4 / 2;
+      pPrimaryWindow_draws_text(-1, Dest, &v11);
+     /* v6.left = 0;
+      v6.right = 640;
+      v6.top = 0;
+      v6.bottom = 480;*/
       //nullsub_1();
       CallRenderPresent();
       //nullsub_1();
@@ -1945,12 +1909,12 @@
       pArcomageGame->field_F4 = 1;
       byte_4FAA74 = 1;
 LABEL_13:
-      v11[0] = 0;
-      v11[1] = 0;
-      v6 = 0;
-      v8 = 640;
-      v7 = 0;
-      v9 = 480;
+      /*  v11.x = 0;
+      v11.y = 0;
+      v6.left = 0;
+      v6.right = 640;
+      v6.top = 0;
+      v6.bottom = 480;*/
       //nullsub_1();
       CallRenderPresent();
     }
@@ -1959,20 +1923,20 @@
 
 
 //----- (0040A514) --------------------------------------------------------
-bool am_40A514()
+bool IsGameOver()
     {
   bool result; // eax@1
 
   result = false;
   for(int i=0; i<2; ++i)
   {
-    if ( am_Players[i].field_24 <= 0 )
+    if ( am_Players[i].tower_height <= 0 )
+       result  = true;
+    if ( am_Players[i].tower_height >= max_tower_height )
        result  = true;
-    if ( am_Players[i].field_24 >= dword_4E1884 )
-      result  = true;
-    if (  am_Players[i].field_38 >= dword_4E1888
-      ||  am_Players[i].field_3C >= dword_4E1888
-      ||  am_Players[i].field_40 >= dword_4E1888 )
+    if (  am_Players[i].resource_bricks >= max_resources_amount
+      ||  am_Players[i].resource_gems   >= max_resources_amount
+      ||  am_Players[i].resource_beasts >= max_resources_amount )
       result  = true;
   }
  
@@ -1980,31 +1944,27 @@
     byte_4FAA2C = 1;
   return result;
 }
-// 4E1884: using guessed type int dword_4E1884;
-// 4E1888: using guessed type int dword_4E1888;
-// 4FAA2C: using guessed type char byte_4FAA2C;
+
 
 //----- (0040A560) --------------------------------------------------------
-char am_40A560(unsigned int _this)
+char am_40A560(unsigned int player_num)
 {
   int v1; // ebp@0
   unsigned __int64 v2; // qax@3
   unsigned __int64 v3; // kr00_8@3
-  int v4; // ecx@17
+ 
   int v5; // esi@67
   char Dest[100]; // [sp+8h] [bp-A8h]@67
   int v8; // [sp+6Ch] [bp-44h]@3
-  int pSrcXYZW[4]; // [sp+70h] [bp-40h]@75
+  RECT pSrcXYZW; // [sp+70h] [bp-40h]@75
   int v10[4]; // [sp+80h] [bp-30h]@69
-  int pTargetXY[2]; // [sp+90h] [bp-20h]@75
+  POINT pTargetXY; // [sp+90h] [bp-20h]@75
   ArcomageGame_stru1 a2; // [sp+98h] [bp-18h]@8
   int v13; // [sp+A4h] [bp-Ch]@1
-  int a1; // [sp+A8h] [bp-8h]@1
   char v15; // [sp+AEh] [bp-2h]@63
   char v16; // [sp+AFh] [bp-1h]@1
 
   uCardID = -1;
-  a1 = _this;
   v16 = 0;
   v13 = 20;
   byte_4FAA00 = 0;
@@ -2015,19 +1975,13 @@
     byte_4FAA2D = 1;
   do
   {
-    do
-    {
+   
       do
       {
-        v2 = pEventTimer->Time();
-        v3 = v2 - pArcomageGame->event_timer_time;
-        v8 = HIDWORD(v3);
+        v3 = pEventTimer->Time() - pArcomageGame->event_timer_time;
       }
-      while ( SHIDWORD(v3) < 0 );
-    }
-    while ( SHIDWORD(v2) < (signed int)(((unsigned int)v2 < pArcomageGame->event_timer_time)
-                                      + ((unsigned __int64)pArcomageGame->event_timer_time >> 32)) | HIDWORD(v3) == 0
-         && (unsigned int)v3 < 6 );
+      while (v3 < 6);
+    
     pArcomageGame->event_timer_time = pEventTimer->Time();
     if ( pArcomageGame->field_F4 )
       v16 = 1;
@@ -2046,25 +2000,24 @@
       case 9:
         pArcomageGame->field_F6 = 1;
         break;
-      case 0xA:
+      case 10:
         pAudioPlayer->StopChannels(-1, -1);
         byte_4FAA74 = 1;
         v16 = 1;
         pArcomageGame->field_F4 = 1;
         break;
     }
-    v4 = amuint_4FAA6C;
-    if ( LOBYTE(am_Players[amuint_4FAA6C].field_20) != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D )
+
+    if (am_Players[current_player_num].IsHisTurn != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D )
     {
       if ( am_byte_4FAA75 )
         am_byte_4FAA76 = 1;
-      am_408BB4(amuint_4FAA6C);
-      v4 = amuint_4FAA6C;
+      am_408BB4(current_player_num);
       byte_4FAA2E = 1;
     }
     if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 )
       amuint_4FAA38 = 10;
-    if ( byte_4FAA2E || byte_4FAA2D || LOBYTE(am_Players[v4].field_20) != 1 )
+    if ( byte_4FAA2E || byte_4FAA2D ||am_Players[current_player_num].IsHisTurn != 1 )
     {
       pArcomageGame->field_F6 = 1;
       if ( byte_4FAA2D )
@@ -2100,25 +2053,25 @@
     {
       if ( am_byte_4FAA77 )
       {
-        if ( a2.field_0 == 7 && am_40BCFB(a1, dword_4FABBC) )
+        if ( a2.field_0 == 7 && am_40BCFB(player_num, current_card_slot_index) )
         {
           if ( am_byte_4FAA75 )
             am_byte_4FAA76 = 1;
           if ( dword_4FAA64 > 0 )
           {
             --dword_4FAA64;
-            am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874;
+            am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
           }
           byte_4FAA2E = 1;
         }
-        if ( a2.field_0 == 8 && am_40BCFB(a1, dword_4FABBC) )
+        if ( a2.field_0 == 8 && am_40BCFB(player_num, current_card_slot_index) )
         {
           if ( am_byte_4FAA75 )
             am_byte_4FAA76 = 1;
           if ( dword_4FAA64 > 0 )
           {
             --dword_4FAA64;
-            am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874;
+            am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
           }
           byte_4FAA2E = 1;
         }
@@ -2127,7 +2080,7 @@
       {
         if ( a2.field_0 == 7 )
         {
-          if ( am_40BE0E(a1, dword_4FABBC) )
+          if ( PlayCard(player_num, current_card_slot_index) )
           {
             byte_4FAA2E = 1;
             if ( am_byte_4FAA75 )
@@ -2136,7 +2089,7 @@
         }
         if ( a2.field_0 == 8 )
         {
-          if ( am_40BCFB(a1, dword_4FABBC) )
+          if ( am_40BCFB(player_num, current_card_slot_index) )
           {
             byte_4FAA2E = 1;
             if ( am_byte_4FAA75 )
@@ -2146,62 +2099,62 @@
       }
     }
     //nullsub_1();
-    if ( false )
-    {
-      if ( !v15 )
-      {
-        //nullsub_1();
-        v15 = 1;
-      }
-    }
-    else
-    {
-      v15 = 0;
-    }
-    if ( false )
+    //if ( false )
+    //{
+    //  if ( !v15 )
+    //  {
+    //    //nullsub_1();
+    //    v15 = 1;
+    //  }
+    //}
+    //else
+    //{
+    //  v15 = 0;
+  //  }
+    //if ( false )
+    //{
+    //  //nullsub_1();
+    //  //nullsub_1();
+    // // assert(false && "Invalid strcpy params");
+    // // inv_strcpy(nullptr, Dest);
+    //  v5 = 0;//unk::const_0(&unk_4E19FC, 0);
+    //  //nullsub_1();
+    //  if ( v5 == 1 )
+    //  {
+    //    pAudioPlayer->StopChannels(-1, -1);
+    //    v16 = 1;
+    //    pArcomageGame->field_F4 = 1;
+    //    dword_4FAA68 = 0;
+    //  }
+    //  /*v10[0] = 0;
+    //  v10[2] = 640;
+    //  v10[1] = 0;
+    //  v10[3] = 480;*/
+    //  //nullsub_1();
+    //}
+    if ( dword_4FABB8 != DrawCardsRectangles(player_num) )
     {
-      //nullsub_1();
-      //nullsub_1();
-      assert(false && "Invalid strcpy params");
-      inv_strcpy(nullptr, Dest);
-      v5 = 0;//unk::const_0(&unk_4E19FC, 0);
-      //nullsub_1();
-      if ( v5 == 1 )
-      {
-        pAudioPlayer->StopChannels(-1, -1);
-        v16 = 1;
-        pArcomageGame->field_F4 = 1;
-        dword_4FAA68 = 0;
-      }
-      v10[0] = 0;
-      v10[2] = 640;
-      v10[1] = 0;
-      v10[3] = 480;
-      //nullsub_1();
-    }
-    if ( dword_4FABB8 != am_40BB67(a1) )
-    {
-      dword_4FABB8 = am_40BB67(a1);
-      pArcomageGame->field_F6 = 1;
+    dword_4FABB8 = DrawCardsRectangles(player_num);
+    pArcomageGame->field_F6 = 1;
     }
     if ( pArcomageGame->field_F6 )
     {
-      am_blts(v13);
+      DrawGameUI(v13);
       DoBlt_Copy(pArcomageGame->pBackgroundPixels);
       pArcomageGame->field_F6 = 0;
     }
     if ( pArcomageGame->field_F9 )
     {
-      pTargetXY[0] = 0;
-      pTargetXY[1] = 0;
-      pSrcXYZW[0] = 0;
-      pSrcXYZW[2] = 640;
-      pSrcXYZW[1] = 0;
-      pSrcXYZW[3] = 480;
+      pTargetXY.x = 0;
+      pTargetXY.y = 0;
+      pSrcXYZW.left = 0;
+      pSrcXYZW.right = 640;
+      pSrcXYZW.top = 0;
+      pSrcXYZW.bottom = 480;
       am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1);
-    //  Blt_Copy(pSrcXYZW, pTargetXY, 2);
+      Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
       am_EndScene();
-      am_blts(v13);
+      DrawGameUI(v13);
       pRenderer->Present();
       pArcomageGame->field_F9 = 0;
     }
@@ -2209,44 +2162,32 @@
   while ( !v16 );
   return dword_4FAA68 > 0;
 }
-// 40DB22: using guessed type uint __stdcall unk__const_0(uint, uint);
-// 4E1874: using guessed type int dword_4E1874;
-// 4FAA00: using guessed type char byte_4FAA00;
-// 4FAA2D: using guessed type char byte_4FAA2D;
-// 4FAA2E: using guessed type char byte_4FAA2E;
-// 4FAA34: using guessed type int amuint_4FAA34;
-// 4FAA38: using guessed type int amuint_4FAA38;
-// 4FAA4C: using guessed type int amuint_4FAA4C;
-// 4FAA64: using guessed type int dword_4FAA64;
-// 4FAA68: using guessed type int dword_4FAA68;
-// 4FAA74: using guessed type char byte_4FAA74;
-// 4FAA75: using guessed type char am_byte_4FAA75;
-// 4FAA76: using guessed type char am_byte_4FAA76;
-// 4FAA77: using guessed type char am_byte_4FAA77;
-// 4FABB8: using guessed type int dword_4FABB8;
+
 
 //----- (0040A9AF) --------------------------------------------------------
-void am_blts( int a1 )
+void DrawGameUI( int a1 )
     {
 
   am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  am_chroma_blts();
+  DrawRectanglesForText();
   am_EndScene();
+
   am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  am_40B4B9();
-  am_chroma_and_copy_blts();
-  am_chroma_blt();
-  am_DrawUI();
+  DrawCards();
+  DrawPlayersTowers();
+  DrawPlayersWall();
+  DrawPlayersText();
   am_EndScene();
+
   am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  am_40B76F(a1);
+  DrawCardAnimation(a1);
 
   for( int i=0; i<10; ++i)
       {
       if (array_4FABD0[i].field_0)
           array_4FABD0[i].field_40->_40E133();
       }
-  dword_4FABBC = am_40BB67(amuint_4FAA6C);
+  current_card_slot_index = DrawCardsRectangles(current_player_num);
   am_40AA4E();
   am_EndScene();
 }
@@ -2295,12 +2236,12 @@
 }
 
 //----- (0040AB0A) --------------------------------------------------------
-void __cdecl am_chroma_blts()
-{
+void DrawRectanglesForText()
+    {
  
   RECT pSrcRect; // [sp+Ch] [bp-18h]@1
   POINT pTargetXY; // [sp+1Ch] [bp-8h]@1
-
+//resources rectangles
   pSrcRect.top     = 0;
   pSrcRect.left    = 765;
   pSrcRect.right   = 843;
@@ -2314,6 +2255,7 @@
   pTargetXY.y = 56;
   Blt_Copy(&pSrcRect, &pTargetXY, 2);
 
+  //players name rectangle
   pSrcRect.left   = 283;
   pSrcRect.right  = 361;
   pSrcRect.top    = 166;
@@ -2326,6 +2268,7 @@
   pTargetXY.y = 13;
   Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
+  //tower height rectangle
   pSrcRect.left   = 234;
   pSrcRect.right  = 283;
   pSrcRect.top    = 166;
@@ -2334,12 +2277,11 @@
   pTargetXY.y = 296;
   Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
-
   pTargetXY.x = 492;
   pTargetXY.y = 296;
   Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 
-
+  //wall height rectangle
   pSrcRect.left   = 192;
   pSrcRect.right  = 234;
   pSrcRect.top    = 166;
@@ -2354,821 +2296,735 @@
 }
 
 //----- (0040AC5F) --------------------------------------------------------
-void __cdecl am_DrawUI()
-{
-  int v0; // ecx@7
-  int v1; // ecx@9
-  int v2; // eax@11
-  int v3; // ecx@12
-  int v4; // eax@14
-  int v5; // ecx@14
-  int v6; // eax@16
-  int v7; // ecx@16
-  int v8; // eax@18
-  int v9; // ecx@18
-  int v10; // eax@20
-  char Dest[32]; // [sp+Ch] [bp-28h]@2
-  POINT v12; // [sp+2Ch] [bp-8h]@2
+void DrawPlayersText()
+    {
+ 
+  int res_value; // ecx@18
+  char text_buff[32]; // [sp+Ch] [bp-28h]@2
+  POINT text_position; // [sp+2Ch] [bp-8h]@2
 
   if ( am_byte_4FAA77 )
   {
-    inv_strcpy(pGlobalTXT_LocalizationStrings[266], Dest);// DISCARD A CARD
-    v12.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(Dest) / 2;
-    v12.y = 306;
-    pPrimaryWindow_draws_text(-1, Dest, &v12);
+    strcpy(text_buff, pGlobalTXT_LocalizationStrings[266]);// DISCARD A CARD
+    text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2;
+    text_position.y = 306;
+    pPrimaryWindow_draws_text(-1, text_buff, &text_position);
   }
-  inv_strcpy(am_Players[0].pPlayerName, Dest);
-  if ( !amuint_4FAA6C )
-    inv_strcat("***", Dest);
-  v12.x = 47 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 21;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  inv_strcpy(am_Players[1].pPlayerName, Dest);
-  if ( amuint_4FAA6C == 1 )
-    inv_strcat("***", Dest);
-  v12.x = 595 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 21;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  intToString(am_Players[0].field_24, Dest);
-  v12.x = 123 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 305;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  intToString(am_Players[1].field_24, Dest);
-  v12.x = 515 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 305;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  intToString(am_Players[0].field_28, Dest);
-  v12.x = 188 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 305;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  intToString(am_Players[1].field_28, Dest);
-  v12.x = 451 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
-  v12.y = 305;
-  pPrimaryWindow_draws_text(-1, Dest, &v12);
-
-  v0 = am_Players[0].field_2C;
+  strcpy( text_buff, am_Players[0].pPlayerName);
+  if ( !current_player_num )
+    strcat(text_buff, "***");
+  text_position.x = 47 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 21;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  strcpy(text_buff, am_Players[1].pPlayerName);
+  if ( current_player_num == 1 )
+    strcat(text_buff, "***" );
+  text_position.x = 595 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 21;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  intToString(am_Players[0].tower_height, text_buff);
+  text_position.x = 123 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 305;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  intToString(am_Players[1].tower_height, text_buff);
+  text_position.x = 515 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 305;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  intToString(am_Players[0].wall_height, text_buff);
+  text_position.x = 188 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 305;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  intToString(am_Players[1].wall_height, text_buff);
+  text_position.x = 451 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
+  text_position.y = 305;
+  pPrimaryWindow_draws_text(-1, text_buff, &text_position);
+
+  res_value = am_Players[0].quarry_level;
   if ( byte_4E185E )
-    v0 = dword_4E1878 + am_Players[0].field_2C;
-  intToString(v0, Dest);
-  v12.x = 14 - 6 * 0 / 2;
-  v12.y = 92;
-  am_40B102(-1, Dest, &v12);
-
-  v1 = am_Players[1].field_2C;
+    res_value =am_Players[0].quarry_level + quarry_bonus;
+  intToString(res_value, text_buff);
+  text_position.x = 14;// - 6 * 0 / 2;
+  text_position.y = 92;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  res_value = am_Players[1].quarry_level;
   if ( byte_4E185E )
-    v1 = dword_4E1878 + am_Players[1].field_2C;
-  intToString(v1, Dest);
-  v2 = 0;
-  v12.y = 92;
-  v12.x = 561 - 6 * v2 / 2;
-  am_40B102(-1, Dest, &v12);
-
+    res_value = am_Players[1].quarry_level + quarry_bonus;
+  intToString(res_value, text_buff);
+//  v2 = 0;
+  text_position.y = 92;
+  text_position.x = 561; //- 6 * v2 / 2;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  res_value = am_Players[0].magic_level;
   if ( byte_4E185E )
-    v3 = am_Players[0].field_30 + dword_4E187C;
-  else
-    v3 = am_Players[0].field_30;
-  intToString(v3, Dest);
-  v4 = 0;
-  v12.y = 164;
-  v12.x = 14 - 6 * v4 / 2;
-  am_40B102(-1, Dest, &v12);
-
-  v5 = am_Players[1].field_30;
+    res_value = am_Players[0].magic_level + magic_bonus;    
+  intToString(res_value, text_buff);
+ // v4 = 0;
+  text_position.y = 164;
+  text_position.x = 14; //- 6 * v4 / 2;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  res_value = am_Players[1].magic_level;
   if ( byte_4E185E )
-    v5 = dword_4E187C + am_Players[1].field_30;
-  intToString(v5, Dest);
-  v6 = 0;
-  v12.y = 164;
-  v12.x = 561 - 6 * v6 / 2;
-  am_40B102(-1, Dest, &v12);
-
-  v7 = am_Players[0].field_34;
+    res_value = am_Players[1].magic_level+magic_bonus;
+  intToString(res_value, text_buff);
+ // v6 = 0;
+  text_position.y = 164;
+  text_position.x = 561; //- 6 * v6 / 2;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  res_value = am_Players[0].zoo_level;
   if ( byte_4E185E )
-    v7 = dword_4E1880 + am_Players[0].field_34;
-  intToString(v7, Dest);
-  v8 = 0;
-  v12.y = 236;
-  v12.x = 14 - 6 * v8 / 2;
-  am_40B102(-1, Dest, &v12);
-
-  v9 = am_Players[1].field_34;
+    res_value = am_Players[0].zoo_level + zoo_bonus;
+  intToString(res_value, text_buff);
+ // v8 = 0;
+  text_position.y = 236;
+  text_position.x = 14;// - 6 * v8 / 2;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  res_value = am_Players[1].zoo_level;
   if ( byte_4E185E )
-    v9 = dword_4E1880 + am_Players[1].field_34;
-  intToString(v9, Dest);
-  v10 = 0;
-  v12.y = 236;
-  v12.x = 561 - 6 * v10 / 2;
-  am_40B102(-1, Dest, &v12);
-
-  intToString(am_Players[0].field_38, Dest);
-  v12.y = 114;
-  v12.x = 10;
-  am_40B17E(-1, Dest, &v12);
-
-  intToString(am_Players[1].field_38, Dest);
-  v12.x = 557;
-  v12.y = 114;
-  am_40B17E(-1, Dest, &v12);
-
-  intToString(am_Players[0].field_3C, Dest);
-  v12.x = 10;
-  v12.y = 186;
-  am_40B1F3(-1, Dest, &v12);
-
-  intToString(am_Players[1].field_3C, Dest);
-  v12.x = 557;
-  v12.y = 186;
-  am_40B1F3(-1, Dest, &v12);
-
-  intToString(am_Players[0].field_40, Dest);
-  v12.x = 10;
-  v12.y = 258;
-  am_40B268(-1, Dest, &v12);
-
-  intToString(am_Players[1].field_40, Dest);
-  v12.x = 557;
-  v12.y = 258;
-  am_40B268(-1, Dest, &v12);
+    res_value =  am_Players[1].zoo_level + zoo_bonus;
+  intToString(res_value, text_buff);
+ // v10 = 0;
+  text_position.y = 236;
+  text_position.x = 561;// - 6 * v10 / 2;
+  DrawPlayerLevels(-1, text_buff, &text_position);
+
+  intToString(am_Players[0].resource_bricks, text_buff);
+  text_position.y = 114;
+  text_position.x = 10;
+  DrawBricksCount(-1, text_buff, &text_position);
+
+  intToString(am_Players[1].resource_bricks, text_buff);
+  text_position.x = 557;
+  text_position.y = 114;
+  DrawBricksCount(-1, text_buff, &text_position);
+
+  intToString(am_Players[0].resource_gems, text_buff);
+  text_position.x = 10;
+  text_position.y = 186;
+  DrawGemsCount(-1, text_buff, &text_position);
+
+  intToString(am_Players[1].resource_gems, text_buff);
+  text_position.x = 557;
+  text_position.y = 186;
+  DrawGemsCount(-1, text_buff, &text_position);
+
+  intToString(am_Players[0].resource_beasts, text_buff);
+  text_position.x = 10;
+  text_position.y = 258;
+  DrawBeastsCount(-1, text_buff, &text_position);
+
+  intToString(am_Players[1].resource_beasts, text_buff);
+  text_position.x = 557;
+  text_position.y = 258;
+  DrawBeastsCount(-1, text_buff, &text_position);
 }
-// 4E185E: using guessed type char byte_4E185E;
-// 4E1878: using guessed type int dword_4E1878;
-// 4E187C: using guessed type int dword_4E187C;
-// 4E1880: using guessed type int dword_4E1880;
-// 4FAA77: using guessed type char am_byte_4FAA77;
+
 
 //----- (0040B102) --------------------------------------------------------
-void __fastcall am_40B102( int a1, char *a2, POINT *pXY )
+void DrawPlayerLevels( int a1, char *text, POINT *pXY )
     {
-  //char *v3; // esi@1
-  //int v4; // eax@1
-  //unsigned __int8 v5; // bl@2
-  //char v6; // zf@2
-  //int v7; // eax@3
-  //int v8; // ecx@3
-  //int v9; // [sp+8h] [bp-18h]@3
-  //int v10; // [sp+Ch] [bp-14h]@3
-  //int v11; // [sp+10h] [bp-10h]@3
-  //int v12; // [sp+14h] [bp-Ch]@3
-  //int v13; // [sp+18h] [bp-8h]@1
-  //int v14; // [sp+1Ch] [bp-4h]@1
-
-  //v3 = a2;
-  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  //v4 = pXY[1];
-  //v13 = *pXY;
-  //v14 = v4;
-  //do
-  //{
-  //  v5 = *v3++;
-  //  v6 = v5 == 0;
-  //  if ( v5 )
-  //  {
-  //    v7 = 22 * v5;
-  //    v8 = v7 - 864;
-  //    v7 -= 842;
-  //    v11 = v7;
-  //    LOWORD(v7) = pArcomageGame->field_54;
-  //    v9 = v8;
-  //    v10 = 190;
-  //    v12 = 207;
-  //    Blt_Chroma(&v9, &v13, v7, 1);
-  //    v13 += 22;
-  //    v6 = v5 == 0;
-  //  }
-  //}
-  //while ( !v6 );
-  //am_EndScene();
+  char *v3; // esi@1
+  unsigned char test_char; // bl@2
+  int v7; // eax@3
+  RECT pSrcRect;
+  POINT pTargetPoint;
+
+  v3 = text;
+  am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+  pTargetPoint.x = pXY->x;
+  pTargetPoint.y = pXY->y;
+  do
+  {
+    test_char = *v3;
+    ++v3;
+    if ( test_char )
+    {
+      v7 = 22 * test_char;
+      pSrcRect.right = v7 - 842;
+      pSrcRect.left = v7 - 864;
+      pSrcRect.top = 190;
+      pSrcRect.bottom = 207;
+      Blt_Chroma(&pSrcRect, &pTargetPoint, pArcomageGame->field_54, 1);
+      pTargetPoint.x += 22;
+    }
+  }
+  while ( test_char!= 0 );
+  am_EndScene();
 }
 
 //----- (0040B17E) --------------------------------------------------------
-void am_40B17E( int a1, char* a2, POINT *pXY )
+void DrawBricksCount( int a1, char* text, POINT *pXY )
     {
-  //int v3; // esi@1
-  //int v4; // eax@1
-  //unsigned __int8 v5; // bl@2
-  //char v6; // zf@2
-  //int v7; // eax@3
-  //int v8; // [sp+8h] [bp-18h]@3
-  //int v9; // [sp+Ch] [bp-14h]@3
-  //int v10; // [sp+10h] [bp-10h]@3
-  //int v11; // [sp+14h] [bp-Ch]@3
-  //int v12; // [sp+18h] [bp-8h]@1
-  //int v13; // [sp+1Ch] [bp-4h]@1
-
-  //v3 = a2;
-  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  //v4 = pXY[1];
-  //v12 = *pXY;
-  //v13 = v4;
-  //do
-  //{
-  //  v5 = *(unsigned char *)v3++;
-  //  v6 = v5 == 0;
-  //  if ( v5 )
-  //  {
-  //    v7 = 13 * v5;
-  //    v8 = v7 - 370;
-  //    v10 = v7 - 357;
-  //    v9 = 128;
-  //    v11 = 138;
-  //    Blt_Copy(&v8, &v12, 2);
-  //    v12 += 13;
-  //    v6 = v5 == 0;
-  //  }
-  //}
-  //while ( !v6 );
-  //am_EndScene();
+
+    char *v3; // esi@1
+    unsigned char test_char; // bl@2
+    int v7; // eax@3
+    RECT pSrcRect;
+    POINT pTargetPoint;
+
+    v3 = text;
+    am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+    pTargetPoint.x = pXY->x;
+    pTargetPoint.y = pXY->y;
+    do
+        {
+        test_char = *v3;
+        ++v3;
+        if ( test_char )
+            {
+            v7 = 13 * test_char;
+            pSrcRect.left = v7 - 370;
+            pSrcRect.right = v7 - 357;
+            pSrcRect.top = 128;
+            pSrcRect.bottom = 138;
+            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pTargetPoint.x += 13;
+            }
+        }
+        while ( test_char!= 0 );
+        am_EndScene();
+
 }
 
 //----- (0040B1F3) --------------------------------------------------------
-void am_40B1F3( int a1, char* a2, POINT* a3 )
+void DrawGemsCount( int a1, char* text, POINT* pXY )
     {
-  //int v3; // esi@1
-  //int v4; // eax@1
-  //unsigned __int8 v5; // bl@2
-  //char v6; // zf@2
-  //int v7; // eax@3
-  //int v8; // [sp+8h] [bp-18h]@3
-  //int v9; // [sp+Ch] [bp-14h]@3
-  //int v10; // [sp+10h] [bp-10h]@3
-  //int v11; // [sp+14h] [bp-Ch]@3
-  //int v12; // [sp+18h] [bp-8h]@1
-  //int v13; // [sp+1Ch] [bp-4h]@1
-
-  //v3 = a2;
-  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  //v4 = *(unsigned int *)(a3 + 4);
-  //v12 = *(unsigned int *)a3;
-  //v13 = v4;
-  //do
-  //{
-  //  v5 = *(unsigned char *)v3++;
-  //  v6 = v5 == 0;
-  //  if ( v5 )
-  //  {
-  //    v7 = 13 * v5;
-  //    v8 = v7 - 370;
-  //    v10 = v7 - 357;
-  //    v9 = 138;
-  //    v11 = 148;
-  //    Blt_Copy(&v8, &v12, 2);
-  //    v12 += 13;
-  //    v6 = v5 == 0;
-  //  }
-  //}
-  //while ( !v6 );
-  //am_EndScene();
+
+    char *v3; // esi@1
+    unsigned char test_char; // bl@2
+    int v7; // eax@3
+    RECT pSrcRect;
+    POINT pTargetPoint;
+
+    v3 = text;
+    am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+    pTargetPoint.x = pXY->x;
+    pTargetPoint.y = pXY->y;
+    do
+        {
+        test_char = *v3;
+        ++v3;
+        if ( test_char )
+            {
+            v7 = 13 * test_char;
+            pSrcRect.left = v7 - 370;
+            pSrcRect.right = v7 - 357;
+            pSrcRect.top = 138;
+            pSrcRect.bottom = 148;
+            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pTargetPoint.x += 13;
+            }
+        }
+        while ( test_char!= 0 );
+        am_EndScene();
+  
 }
 
 //----- (0040B268) --------------------------------------------------------
-void am_40B268( int a1, char *a2, POINT *pXY )
+void DrawBeastsCount( int a1, char *text, POINT *pXY )
     {
-  //char *v3; // esi@1
-  //int v4; // eax@1
-  //unsigned __int8 v5; // bl@2
-  //char v6; // zf@2
-  //int v7; // eax@3
-  //int v8; // [sp+8h] [bp-18h]@3
-  //int v9; // [sp+Ch] [bp-14h]@3
-  //int v10; // [sp+10h] [bp-10h]@3
-  //int v11; // [sp+14h] [bp-Ch]@3
-  //int v12; // [sp+18h] [bp-8h]@1
-  //int v13; // [sp+1Ch] [bp-4h]@1
-
-  //v3 = a2;
-  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  //v4 = pXY[1];
-  //v12 = *pXY;
-  //v13 = v4;
-  //do
-  //{
-  //  v5 = *v3++;
-  //  v6 = v5 == 0;
-  //  if ( v5 )
-  //  {
-  //    v7 = 13 * v5;
-  //    v8 = v7 - 370;
-  //    v10 = v7 - 357;
-  //    v9 = 148;
-  //    v11 = 158;
-  //    Blt_Copy(&v8, &v12, 2);
-  //    v12 += 13;
-  //    v6 = v5 == 0;
-  //  }
-  //}
-  //while ( !v6 );
-  //am_EndScene();
+
+    char *v3; // esi@1
+    unsigned char test_char; // bl@2
+    int v7; // eax@3
+    RECT pSrcRect;
+    POINT pTargetPoint;
+
+    v3 = text;
+    am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+    pTargetPoint.x = pXY->x;
+    pTargetPoint.y = pXY->y;
+    do
+        {
+        test_char = *v3;
+        ++v3;
+        if ( test_char )
+            {
+            v7 = 13 * test_char;
+            pSrcRect.left = v7 - 370;
+            pSrcRect.right = v7 - 357;
+            pSrcRect.top = 148;
+            pSrcRect.bottom = 158;
+            Blt_Copy(&pSrcRect, &pTargetPoint, 2);
+            pTargetPoint.x += 13;
+            }
+        }
+        while ( test_char!= 0 );
+        am_EndScene();
+
 }
 
 //----- (0040B2DD) --------------------------------------------------------
-void __cdecl am_chroma_and_copy_blts()
-{
-  //int v0; // eax@1
-  //int v1; // esi@3
-  //int v2; // eax@3
-  //int v3; // eax@3
-  //int v4; // esi@5
-  //int v5; // eax@5
-  //int pSrcXYZW[4]; // [sp+0h] [bp-18h]@3
-  //int v7; // [sp+4h] [bp-14h]@3
-  //int v8; // [sp+8h] [bp-10h]@3
-  //int v9; // [sp+Ch] [bp-Ch]@3
-  //int pTargetXY[2]; // [sp+10h] [bp-8h]@3
-
-  //v0 = stru_505708[0].field_24;
-  //if ( stru_505708[0].field_24 > dword_4E1884 )
-  //  v0 = dword_4E1884;
-  //v7 = 0;
-  //pSrcXYZW[0] = 892;
-  //v8 = 937;
-  //pTargetXY[0] = 102;
-  //v1 = 200 * v0 / dword_4E1884;
-  //v9 = v1;
-  //pTargetXY[1] = 297 - v1;
-  //Blt_Copy(pSrcXYZW, pTargetXY, 2);
-  //v7 = 0;
-  //v2 = 203 - v1;
-  //pTargetXY[1] = 203 - v1;
-  //LOWORD(v2) = pArcomageGame->field_54;
-  //pSrcXYZW[0] = 384;
-  //v8 = 452;
-  //v9 = 94;
-  //pTargetXY[0] = 91;
-  //Blt_Chroma(pSrcXYZW, pTargetXY, v2, 2);
-  //v3 = stru_505708[1].field_24;
-  //if ( stru_505708[1].field_24 > dword_4E1884 )
-  //  v3 = dword_4E1884;
-  //v7 = 0;
-  //pSrcXYZW[0] = 892;
-  //v8 = 937;
-  //pTargetXY[0] = 494;
-  //v4 = 200 * v3 / dword_4E1884;
-  //v9 = v4;
-  //pTargetXY[1] = 297 - v4;
-  //Blt_Copy(pSrcXYZW, pTargetXY, 2);
-  //LOWORD(v5) = pArcomageGame->field_54;
-  //pSrcXYZW[0] = 384;
-  //v8 = 452;
-  //v7 = 94;
-  //v9 = 188;
-  //pTargetXY[0] = 483;
-  //pTargetXY[1] = 203 - v4;
-  //Blt_Chroma(pSrcXYZW, pTargetXY, v5, 2);
+void DrawPlayersTowers()
+    {
+int tower_height; // eax@1
+int tower_top; // esi@3
+RECT pSrcXYZW; // [sp+0h] [bp-18h]@3
+POINT pTargetXY; // [sp+10h] [bp-8h]@3
+
+tower_height= am_Players[0].tower_height;
+if ( am_Players[0].tower_height > max_tower_height )
+      tower_height = max_tower_height;
+pSrcXYZW.top = 0;
+pSrcXYZW.left = 892;
+pSrcXYZW.right = 937;
+tower_top = 200 * tower_height / max_tower_height;
+pSrcXYZW.bottom = tower_top;
+pTargetXY.x = 102;
+pTargetXY.y = 297 - tower_top;
+Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+
+pSrcXYZW.top = 0;
+pSrcXYZW.left = 384;
+pSrcXYZW.right = 452;
+pSrcXYZW.bottom = 94;
+pTargetXY.y = 203 - tower_top;
+pTargetXY.x = 91;
+Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+
+
+tower_height = am_Players[1].tower_height;
+if (am_Players[1].tower_height  > max_tower_height )
+    tower_height = max_tower_height;
+tower_top = 200 * tower_height / max_tower_height;
+pSrcXYZW.top    = 0;
+pSrcXYZW.left   = 892;
+pSrcXYZW.right  = 937;
+pSrcXYZW.bottom = tower_top;
+
+pTargetXY.x = 494;
+pTargetXY.y = 297 - tower_top;
+Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+//draw tower up cone
+pSrcXYZW.left   = 384;
+pSrcXYZW.right  = 452;
+pSrcXYZW.top    =  94;
+pSrcXYZW.bottom = 188;
+
+pTargetXY.x = 483;
+pTargetXY.y = 203 - tower_top;
+Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+ 
 }
 // 4E1884: using guessed type int dword_4E1884;
 
 //----- (0040B400) --------------------------------------------------------
-void __cdecl am_chroma_blt()
-{
-//  int v0; // eax@1
-//  int v1; // eax@4
-//  int v2; // ecx@4
-//  int v3; // eax@5
-//  int v4; // eax@8
-//  int v5; // esi@8
-//  int pSrcXYZW[4]; // [sp+4h] [bp-18h]@4
-//  int pTargetXY[2]; // [sp+14h] [bp-8h]@4
-//
-//  v0 = stru_505708[0].field_28;
-//  if ( stru_505708[0].field_28 <= 100 )
-//  {
-//    if ( stru_505708[0].field_28 <= 0 )
-//      goto LABEL_5;
-//  }
-//  else
-//  {
-//    v0 = 100;
-//  }
-//  pSrcXYZW[1] = 0;
-//  pSrcXYZW[0] = 843;
-//  v1 = 200 * v0 / 100;
-//  pSrcXYZW[2] = 867;
-//  pTargetXY[0] = 177;
-//  pSrcXYZW[3] = v1;
-//  v2 = 297 - v1;
-//  LOWORD(v1) = pArcomageGame->field_54;
-//  pTargetXY[1] = v2;
-//  Blt_Chroma(pSrcXYZW, pTargetXY, v1, 2);
-//LABEL_5:
-//  v3 = stru_505708[1].field_28;
-//  if ( stru_505708[1].field_28 <= 100 )
-//  {
-//    if ( stru_505708[1].field_28 <= 0 )
-//      return;
-//  }
-//  else
-//  {
-//    v3 = 100;
-//  }
-//  pSrcXYZW[1] = 0;
-//  pSrcXYZW[0] = 843;
-//  v4 = 200 * v3 / 100;
-//  pSrcXYZW[2] = 867;
-//  pTargetXY[0] = 439;
-//  pSrcXYZW[3] = v4;
-//  v5 = 297 - v4;
-//  LOWORD(v4) = pArcomageGame->field_54;
-//  pTargetXY[1] = v5;
-//  Blt_Chroma(pSrcXYZW, pTargetXY, v4, 2);
+void DrawPlayersWall()
+    {
+int v0; // eax@1
+int v1; // eax@4
+LONG v2; // ecx@4
+int v3; // eax@5
+int v4; // eax@8
+LONG v5; // esi@8
+RECT pSrcXYZW; // [sp+4h] [bp-18h]@4
+POINT pTargetXY; // [sp+14h] [bp-8h]@4
+
+v0 = am_Players[0].wall_height;
+
+if ( am_Players[0].wall_height > 100 )
+    v0 = 100;
+
+if ( am_Players[0].wall_height > 0 )
+       {
+
+pSrcXYZW.top = 0;
+pSrcXYZW.left = 843;
+v1 = 200 * v0 / 100;
+pSrcXYZW.right = 867;
+pSrcXYZW.bottom = v1;
+pTargetXY.x = 177;
+pTargetXY.y = 297 - v1;
+Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+ }
+
+v3 = am_Players[1].wall_height;
+if ( am_Players[1].wall_height > 100 )
+ v3 = 100;
+
+    
+    if ( am_Players[1].wall_height <= 0 )
+        {
+ 
+pSrcXYZW.top = 0;
+pSrcXYZW.left = 843;
+v4 = 200 * v3 / 100;
+pSrcXYZW.right = 867;
+pSrcXYZW.bottom = v4;
+pTargetXY.x = 439;
+pTargetXY.y =  297 - v4;
+Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+        }
 }
 
 //----- (0040B4B9) --------------------------------------------------------
-void __cdecl am_40B4B9()
-{
-//  int v0; // esi@1
-//  int v1; // ebx@1
-//  int v2; // edi@1
-//  int v3; // edx@2
-//  int v4; // eax@3
-//  int v5; // ecx@3
-//  int v6; // eax@3
-//  unsigned int v7; // ecx@4
-//  int v8; // eax@16
-//  int v9; // ecx@16
-//  int v10; // eax@16
-//  signed int v11; // edi@18
-//  int v12; // esi@20
-//  unsigned int v13; // ecx@20
-//  int v14; // eax@23
-//  unsigned int v15; // eax@25
-//  unsigned int v16; // ecx@25
-//  int *v17; // esi@26
-//  unsigned int v18; // eax@29
-//  int *v19; // ecx@29
-//  int v20; // ecx@31
-//  int v21; // [sp-4h] [bp-2Ch]@8
-//  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@8
-//  int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@1
-//  int v24; // [sp+24h] [bp-4h]@1
-//
-//  v0 = GetPlayerHandCardCount(amuint_4FAA6C);
-//  v1 = 0;
-//  v2 = 0;
-//  pTargetXY[1] = 327;
-//  v24 = (640 - 96 * v0) / (v0 + 1);
-//  pTargetXY[0] = (640 - 96 * v0) / (v0 + 1);
-//  while ( v2 < v0 )
-//  {
-//    v3 = amuint_4FAA6C;
-//    if ( am_byte_4E185D != (_BYTE)v1 )
-//    {
-//      v4 = 188 * amuint_4FAA6C + 8 * v2;
-//      v5 = *(int *)((char *)stru_505708[0].arr_6C[0] + v4);
-//      v6 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v4);
-//      pTargetXY[0] += v5;
-//      pTargetXY[1] += v6;
-//    }
-//    v7 = stru_505708[0].cards_at_hand[v2 + 47 * amuint_4FAA6C];
-//    if ( v7 == -1 )
-//    {
-//      ++v0;
-//      goto LABEL_15;
-//    }
-//    if ( v2 != amuint_4FAA4C )
-//    {
-//      if ( LOBYTE(stru_505708[amuint_4FAA6C].field_20) == (_BYTE)v1 && byte_505881 == (_BYTE)v1 )
-//      {
-//        pSrcXYZW[0] = 192;
-//        pSrcXYZW[2] = 288;
-//        pSrcXYZW[1] = v1;
-//        pSrcXYZW[3] = 128;
-//        v21 = 2;
-//LABEL_12:
-//        Blt_Copy(pSrcXYZW, pTargetXY, v21);
-//        goto LABEL_13;
-//      }
-//      ArcomageGame::GetCardRect(v7, pSrcXYZW);
-//      if ( !am_40BF15(amuint_4FAA6C, v2) )
-//      {
-//        v1 = 0;
-//        v21 = 0;
-//        goto LABEL_12;
-//      }
-//      Blt_Copy(pSrcXYZW, pTargetXY, 2);
-//      v1 = 0;
-//    }
-//LABEL_13:
-//    v3 = amuint_4FAA6C;
-//    pTargetXY[0] += v24 + 96;
-//LABEL_15:
-//    if ( am_byte_4E185D != (_BYTE)v1 )
-//    {
-//      v8 = 188 * v3 + 8 * v2;
-//      v9 = *(int *)((char *)stru_505708[0].arr_6C[0] + v8);
-//      v10 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v8);
-//      pTargetXY[0] -= v9;
-//      pTargetXY[1] -= v10;
-//    }
-//    ++v2;
-//  }
-//  v11 = 0;
-//  do
-//  {
-//    if ( am_byte_4FAA76 == (_BYTE)v1 )
-//    {
-//      v12 = 4 * v11;
-//      v13 = amuint_4FAA78[8 * v11];
-//      if ( v13 != -1 )
-//      {
-//        ArcomageGame::GetCardRect(v13, pSrcXYZW);
-//        Blt_Copy((ArcomageRect *)pSrcXYZW, amuint_4FAA90[v12], v1);
-//      }
-//      if ( am_byte_4FAA7C[v12 * 8] != (_BYTE)v1 )
-//      {
-//        pTargetXY[0] = amuint_4FAA90[v12][0] + 12;
-//        v14 = amuint_4FAA90[v12][1] + 40;
-//        pTargetXY[1] = amuint_4FAA90[v12][1] + 40;
-//        LOWORD(v14) = pArcomageGame->field_54;
-//        pSrcXYZW[0] = 843;
-//        pSrcXYZW[2] = 916;
-//        pSrcXYZW[1] = 200;
-//        pSrcXYZW[3] = 216;
-//        Blt_Chroma(pSrcXYZW, pTargetXY, v14, 2);
-//      }
-//    }
-//    else
-//    {
-//      if ( amuint_4FAA34 <= v1 )
-//      {
-//        if ( v11 == 9 )
-//        {
-//          am_byte_4FAA76 = v1;
-//          am_byte_4FAA75 = v1;
-//          amuint_4FAA34 = 5;
-//        }
-//        v18 = 32 * v11;
-//        v19 = &amuint_4FAA78[8 * v11];
-//        if ( *v19 != -1 )
-//          amuint_4FABC4 = *v19;
-//        *v19 = -1;
-//        amuint_4FAA90[v18 / 8][0] = amuint_4FAA80[v18 / 4];
-//        v20 = amuint_4FAA84[v18 / 4];
-//        am_byte_4FAA7C[v18] = v1;
-//        amuint_4FAA90[v18 / 8][1] = v20;
-//      }
-//      else
-//      {
-//        v15 = 32 * v11;
-//        v16 = amuint_4FAA78[8 * v11];
-//        if ( v16 != -1 )
-//        {
-//          v17 = amuint_4FAA90[v15 / 8];
-//          *v17 += amuint_4FAA88[v15 / 4];
-//          amuint_4FAA90[v15 / 8][1] += amuint_4FAA8C[v15 / 4];
-//          ArcomageGame::GetCardRect(v16, pSrcXYZW);
-//          Blt_Copy(pSrcXYZW, v17, v1);
-//        }
-//      }
-//    }
-//    ++v11;
-//  }
-//  while ( v11 < 10 );
-//  if ( am_byte_4FAA76 != (_BYTE)v1 )
-//    --amuint_4FAA34;
-//  pSrcXYZW[0] = 192;
-//  pSrcXYZW[2] = 288;
-//  pSrcXYZW[1] = v1;
-//  pSrcXYZW[3] = 128;
-//  pTargetXY[0] = 120;
-//  pTargetXY[1] = 18;
-//  Blt_Copy(pSrcXYZW, pTargetXY, v1);
+void DrawCards()
+    {
+
+int v0; // esi@1
+char v1; // bl@1
+int v2; // edi@1
+int v3; // edx@2
+int v4; // eax@3
+int v5; // ecx@3
+int v6; // eax@3
+unsigned int v7; // ecx@4
+int v8; // eax@16
+int v9; // ecx@16
+int v10; // eax@16
+signed int v11; // edi@18
+signed int v12; // esi@20
+int v13; // ecx@20
+int v14; // eax@23
+signed int v15; // eax@25
+int v16; // ecx@25
+POINT *v17; // esi@26
+signed int v18; // eax@29
+Acromage_st1 *v19; // ecx@29
+int v20; // ecx@31
+int v21; // [sp-4h] [bp-2Ch]@8
+RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@8
+POINT pTargetXY; // [sp+1Ch] [bp-Ch]@1
+int v24; // [sp+24h] [bp-4h]@1
+
+v0 = GetPlayerHandCardCount(current_player_num);
+v2 = 0;
+pTargetXY.y = 327;
+v24 = (640 - 96 * v0) / (v0 + 1);
+pTargetXY.x = (640 - 96 * v0) / (v0 + 1);
+while ( v2 < v0 )
+    {
+    v3 = current_player_num;
+    if ( am_byte_4E185D)
+        {
+
+        pTargetXY.x += am_Players[current_player_num].arr_6C[v2].field_0 ;
+        pTargetXY.y += am_Players[current_player_num].arr_6C[v2].field_4;
+        }
+    v7 = am_Players[current_player_num].cards_at_hand[v2];
+    if ( v7 == -1 )
+        {
+        ++v0;
+        goto LABEL_15;
+        }
+    if ( v2 != amuint_4FAA4C )
+        {
+        if ( am_Players[current_player_num].IsHisTurn == 0 && byte_505881 == 0 )
+            {
+            pSrcXYZW.left = 192;
+            pSrcXYZW.right = 288;
+            pSrcXYZW.top = 0;
+            pSrcXYZW.bottom = 128;
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+            goto LABEL_13;
+            }
+        pArcomageGame->GetCardRect(v7, &pSrcXYZW);
+        if ( !CanCardBePlayed(current_player_num, v2) )
+            {
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+            goto LABEL_13;
+            }
+        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+
+        }
+LABEL_13:
+    v3 = current_player_num;
+    pTargetXY.x += v24 + 96;
+LABEL_15:
+    if ( am_byte_4E185D )
+        {
+        pTargetXY.x -= am_Players[current_player_num].arr_6C[v2].field_0 ;
+        pTargetXY.y -= am_Players[current_player_num].arr_6C[v2].field_4 ;
+        }
+    ++v2;
+    }
+
+for (v11=0; v11<10; ++v11)
+    {
+    if ( am_byte_4FAA76 == 0 )
+        {
+        if ( shown_cards[v11].uCardId != -1 )
+            {
+            pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW);
+            Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
+            }
+        if ( shown_cards[v11].field_4 != 0 )
+            {
+            pTargetXY.x = shown_cards[v11].field_18_point.x + 12;
+            pTargetXY.y = shown_cards[v11].field_18_point.y + 40;
+            pSrcXYZW.left   = 843;
+            pSrcXYZW.right  = 916;
+            pSrcXYZW.top    = 200;
+            pSrcXYZW.bottom = 216;
+            Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
+            }
+        }
+    else if ( amuint_4FAA34 <= 0 )
+        {
+        if ( v11 == 9 )
+            {
+            am_byte_4FAA76 = 0;
+            am_byte_4FAA75 = 0;
+            amuint_4FAA34 = 5;
+            }
+        if ( shown_cards[v11].uCardId != -1 )
+            amuint_4FABC4 = shown_cards[v11].uCardId;
+        shown_cards[v11].uCardId = -1;
+        shown_cards[v11].field_18_point.x = shown_cards[v11].field_8.x;
+        shown_cards[v11].field_18_point.y = shown_cards[v11].field_8.y;
+        shown_cards[v11].field_4 = 0;
+        }
+    else
+        {
+        if ( shown_cards[v11].uCardId != -1 )
+            {
+            shown_cards[v11].field_18_point.x += shown_cards[v11].field_10_xplus;
+            shown_cards[v11].field_18_point.y += shown_cards[v11].field_14_y_plus;
+            pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW);
+            Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0);
+            }
+        }
+    }
+    if ( am_byte_4FAA76 != 0 )
+        --amuint_4FAA34;
+
+    pSrcXYZW.left   = 192;
+    pSrcXYZW.right  = 288;
+    pSrcXYZW.top    = 0;
+    pSrcXYZW.bottom = 128;
+    pTargetXY.x     = 120;
+    pTargetXY.y     = 18;
+    Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+
 }
-// 4E185D: using guessed type char am_byte_4E185D;
-// 4FAA34: using guessed type int amuint_4FAA34;
-// 4FAA4C: using guessed type int amuint_4FAA4C;
-// 4FAA75: using guessed type char am_byte_4FAA75;
-// 4FAA76: using guessed type char am_byte_4FAA76;
-// 4FAA78: using guessed type int amuint_4FAA78[];
-// 4FAA80: using guessed type int amuint_4FAA80[];
-// 4FAA84: using guessed type int amuint_4FAA84[];
-// 4FAA88: using guessed type int amuint_4FAA88[];
-// 4FAA8C: using guessed type int amuint_4FAA8C[];
-// 4FABC4: using guessed type int amuint_4FABC4;
-// 505881: using guessed type char byte_505881;
-
 
 
 //----- (0040B76F) --------------------------------------------------------
-void __fastcall am_40B76F(int a1)
-{
-//  int v1; // eax@3
-//  int v2; // eax@3
-//  int v3; // esi@4
-//  int v4; // eax@4
-//  int *v5; // edx@6
-//  int *v6; // ecx@6
-//  signed int v7; // ebx@11
-//  int v8; // eax@15
-//  signed int v9; // ecx@15
-//  int v10; // eax@20
-//  int v11; // ecx@20
-//  int v12; // eax@20
-//  unsigned int v13; // ecx@21
-//  double v14; // st7@22
-//  int *v15; // edx@23
-//  int v16; // eax@32
-//  char v17; // zf@37
-//  int v18; // eax@41
-//  int v19; // eax@46
-//  int v20; // ecx@46
-//  int v21; // eax@46
-//  int v22; // [sp-4h] [bp-2Ch]@6
-//  int v23; // [sp-4h] [bp-2Ch]@28
-//  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@6
-//  int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@20
-//  int v26; // [sp+24h] [bp-4h]@1
-//
-//  v26 = a1;
-//  if ( amuint_4FAA4C != -1 )
-//  {
-//    if ( amuint_4FAA38 >= 9 )
-//    {
-//      am_uint_4FAA44_blt_xy[1] = 18;
-//      am_uint_4FAA44_blt_xy[0] = 120;
-//      v1 = GetPlayerHandCardCount(amuint_4FAA6C);
-//      v2 = (640 - 96 * v1) / v1 + 96;
-//      if ( am_byte_4E185D )
-//      {
-//        v3 = 188 * amuint_4FAA6C + 8 * amuint_4FAA4C;
-//        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 + *(int *)((char *)stru_505708[0].arr_6C[0] + v3) - 120) / 10;
-//        v4 = (*(int *)((char *)&stru_505708[0].arr_6C[0][1] + v3) + 309) / 10;
-//      }
-//      else
-//      {
-//        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 - 120) / 10;
-//        v4 = 30;
-//      }
-//      am_uint_4FAA44_blt_xy[1] += v4;
-//      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-//      pSrcXYZW[1] = 0;
-//      amuint_4FAA3C_blt_xy[1] = v4;
-//      pSrcXYZW[0] = 192;
-//      pSrcXYZW[2] = 288;
-//      pSrcXYZW[3] = 128;
-//      v5 = am_uint_4FAA44_blt_xy;
-//      v6 = pSrcXYZW;
-//      goto LABEL_7;
-//    }
-//    pSrcXYZW[1] = 0;
-//    v6 = pSrcXYZW;
-//    v5 = am_uint_4FAA44_blt_xy;
-//
-//    pSrcXYZW[3] = 128;
-//    pSrcXYZW[2] = 288;
-//    pSrcXYZW[0] = 192;
-//    if ( amuint_4FAA38 )
-//    {
-//      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-//      am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
-//LABEL_7:
-//      Blt_Copy(v6, v5, 2);
-//      goto LABEL_11;
-//    }
-//    am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-//    am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
-//    Blt_Copy(pSrcXYZW, am_uint_4FAA44_blt_xy, 2);
-//    amuint_4FAA4C = -1;
-//  }
-//LABEL_11:
-//  v7 = (signed int)amuint_4FAA78;
-//  if ( uCardID != -1 )
-//  {
-//    if ( v26 <= 10 )
-//    {
-//      if ( v26 == 10 )
-//      {
-//        ArcomageGame::GetCardRect(uCardID, pSrcXYZW);
-//        v8 = 0;
-//        v9 = (signed int)amuint_4FAA78;
-//        while ( *(unsigned int *)v9 != -1 )
-//        {
-//          v9 += 32;
-//          ++v8;
-//          if ( v9 >= (signed int)&dword_4FABB8 )
-//            goto LABEL_20;
-//        }
-//        amuint_4FAA78[8 * v8] = uCardID;
-//        am_byte_4FAA7C[32 * v8] = 1;
+void DrawCardAnimation( int animation_stage )
+    {
+
+int v1; // eax@3
+int v2; // eax@3
+int v3; // esi@4
+int v4; // eax@4
+POINT *v5; // edx@6
+RECT *v6; // ecx@6
+
+int v8; // eax@15
+Acromage_st1 *v9; // ecx@15
+int v10; // ecx@19
+int v11; // eax@20
+int v12; // ecx@20
+int v13; // eax@20
+unsigned int v14; // ecx@21
+double v15; // st7@22
+POINT *v16; // edx@23
+int v17; // eax@32
+char v18; // zf@37
+int v19; // eax@41
+int v20; // eax@46
+int v21; // ecx@46
+int v22; // eax@46
+int v23; // [sp-4h] [bp-2Ch]@28
+RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@6
+POINT pTargetXY; // [sp+1Ch] [bp-Ch]@20
+int v26; // [sp+24h] [bp-4h]@1
+
+v26 = animation_stage;
+if ( amuint_4FAA4C != -1 )
+    {
+    if ( amuint_4FAA38 >= 9 )
+        {
+        am_uint_4FAA44_blt_xy.y = 18;
+        am_uint_4FAA44_blt_xy.x = 120;
+        v1 = GetPlayerHandCardCount(current_player_num);
+        v2 = (640 - 96 * v1) / v1 + 96;
+        if ( am_byte_4E185D )
+            {
+           // v3 = 188 * current_player_num + 8 * amuint_4FAA4C;
+           // amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 + *(am_Players[0].arr_6C[0] + v3) - 120) / 10;
+            amuint_4FAA3C_blt_xy.x=(amuint_4FAA4C * v2 + am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_0-120)/10;
+            v4 = (am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_4+309) /10;//(*(&am_Players[0].arr_6C[0][1] + v3) + 309) / 10;
+            }
+        else
+            {
+            amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 - 120) / 10;
+            v4 = 30;
+            }
+        am_uint_4FAA44_blt_xy.y += v4;
+        am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
+        
+        amuint_4FAA3C_blt_xy.y = v4;
+        
+        pSrcXYZW.left = 192;
+        pSrcXYZW.top = 0;
+        pSrcXYZW.right = 288;
+        pSrcXYZW.bottom = 128;
+        Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
+        }
+    else
+        {
+
+    
+    pSrcXYZW.left  = 192;
+    pSrcXYZW.top    = 0;
+    pSrcXYZW.right  = 288;
+    pSrcXYZW.bottom = 128;
+    am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
+    am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y;
+    Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
+    if ( !amuint_4FAA38 )
+        {
+        
+    amuint_4FAA4C = -1;
+        }
+        }
+    }
+LABEL_11:
+
+if ( uCardID != -1 )
+    {
+    if ( v26 <= 10 )
+        {
+        if ( v26 == 10 )
+            {
+            pArcomageGame->GetCardRect(uCardID, &pSrcXYZW);
+          //  v8 = 0;
+            for (v8=0; v8<10; ++v8)
+                {
+                if (shown_cards[v8].uCardId==-1)
+                    {
+                    shown_cards[v8].uCardId = uCardID;
+                    shown_cards[v8].field_4 = 1;
+                    break;
+                    }
+                }
+            /* v9 = shown_cards;
+            while ( v9->uCardId != -1 )
+            {
+            ++v9;
+            ++v8;
+            if ( v9 >= &dword_4FABB8 )
+            goto LABEL_20;
+            }
+
+            v10 = v8;
+            shown_cards[v10].uCardId = uCardID;
+            shown_cards[v10].field_4 = 1;*/
 //LABEL_20:
-//        v10 = 8 * v8;
-//        v11 = amuint_4FAA80[v10];
-//        v12 = amuint_4FAA84[v10];
-//        pTargetXY[0] = v11;
-//        pTargetXY[1] = v12;
-//        Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
-//        uCardID = -1;
-//      }
-//    }
-//    else
-//    {
-//      ArcomageGame::GetCardRect(uCardID, pSrcXYZW);
-//      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-//      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-//      Blt_Copy(pSrcXYZW, amuint_4FAA5C_blt_xy, 0);
-//    }
-//  }
-//  v13 = amuint_4FABC0;
-//  if ( amuint_4FABC0 != -1 )
-//  {
-//    v14 = (double)v26;
-//    if ( v14 > 15.0 )
-//    {
-//      ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
-//      v15 = amuint_4FAA5C_blt_xy;
-//      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-//      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-//LABEL_28:
-//      v23 = 2;
-//LABEL_29:
-//      Blt_Copy(pSrcXYZW, v15, v23);
-//      return;
-//    }
-//    if ( v14 == 15.0 )
-//    {
-//      am_40BF77(amuint_4FAA6C, amuint_4FABC0);
-//      v13 = amuint_4FABC0;
-//      goto LABEL_26;
-//    }
-//    if ( v14 == 5.0 )
-//    {
-//      amuint_4FAA5C_blt_xy[0] = 272;
-//      amuint_4FAA5C_blt_xy[1] = 173;
-//      v16 = 0;
-//      do
-//      {
-//        if ( *(unsigned int *)v7 == -1 )
-//          break;
-//        v7 += 32;
-//        ++v16;
-//      }
-//      while ( v7 < (signed int)&dword_4FABB8 );
-//      v26 = 32 * v16;
-//      amuint_4FAA54_blt_xy[0] = (amuint_4FAA80[8 * v16] - 272) / 5;
-//      amuint_4FAA54_blt_xy[1] = (amuint_4FAA84[8 * v16] - 173) / 5;
-//      ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
-//      pTargetXY[0] = 272;
-//      pTargetXY[1] = 173;
-//      goto LABEL_27;
-//    }
-//    if ( v14 >= 5.0 )
-//    {
-//      v17 = v26 == 0;
-//    }
-//    else
-//    {
-//      v17 = v26 == 0;
-//      if ( v26 > 0 )
-//      {
-//        ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
-//        v15 = amuint_4FAA5C_blt_xy;
-//        amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-//        amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-//        v23 = 0;
-//        goto LABEL_29;
-//      }
-//    }
-//    if ( !v17 )
-//    {
-//LABEL_26:
-//      ArcomageGame::GetCardRect(v13, pSrcXYZW);
-//      pTargetXY[0] = 272;
-//      pTargetXY[1] = 173;
-//LABEL_27:
-//      v15 = pTargetXY;
-//      goto LABEL_28;
-//    }
-//    ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
-//    v18 = 0;
-//    while ( *(unsigned int *)v7 != -1 )
-//    {
-//      v7 += 32;
-//      ++v18;
-//      if ( v7 >= (signed int)&dword_4FABB8 )
-//        goto LABEL_46;
-//    }
-//    amuint_4FAA78[8 * v18] = amuint_4FABC0;
-//LABEL_46:
-//    v19 = 8 * v18;
-//    v20 = amuint_4FAA80[v19];
-//    v21 = amuint_4FAA84[v19];
-//    pTargetXY[0] = v20;
-//    pTargetXY[1] = v21;
-//    Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
-//    amuint_4FABC0 = -1;
-//  }
+            pTargetXY.x = shown_cards[v8].field_8.x;
+            pTargetXY.y = shown_cards[v8].field_8.y;
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+            uCardID = -1;
+            }
+        }
+    else
+        {
+        pArcomageGame->GetCardRect(uCardID, &pSrcXYZW);
+        amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+        amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+        Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+        }
+    }
+
+if ( played_card_id != -1 )
+    {
+    v15 = v26;
+    if ( v15 > 15.0 )
+        {
+        pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+        amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+        amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+        Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 2);
+        return;
+        }
+    if ( v15 == 15.0 )
+        {
+        ApplyCardToPlayer(current_player_num, played_card_id);
+        pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+        pTargetXY.x = 272;
+        pTargetXY.y = 173;
+        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        return;
+        }
+    if ( v15 == 5.0 )
+        {
+        amuint_4FAA5C_blt_xy.x = 272;
+        amuint_4FAA5C_blt_xy.y = 173;
+        for (v17=0; v17<10; ++v17)
+            {
+            if (shown_cards[v17].uCardId==-1)
+                break;
+            }
+        /* v17 = 0;
+        do
+        {
+        if ( v7->uCardId == -1 )
+        break;
+        ++v7;
+        ++v17;
+        }
+        while ( v7 < &dword_4FABB8 );*/
+           // v26 = 32 * v17;
+
+            amuint_4FAA54_blt_xy.x = (shown_cards[v17].field_8.x - 272) / 5;
+            amuint_4FAA54_blt_xy.y = (shown_cards[v17].field_8.y - 173) / 5;
+            pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+            pTargetXY.x = 272;
+            pTargetXY.y = 173;
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+            return;
+        }
+    if ( v15 >= 5.0 )
+        {
+        v18 = v26 == 0;
+        }
+    else
+        {
+        v18 = v26 == 0;
+        if ( v26 > 0 )
+            {
+            pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+            amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+            amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+            Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+            return;
+            }
+        }
+    if ( !v18 )
+        {
+
+        pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+        pTargetXY.x = 272;
+        pTargetXY.y = 173;
+        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        return;
+        }
+
+    pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+    for (v19=0; v19<10; ++v19)
+        {
+        if (shown_cards[v19].uCardId==-1)
+            {
+            shown_cards[v19].uCardId = played_card_id;
+            break;
+            }       
+        }
+        pTargetXY.x = shown_cards[v19].field_8.x;
+    pTargetXY.y = shown_cards[v19].field_8.y;
+    Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+    played_card_id = -1;
+    }
 }
-// 4E185D: using guessed type char am_byte_4E185D;
-// 4FAA38: using guessed type int amuint_4FAA38;
-// 4FAA4C: using guessed type int amuint_4FAA4C;
-// 4FAA78: using guessed type int amuint_4FAA78[];
-// 4FAA80: using guessed type int amuint_4FAA80[];
-// 4FAA84: using guessed type int amuint_4FAA84[];
-// 4FABB8: using guessed type int dword_4FABB8;
 
 //----- (0040BB12) --------------------------------------------------------
 void ArcomageGame::GetCardRect(unsigned int uCardID, RECT *pCardRect)
@@ -3200,145 +3056,144 @@
 }
 
 //----- (0040BB67) --------------------------------------------------------
-signed int __fastcall am_40BB67(int a1)
-{
-  int v1; // esi@1
-  signed int result; // eax@1
-  int v3; // ebx@1
-  char v4; // zf@1
-  int v5; // eax@3
-  int v6; // eax@4
-  int v7; // ecx@6
-  char *v8; // eax@6
-  int v9; // eax@10
-  int v10; // ecx@10
-  int v11; // eax@10
-  char v12; // ch@2@11
-  int v13; // ST00_4@12
-  unsigned __int16 v14; // ax@12
-  int v15; // eax@13
-  int v16; // ecx@13
-  int v17; // eax@13
-  char v18; // al@16
-  char v19; // ch@2@16
-  int v20; // ST00_4@19
-  unsigned __int16 v21; // ax@19
-  int pXYZW[4]; // [sp+Ch] [bp-3Ch]@3
-  stru273 v26; // [sp+1Ch] [bp-2Ch]@2
-  int a1a; // [sp+28h] [bp-20h]@1
-  int v25; // [sp+2Ch] [bp-1Ch]@3
-  int var18; // [sp+30h] [bp-18h]@3
-  int i; // [sp+34h] [bp-14h]@4
-  int v28; // [sp+38h] [bp-10h]@1
-  int a2; // [sp+3Ch] [bp-Ch]@3
-  int v30; // [sp+40h] [bp-8h]@1
-  char v31; // [sp+44h] [bp-4h]@12
-  char v32; // [sp+45h] [bp-3h]@12
-  char v33; // [sp+46h] [bp-2h]@12
-
-  v1 = a1;
-  v30 = 0;
-  result = -1;
-  v3 = 188 * a1;
-  a1a = a1;
-  v4 = LOBYTE(am_Players[a1].field_20) == 0;
-  v28 = -1;
-  if ( !v4 )
-  {
+signed int DrawCardsRectangles( int player_num )
+    {
+//need do fix rectangle not fit to card
+
+//int v1; // esi@1
+signed int result; // eax@1
+int v3; // ebx@1
+char v4; // zf@1
+int v5; // eax@3
+int v6; // eax@4
+int v7; // ecx@6
+char *v8; // eax@6
+int v9; // eax@10
+int v10; // ecx@10
+int v11; // eax@10
+char v12; // ch@2@11
+int v13; // ST00_4@12
+unsigned __int16 v14; // ax@12
+int v15; // eax@13
+int v16; // ecx@13
+int v17; // eax@13
+char v18; // al@16
+char v19; // ch@2@16
+int v20; // ST00_4@19
+unsigned __int16 v21; // ax@19
+RECT pXYZW; // [sp+Ch] [bp-3Ch]@3
+stru273 v26; // [sp+1Ch] [bp-2Ch]@2
+int v25; // [sp+2Ch] [bp-1Ch]@3
+__int32 var18; // [sp+30h] [bp-18h]@3
+int i; // [sp+34h] [bp-14h]@4
+int v28; // [sp+38h] [bp-10h]@1
+int hand_index; // [sp+3Ch] [bp-Ch]@3
+int v30; // [sp+40h] [bp-8h]@1
+char v31; // [sp+44h] [bp-4h]@12
+char v32; // [sp+45h] [bp-3h]@12
+char v33; // [sp+46h] [bp-2h]@12
+
+
+v30 = 0;
+result = -1;
+//v3 = 188 * a1;
+
+//v4 = LOBYTE(am_Players[a1].field_20) == 0;
+v28 = -1;
+if ( am_Players[player_num].IsHisTurn )
+    {
     if ( v26._40DD2F() )
-    {
-      v5 = GetPlayerHandCardCount(v1);
-      a2 = 0;
-      v25 = v5;
-      pXYZW[1] = 327;
-      pXYZW[3] = 455;
-      pXYZW[0] = (640 - 96 * v5) / (v5 + 1);
-      var18 = pXYZW[0] + 96;
-      pXYZW[2] = pXYZW[0] + 96;
-      if ( v5 > 0 )
-      {
-        v6 = 47 * v1;
-        for ( i = 47 * v1; ; v6 = i )
         {
-          v7 = v30;
-          v8 = (char *)&am_Players[0].cards_at_hand[v30 + v6];
-          if ( *(unsigned int *)v8 == -1 )
-          {
-            do
+        v5 = GetPlayerHandCardCount(player_num);
+        hand_index = 0;
+        v25 = v5;
+        pXYZW.top = 327;
+        pXYZW.bottom = 455;
+        pXYZW.left = (640 - 96 * v5) / (v5 + 1);
+        var18 = pXYZW.left + 96;
+        pXYZW.right = pXYZW.left + 96;
+        if ( v5 > 0 )
             {
-              v8 += 4;
-              ++v7;
+           // v6 = 47 * v1;
+           // for ( i = player_num; ; v6 = i )
+            for(;;)
+                {
+                v7 = v30;
+              //  v8 = &am_Players[0].cards_at_hand[v30 + v6];
+
+                for (v7=0; v7<10; ++v7)
+                    {
+                    if (am_Players[player_num].cards_at_hand[v7]!= -1 )
+                        break;
+                    }
+                //if ( *v8 )
+                //    {
+                //    do
+                //        {
+                //        //v8 += 4;
+                //        ++v7;
+                //        }
+                //        while ( *v8 == -1 );
+                        v30 = v7;
+                  //  }
+                if ( am_byte_4E185D )
+                    {
+                 //   v9 = v3 + 8 * v7;
+                    v10 = am_Players[player_num].arr_6C[v7].field_0;//*(am_player[0].arr_6C[0] + v9);
+                    v11 = am_Players[player_num].arr_6C[v7].field_4;//*(&am_player[0].arr_6C[0][1] + v9);
+                    pXYZW.left += v10;
+                    pXYZW.right += v10;
+                    pXYZW.top += v11;
+                    pXYZW.bottom += v11;
+                    }
+                if (v26.Inside(&pXYZW) )
+                    break;
+           
+                v13=0;
+                v14 = R8G8B8_to_TargetFormat(v13);
+                DrawRect(&pXYZW, v14, 0);
+                pXYZW.left += var18;
+                pXYZW.right += var18;
+                if ( am_byte_4E185D )
+                    {
+                    v16 = am_Players[player_num].arr_6C[v30].field_0;//*(am_player[0].arr_6C[0] + v15);
+                    v17 = am_Players[player_num].arr_6C[v30].field_4;//*(&am_player[0].arr_6C[0][1] + v15);
+                    pXYZW.left -= v16;
+                    pXYZW.right -= v16;
+                    pXYZW.top -= v17;
+                    pXYZW.bottom -= v17;
+                    }
+                ++v30;
+                ++hand_index;
+                if ( hand_index >= v25 )
+                    return v28;
+                }
+            v28 = hand_index;
+            v18 = CanCardBePlayed(player_num, hand_index);
+            if ( v18 )
+                {
+                 v20=0x00FFFFFF;
+                }
+            else
+                {
+                v20=0x000000FF;
+                }
+           
+            v21 = R8G8B8_to_TargetFormat(v20);
+            DrawRect(&pXYZW, v21, 0);
             }
-            while ( *(unsigned int *)v8 == -1 );
-            v30 = v7;
-          }
-          if ( am_byte_4E185D )
-          {
-            v9 = v3 + 8 * v7;
-          //  v10 = *(int *)((char *)am_Players[0].arr_6C[0] + v9);
-         //   v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9);
-            pXYZW[0] += v10;
-            pXYZW[2] += v10;
-            pXYZW[1] += v11;
-            pXYZW[3] += v11;
-          }
-          if ( true)//v26.Inside(pXYZW) )
-            break;
-          v31 = 0;
-          v32 = 0;
-          v33 = 0;
-          BYTE3(v13) = v12;
-          LOWORD(v13) = *(_WORD *)&v31;
-          BYTE2(v13) = 0;
-          v14 = R8G8B8_to_TargetFormat(v13);
-       //   DrawRect(pXYZW, v14, 0);
-          pXYZW[0] += var18;
-          pXYZW[2] += var18;
-          if ( am_byte_4E185D )
-          {
-            v15 = v3 + 8 * v30;
-           // v16 = *(int *)((char *)am_Players[0].arr_6C[0] + v15);
-          //  v17 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v15);
-            pXYZW[0] -= v16;
-            pXYZW[2] -= v16;
-            pXYZW[1] -= v17;
-            pXYZW[3] -= v17;
-          }
-          ++v30;
-          ++a2;
-          if ( a2 >= v25 )
-            goto LABEL_20;
         }
-        v28 = a2;
-        v18 = am_40BF15(a1a, a2);
-        v31 = -1;
-        if ( v18 )
-        {
-          v32 = -1;
-          v33 = -1;
-        }
-        else
-        {
-          v32 = 0;
-          v33 = 0;
-        }
-        BYTE3(v20) = v19;
-        LOWORD(v20) = *(_WORD *)&v31;
-        BYTE2(v20) = v33;
-        v21 = R8G8B8_to_TargetFormat(v20);
-       // DrawRect(pXYZW, v21, 0);
-      }
+    result = v28;
     }
-LABEL_20:
-    result = v28;
-  }
-  return result;
+return result;
+
+
 }
 // 4E185D: using guessed type char am_byte_4E185D;
 
 //----- (0040BCFB) --------------------------------------------------------
-char __fastcall am_40BCFB(int a1, signed int a2)
-{
+bool am_40BCFB( int player_num, signed int card_slot_index )
+    {
   int v2; // esi@2
   signed int v3; // edi@2
   char *v4; // eax@2
@@ -3353,64 +3208,50 @@
   signed int v13; // edx@9
   unsigned int v14; // eax@12
   char result; // al@12
-
-  if ( a2 <= -1 )
-    goto LABEL_16;
+  int i;
+
+  if ( card_slot_index <= -1 )
+    return false;
   v2 = 0;
-  v3 = 0;
-  v4 = (char *)am_Players[a1].cards_at_hand;
-  do
+
+  for(i=0; i<10; ++i)
   {
-    if ( *(unsigned int *)v4 != -1 )
+    if ( am_Players[player_num].cards_at_hand[i] != -1 )
     {
-      if ( a2 == v2 )
+      if ( card_slot_index == v2 )
         break;
       ++v2;
     }
-    ++v3;
-    v4 += 4;
   }
-  while ( v3 < 10 );
-  v5 = v3 + 47 * a1;
-  v6 = 4 * v5 + 5265228;
-  if ( BYTE3(pCards[am_Players[0].cards_at_hand[v5]].field_28) )
+
+  if ( pCards[am_Players[player_num].cards_at_hand[i]].field_2B) 
   {
-    ArcomageGame::PlaySound(0x16u);
-    v7 = amuint_4FAA6C;
-    v8 = GetPlayerHandCardCount(amuint_4FAA6C);
-    v9 = 188 * v7 + 8 * v3;
-//    v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1);
-   // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327;
-    amuint_4FAA5C_blt_xy[0] = v10;
-    amuint_4FAA5C_blt_xy[1] = v11;
+    ArcomageGame::PlaySound(22);
+    v8 = GetPlayerHandCardCount(current_player_num);
+    v10=am_Players[player_num].arr_6C[i].field_0 + (640 - 96 * v8) / (v8 + 1);
+    amuint_4FAA5C_blt_xy.x = v10;
+    amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[i].field_4 + 327;//v11;
     v12 = 0;
+
     if ( !am_byte_4FAA75 )
     {
-      v13 = (signed int)amuint_4FAA78;
-      do
-      {
-        if ( *(unsigned int *)v13 == -1 )
-          break;
-        v13 += 32;
-        ++v12;
-      }
-      while ( v13 < (signed int)&dword_4FABB8 );
+      for (v12=0; v12<10; ++v12)
+          {
+           if (shown_cards[v12].uCardId== -1)
+               break;
+          }
     }
     pArcomageGame->field_F6 = 1;
-    amuint_4FAA54_blt_xy[0] = (amuint_4FAA80[8 * v12] - v10) / 10;
-    amuint_4FAA54_blt_xy[1] = (amuint_4FAA84[8 * v12] - 327) / 10;
-    v14 = *(unsigned int *)v6;
-    *(unsigned int *)v6 = -1;
+    amuint_4FAA54_blt_xy.x = (shown_cards[v12].field_8.x - v10) / 10;
+    amuint_4FAA54_blt_xy.y = (shown_cards[v12].field_8.y - 327) / 10;
+
+    uCardID = am_Players[player_num].cards_at_hand[i];
+    am_Players[player_num].cards_at_hand[i] = -1;
     am_byte_4FAA77 = 0;
-    uCardID = v14;
-    result = 1;
+    return true;
   }
   else
-  {
-LABEL_16:
-    result = 0;
-  }
-  return result;
+    return false;
 }
 // 4FAA75: using guessed type char am_byte_4FAA75;
 // 4FAA77: using guessed type char am_byte_4FAA77;
@@ -3420,8 +3261,8 @@
 // 4FABB8: using guessed type int dword_4FABB8;
 
 //----- (0040BE0E) --------------------------------------------------------
-bool __fastcall am_40BE0E(int a1, signed int a2)
-{
+bool PlayCard( int player_num, signed int card_slot_num )
+    {
   bool result; // eax@0
   int v3; // ebp@1
   int v4; // ecx@2
@@ -3438,80 +3279,70 @@
   int v15; // ecx@8
   int v16; // ecx@8
 
-  v3 = a1;
-  if ( a2 <= -1 )
-    goto LABEL_12;
+  if ( card_slot_num <= -1 )
+    return false;
   v4 = 0;
-  v5 = &am_Players[v3];
-  v6 = 0;
-  v7 = (int)v5->cards_at_hand;
-  do
+
+  for (v6=0; v6<10; ++v6)
   {
-    if ( *(unsigned int *)v7 != -1 )
+    if ( am_Players[player_num].cards_at_hand[v6] != -1 )
     {
-      if ( a2 == v4 )
+      if ( card_slot_num == v4 )
         break;
       ++v4;
     }
-    ++v6;
-    v7 += 4;
   }
-  while ( v6 < 10 );
-  result = am_40BF15(v3, v6);
+
+  result = CanCardBePlayed(player_num, v6);
   if ( result )
   {
-    ArcomageGame::PlaySound(0x17u);
-    v8 = amuint_4FAA6C;
-    v9 = GetPlayerHandCardCount(amuint_4FAA6C);
-    v10 = 188 * v8 + 8 * v6;
-    v11 = v6 + 47 * v3;
-    amuint_4FAA54_blt_xy[1] = -30;
+    ArcomageGame::PlaySound(23);
+    v9 = GetPlayerHandCardCount(current_player_num);
+  //  v10 = 188 * v8 + 8 * v6;
+  //  v11 = v6 + 47 * v3;
     pArcomageGame->field_F6 = 1;
-    //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1);
+    v12 =  am_Players[player_num].arr_6C[v6].field_0 + (640 - 96 * v9) / (v9 + 1)+ 96 * v6 +(640 - 96 * v9) / (v9 + 1);
   //  v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327;
-    amuint_4FAA5C_blt_xy[0] = v12;
-    amuint_4FAA5C_blt_xy[1] = v13;
-    amuint_4FAA54_blt_xy[0] = (272 - v12) / 5;
-    v14 = &pCards[v5->cards_at_hand[v6]];
-    v5->field_38 -= LOBYTE(v14->field_28);
-    v15 = BYTE1(v14->field_28);
-    v5->field_40 -= BYTE2(v14->field_28);
-    v5->field_3C -= v15;
-    result = 4 * v11 + 5265228;
-    v16 = am_Players[0].cards_at_hand[v11];
-    am_Players[0].cards_at_hand[v11] = -1;
-    amuint_4FABC0 = v16;
-    LOBYTE(result) = 1;
+    amuint_4FAA5C_blt_xy.x = v12;//v12;
+    amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[v6].field_4 + 327;//v13;
+
+    amuint_4FAA54_blt_xy.x = (272 - v12) / 5;
+    amuint_4FAA54_blt_xy.y = -30;
+
+    v14 = &pCards[am_Players[player_num].cards_at_hand[v6]];
+    am_Players[player_num].resource_bricks -= v14->needed_bricks;
+    am_Players[player_num].resource_beasts -= v14->needed_beasts;
+    am_Players[player_num].resource_gems   -= v14->needed_gems;
+    played_card_id = am_Players[player_num].cards_at_hand[v6];
+    am_Players[player_num].cards_at_hand[v6] = -1;
+    return true;;
   }
   else
-  {
-LABEL_12:
-    LOBYTE(result) = 0;
-  }
-  return result;
+   return false;
+
 }
 
 //----- (0040BF15) --------------------------------------------------------
-bool am_40BF15( int player_num, int hand_card_indx )
+bool CanCardBePlayed( int player_num, int hand_card_indx )
     {
   bool result; // eax@1
-  ArcomageCard *v4; // ecx@1
-  ArcomagePlayer *v2; // esi@1
-
-   v2 = &am_Players[player_num];
+  ArcomageCard *test_card; // ecx@1
+  ArcomagePlayer *pPlayer; // esi@1
+
+  pPlayer = &am_Players[player_num];
   result = true;
-  v4 = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]];
-  if ( v4->field_25 > v2->field_2C )
+  test_card = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]];
+  if ( test_card->needed_quarry_level > pPlayer->quarry_level )
     result = false;
-  if ( v4->field_26 > v2->field_30 )
+  if ( test_card->needed_magic_level > pPlayer->magic_level )
     result = false;
-  if ( v4->field_27 > v2->field_34 )
+  if ( test_card->needed_might_level > pPlayer->zoo_level )
     result = false;
-  if ( v4->field_28 > v2->field_38 )
+  if ( test_card->needed_bricks > pPlayer->resource_bricks )
     result = false;
-  if ( v4->field_29 > v2->field_3C )
+  if ( test_card->needed_gems > pPlayer->resource_gems )
     result = false;
-  if ( v4->field_2A > v2->field_40 )
+  if ( test_card->needed_beasts > pPlayer->resource_beasts )
     result = false;
   return result;
 }
@@ -3520,8 +3351,8 @@
 
 
 //----- (0040BF77) --------------------------------------------------------
-void __fastcall am_40BF77(int a1, unsigned int uCardID)
-{
+void ApplyCardToPlayer( int player_num, unsigned int uCardID )
+    {
 //  ArcomagePlayer *v2; // esi@1
 //  int v3; // eax@1
 //  ArcomagePlayer *v4; // edi@1
@@ -5481,15 +5312,11 @@
     {
   int v2; // ebp@1
   POINT *v3; // edi@1
-  char *v4; // ebx@1
   int result; // eax@3
-  unsigned int v6; // esi@7
-  stru272_stru0 *v7; // ecx@10
+  int v6;
   stru272_stru0 *v8; // ecx@12
-  int v9; // edx@17
-  int v10; // ecx@17
   signed int v11; // [sp+10h] [bp-8h]@1
-  stru272_stru0 **v12; // [sp+14h] [bp-4h]@1
+ 
 
   v11 = 0;
   v2 = a2;
@@ -5555,41 +5382,44 @@
 
 
 //----- (0040D402) --------------------------------------------------------
-int __fastcall am_40D402(int a1, int a2)
-{
+int am_40D402( int player_num, int damage )
+    {
   ArcomagePlayer *v2; // ecx@1
   int v3; // esi@1
   int result; // eax@3
 
-  v2 = &am_Players[a1];
-  v3 = v2->field_28;
+
+  v3 = am_Players[player_num].wall_height;
   if ( v3 <= 0 )
   {
     result = 0;
   }
   else
   {
-    if ( v3 >= -a2 )
+    if ( v3 >= -damage )
     {
-      result = a2;
-      v2->field_28 = a2 + v3;
-      goto LABEL_7;
+      result = damage;
+      am_Players[player_num].wall_height += damage;
+
     }
-    a2 += v3;
+    else
+        {      
+    damage += v3;
     result = -v3;
-    v2->field_28 = 0;
+    am_Players[player_num].wall_height = 0;
+    am_Players[player_num].tower_height += damage;
+        }
   }
-  v2->field_24 += a2;
-LABEL_7:
-  if ( v2->field_24 < 0 )
-    v2->field_24 = 0;
+
+  if ( am_Players[player_num].tower_height < 0 )
+    am_Players[player_num].tower_height = 0;
   return result;
 }
 // 40D402: using guessed type int __fastcall am_40D402(uint, uint);
 
 //----- (0040D444) --------------------------------------------------------
-int __cdecl am_40D444()
-{
+void GameResultsApply()
+    {
   int v0; // esi@1
   int v1; // edi@1
   int v2; // eax@1
@@ -5599,77 +5429,77 @@
   int v6; // eax@28
   GUIWindow *v7; // ecx@50
   signed int v8; // eax@50
-  char *v9; // eax@52
+  char v9; // eax@52
   signed int v10; // eax@54
   char *v11; // esi@59
   char *v12; // esi@65
   signed int v14; // [sp-4h] [bp-58h]@46
   char pText[64]; // [sp+Ch] [bp-48h]@1
-  int xy[2]; // [sp+4Ch] [bp-8h]@1
+  POINT xy; // [sp+4Ch] [bp-8h]@1
 
   v0 = -1;
   v1 = -1;
   //nullsub_1();
-  xy[0] = 0;
-  xy[1] = 0;
-  inv_strcpy("", pText);
-  v2 = 0;
-  xy[1] = 160;
-  xy[0] = 320 - 12 * v2 / 2;
+  xy.x = 0;
+  xy.y = 0;
+  strcpy(pText, "The Winner is: ");//""
+ // v2 = 0;
+  xy.y = 160;
+  xy.x = 320; //- 12 * v2 / 2;
 //  pPrimaryWindow_draws_text(-1, pText, xy);
-  if ( am_Players[0].field_24 < dword_4E1884 )
+  if ( am_Players[0].tower_height < max_tower_height )
   {
-    if ( am_Players[1].field_24 < dword_4E1884 )
+    if ( am_Players[1].tower_height < max_tower_height )
       goto LABEL_10;
     v0 = 2;
   }
   else
   {
-    if ( am_Players[1].field_24 < dword_4E1884 )
+    if ( am_Players[1].tower_height < max_tower_height )
     {
       v0 = 1;
     }
     else
     {
-      if ( am_Players[0].field_24 == am_Players[1].field_24 )
+      if ( am_Players[0].tower_height == am_Players[1].tower_height )
       {
         v0 = 0;
         v1 = 4;
         goto LABEL_10;
       }
-      v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1;
+      v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1;
     }
   }
   v1 = 0;
 LABEL_10:
-  if ( am_Players[0].field_24 <= 0 )
+  if ( am_Players[0].tower_height <= 0 )
   {
-    if ( am_Players[1].field_24 > 0 )
+    if ( am_Players[1].tower_height > 0 )
     {
       v0 = 2;
     }
     else
     {
-      if ( am_Players[0].field_24 == am_Players[1].field_24 )
+      if ( am_Players[0].tower_height == am_Players[1].tower_height )
       {
 LABEL_20:
-        if ( am_Players[0].field_28 == am_Players[1].field_28 )
+        if ( am_Players[0].wall_height == am_Players[1].wall_height )
         {
           v0 = 0;
           v1 = 4;
         }
         else
         {
-          v0 = (am_Players[0].field_28 <= am_Players[1].field_28) + 1;
+          v0 = (am_Players[0].wall_height <= am_Players[1].wall_height) + 1;
           v1 = 1;
         }
         goto LABEL_23;
       }
-      v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1;
+      v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1;
     }
     goto LABEL_17;
   }
-  if ( am_Players[1].field_24 <= 0 )
+  if ( am_Players[1].tower_height <= 0 )
   {
     v0 = 1;
 LABEL_17:
@@ -5678,35 +5508,35 @@
   if ( !v0 && v1 == 4 )
     goto LABEL_20;
 LABEL_23:
-  v3 = am_Players[0].field_38;
-  if ( am_Players[0].field_38 <= am_Players[0].field_3C )
+  v3 = am_Players[0].resource_bricks;
+  if ( am_Players[0].resource_bricks <= am_Players[0].resource_gems )
   {
-    v3 = am_Players[0].field_40;
-    v4 = am_Players[0].field_3C;
-    if ( am_Players[0].field_3C > am_Players[0].field_40 )
+    v3 = am_Players[0].resource_beasts;
+    v4 = am_Players[0].resource_gems;
+    if ( am_Players[0].resource_gems > am_Players[0].resource_beasts )
       goto LABEL_28;
   }
   else
   {
-    if ( am_Players[0].field_38 <= am_Players[0].field_40 )
+    if ( am_Players[0].resource_bricks <= am_Players[0].resource_beasts )
     {
-      v4 = am_Players[0].field_40;
+      v4 = am_Players[0].resource_beasts;
       goto LABEL_28;
     }
   }
   v4 = v3;
 LABEL_28:
-  v5 = am_Players[1].field_38;
-  v6 = am_Players[1].field_3C;
-  if ( am_Players[1].field_38 <= am_Players[1].field_3C )
+  v5 = am_Players[1].resource_bricks;
+  v6 = am_Players[1].resource_gems;
+  if ( am_Players[1].resource_bricks <= am_Players[1].resource_gems )
   {
-    v5 = am_Players[1].field_40;
-    if ( am_Players[1].field_3C > am_Players[1].field_40 )
+    v5 = am_Players[1].resource_beasts;
+    if ( am_Players[1].resource_gems > am_Players[1].resource_beasts )
       goto LABEL_33;
     goto LABEL_32;
   }
-  v6 = am_Players[1].field_40;
-  if ( am_Players[1].field_38 > am_Players[1].field_40 )
+  v6 = am_Players[1].resource_beasts;
+  if ( am_Players[1].resource_bricks > am_Players[1].resource_beasts )
 LABEL_32:
     v6 = v5;
 LABEL_33:
@@ -5714,15 +5544,15 @@
   {
     if ( v1 != -1 )
       goto LABEL_49;
-    if ( v4 < dword_4E1888 )
+    if ( v4 < max_resources_amount )
     {
-      if ( v6 < dword_4E1888 )
+      if ( v6 < max_resources_amount )
         goto LABEL_49;
       v0 = 2;
     }
     else
     {
-      if ( v6 < dword_4E1888 )
+      if ( v6 < max_resources_amount )
       {
         v0 = 1;
       }
@@ -5754,82 +5584,74 @@
   pArcomageGame->uGameResult = v0;
   if ( v0 == 1 )
   {
-    v7 = window_SpeakInHouse;
-    v8 = (signed int)window_SpeakInHouse->ptr_1C;
-    if ( v8 >= 108 )
+
+    v8 = (signed int)window_SpeakInHouse->par1C;
+    if (( v8 >= 108 )&&( v8 <= 120 ))
     {
-      if ( v8 <= 120 )
-      {
-        v9 = (char *)&pParty->uNumGoldInBank + v8 + 1;
-        if ( !*v9 )
+        if ( !pParty->pArcomageWins[v8-108] )
         {
-          *v9 = 1;
-
-          //auto _a = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v7->ptr_1C] * 100.0);
-          auto _a = (signed int)(p2DEvents[(unsigned int)v7->ptr_1C - 1].fPriceMultiplier * 100.0);
+          pParty->pArcomageWins[v8-108] = 1;
+          auto _a = (signed int)(p2DEvents[ window_SpeakInHouse->par1C - 1].fPriceMultiplier * 100.0);
           party_finds_gold(_a, 0);
         }
-      }
+      
     }
     v10 = 108;
     do
     {
-      if ( !*((unsigned char *)&pParty->uNumGoldInBank + v10 + 1) )
+      if ( !pParty->pArcomageWins[v10-108] )
         break;
       ++v10;
     }
     while ( v10 <= 120 );
+
     if ( v10 == 121 )
       _449B7E_toggle_bit(pParty->_quest_bits, 238, 1u);
-    v11 = (char *)pParty->pPlayers[0]._guilds_member_bits;
-    do
+
+   
+    for (int i=0; i<4; ++i  )
     {
+      v11 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) )
         _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1);
-      v11 += 6972;
+      
     }
-    while ( (signed int)v11 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) );
+   
     ++pParty->uNumArcomageWins;
     if ( pParty->uNumArcomageWins > 1000000 )
       pParty->uNumArcomageWins = 1000000;
   }
   else
   {
-    v12 = (char *)pParty->pPlayers[0]._guilds_member_bits;
-    do
-    {
+  for (int i=0; i<4; ++i  )
+      {
+      v12 = (char *)&pParty->pPlayers[i]._guilds_member_bits;
       if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) )
         _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1);
-      v12 += 6972;
     }
-    while ( (signed int)v12 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) );
+   
     ++pParty->uNumArcomageLoses;
     if ( pParty->uNumArcomageLoses > 1000000 )
       pParty->uNumArcomageLoses = 1000000;
   }
-  return 0;
 }
 
 
 
 //----- (00409C8B) --------------------------------------------------------
-void __cdecl PrepareArcomage()
-{
-  int v0; // ecx@3
+void PrepareArcomage()
+    {
   signed __int64 v1; // qax@4
   int v2; // esi@4
   int v3; // esi@5
   signed int v4; // edi@5
-  stru272 *v5; // esi@7
   int v6; // edx@9
-  int v7; // ecx@9
   RECT pXYZW; // [sp+8h] [bp-1Ch]@5
   POINT pXY; // [sp+18h] [bp-Ch]@5
-  int v10; // [sp+20h] [bp-4h]@3
 
   pAudioPlayer->StopChannels(-1, -1);
-  strcpy(pArcomageGame->pPlayer1Name, pArcomagePlayer1Name);
-  strcpy(pArcomageGame->pPlayer2Name, pArcomagePlayer2Name);
+  strcpy(pArcomageGame->pPlayer1Name, Player1Name);
+  strcpy(pArcomageGame->pPlayer2Name, Player2Name);
   am_byte_4FAA76 = 0;
   am_byte_4FAA75 = 0;
 
@@ -5837,14 +5659,14 @@
       {
       v2 = (i+1) % 4;
       v3 = (i+1) / 4;
-      struct_st1[i].uCardId = -1;
-      struct_st1[i].field_4 = 0;
-      struct_st1[i].field_8.x = 100 * v2 + 120;
-      struct_st1[i].field_8.y = 138 * v3 + 18;
-      struct_st1[i].field_10_xplus = -100 * v2 / 5;
-      struct_st1[i].field_14_y_plus = -138 * v3 / 5;
-      struct_st1[i].field_18_point.x = struct_st1[i].field_8.x;
-      struct_st1[i].field_18_point.y = struct_st1[i].field_8.y;
+      shown_cards[i].uCardId = -1;
+      shown_cards[i].field_4 = 0;
+      shown_cards[i].field_8.x = 100 * v2 + 120;
+      shown_cards[i].field_8.y = 138 * v3 + 18;
+      shown_cards[i].field_10_xplus = -100 * v2 / 5;
+      shown_cards[i].field_14_y_plus = -138 * v3 / 5;
+      shown_cards[i].field_18_point.x = shown_cards[i].field_8.x;
+      shown_cards[i].field_18_point.y = shown_cards[i].field_8.y;
       }
 
   pXY.x = 0;
@@ -5867,9 +5689,9 @@
 
 
   for (int i=0; i<10; ++i)
-     array_4FABD0[i].field_40->_40DFD1(array_4FABD0[i].field_40);
+     array_4FABD0[i].field_40->Ctor(array_4FABD0[i].field_40);
   
-  dword_4FABBC = -1;
+  current_card_slot_index = -1;
   amuint_4FAA4C = -1;
   byte_4FAA74 = 0;
   pArcomageGame->field_F4 = 0;
@@ -5877,10 +5699,10 @@
   byte_505880 = 0;
   dword_4FAA70 = 0;
   am_byte_4FAA77 = 0;
- // am_409FE9();
-  am_40A255();
+  SetStartGameData();
+  InitalHandsFill();
   //nullsub_1();
-  pArcomageGame->field_F5 = 0;
+  pArcomageGame->GameOver = 0;
   pArcomageGame->pfntComic = pFontComic;
   pArcomageGame->pfntArrus = pFontArrus;
 }
@@ -5902,28 +5724,28 @@
 
 
 //----- (00409BE8) --------------------------------------------------------
-void sub_409BE8()
+void SetStartConditions()
 {
-  stru348 *v1; // eax@1
+  ArcomageStartConditions *st_cond; // eax@1
     
-  v1 = &stru_4E1890[window_SpeakInHouse->par1C - 108];
-  amuint_4E1860 = v1->field_4;
-  amuint_4E1864 = v1->field_6;
-  amuint_4E1868 = v1->field_8 - 1;
-  amuint_4E186C = v1->field_A - 1;
-  amuint_4E1870 = v1->field_C - 1;
-  dword_4E1874 = 5;
-  dword_4E1878 = 1;
-  dword_4E187C = 1;
-  dword_4E1880 = 1;
-  dword_4E1884 = v1->field_0;
-  dword_4E1888 = v1->field_2;
-
-  dword_4DF3A4 = v1->field_14;
-
-  amuint_505884 = v1->field_E;
-  amuint_505888 = v1->field_10;
-  amuint_50588C = v1->field_12;
+  st_cond = &start_conditions[window_SpeakInHouse->par1C - 108];
+  start_tower_height = st_cond->tower_height;
+  start_wall_height  = st_cond->wall_height;
+  start_quarry_level = st_cond->quarry_level - 1;
+  start_magic_level  = st_cond->magic_level - 1;
+  start_zoo_level  = st_cond->zoo_level - 1;
+  minimum_cards_at_hand = 5;
+  quarry_bonus = 1;
+  magic_bonus = 1;
+  zoo_bonus = 1;
+  max_tower_height = st_cond->max_tower;
+  max_resources_amount = st_cond->max_resources;
+
+  dword_4DF3A4 = st_cond->field_14;
+
+  start_bricks_amount = st_cond->bricks_amount;
+  start_gems_amount   = st_cond->gems_amount;
+  start_beasts_amount = st_cond->beasts_amount;
   
 }
 
@@ -5984,17 +5806,6 @@
     return a + rand() % (b - a + 1);
     }
 
-//----- (0040DEB4) --------------------------------------------------------
-char *__fastcall inv_strcat(const char *Source, char *Dest)
-    {
-    return strcat(Dest, Source);
-    }
-
-//----- (0040DEBE) --------------------------------------------------------
-char *__fastcall inv_strcpy(const char *Source, char *Dest)
-    {
-    return strcpy(Dest, Source);
-    }
 
 //----- (0040DEC8) --------------------------------------------------------
 void __fastcall intToString(int val, char *pOut)
--- a/Arcomage.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Arcomage.h	Mon Jun 10 09:30:21 2013 +0600
@@ -5,105 +5,102 @@
 
 #pragma pack(push, 1)
 struct am_st1
-    {
-    int field_0;
-    int field_4;
-    };
+{
+  int field_0;
+  int field_4;
+};
 #pragma pack(pop)
 
 /*  401 */
 #pragma pack(push, 1)
 struct Acromage_st1
-    {
-    int uCardId;
-    int field_4;
-    POINT field_8;
-    int field_10_xplus;
-    int field_14_y_plus;
-    POINT field_18_point;
-    };
+{
+  int uCardId;
+  int field_4;
+  POINT field_8;
+  int field_10_xplus;
+  int field_14_y_plus;
+  POINT field_18_point;
+};
 #pragma pack(pop)
 
 
 /*  272 */
 #pragma pack(push, 1)
 struct ArcomageCard
-    {
-    char pCardName[32];
-    int slot;
-    char field_24;
-    char field_25;
-    char field_26;
-    char field_27;
-    char field_28;
-    char field_29;
-    char field_2A;
-    char field_2B;
-    char field_2C;
-    char field_2D;
-    char field_2E;
-    char field_2F;
-    char field_30;
-    char field_31;
-    char field_32;
-    char field_33;
-    char field_34;
-    char field_35;
-    char field_36;
-    char field_37;
-    char field_38;
-    char field_39;
-    char field_3A;
-    char field_3B;
-    char field_3C;
-    char field_3D;
-    char field_3E;
-    char field_3F;
-    char field_40;
-    char field_41;
-    char field_42;
-    char field_43;
-    char field_44;
-    char field_45;
-    char field_46;
-    char field_47;
-    char field_48;
-    char field_49;
-    char field_4A;
-    char field_4B;
-    char field_4C;
-    char field_4D;
-    char field_4E;
-    char field_4F;
-    char field_50;
-    char field_51;
-    char field_52;
-    char field_53;
-    char field_54;
-    char field_55;
-    char field_56;
-    char field_57;
-    char field_58;
-    char field_59;
-    char field_5A;
-    char field_5B;
-    char field_5C;
-    char field_5D;
-    char field_5E;
-    char field_5F;
-    char field_60;
-    char field_61;
-    char field_62;
-    char field_63;
-    char field_64;
-    char field_65;
-    char field_66;
-    char field_67;
-    char field_68;
-    char field_69;
-    char field_6A;
-    char field_6B;
-    };
+{
+  char pCardName[32];
+  int slot;
+  char field_24;
+  char needed_quarry_level;
+  char needed_magic_level;
+  char needed_might_level;
+  char needed_bricks;
+  char needed_gems;
+  char needed_beasts;
+  char field_2B;
+  int  field_2C;
+  char field_30;
+  char field_31;
+  char field_32;
+  char field_33;
+  char field_34;
+  char field_35;
+  char field_36;
+  char field_37;
+  char field_38;
+  char field_39;
+  char field_3A;
+  char field_3B;
+  char field_3C;
+  char field_3D;
+  char field_3E;
+  char field_3F;
+  char field_40;
+  char field_41;
+  char field_42;
+  char field_43;
+  char field_44;
+  char field_45;
+  char field_46;
+  char field_47;
+  char field_48;
+  char field_49;
+  char field_4A;
+  char field_4B;
+  char field_4C;
+  char field_4D;
+  char field_4E;
+  char field_4F;
+  char field_50;
+  char field_51;
+  char field_52;
+  char field_53;
+  char field_54;
+  char field_55;
+  char field_56;
+  char field_57;
+  char field_58;
+  char field_59;
+  char field_5A;
+  char field_5B;
+  char field_5C;
+  char field_5D;
+  char field_5E;
+  char field_5F;
+  char field_60;
+  char field_61;
+  char field_62;
+  char field_63;
+  char field_64;
+  char field_65;
+  char field_66;
+  char field_67;
+  char field_68;
+  char field_69;
+  char field_6A;
+  char field_6B;
+};
 #pragma pack(pop)
 
 
@@ -113,15 +110,15 @@
 struct ArcomagePlayer
 {
   char pPlayerName[32];
-  int field_20;
-  int field_24;
-  int field_28;
-  int field_2C;
-  int field_30;
-  int field_34;
-  int field_38;
-  int field_3C;
-  int field_40;
+  int IsHisTurn;
+  int tower_height;
+  int wall_height;
+  int quarry_level;
+  int magic_level;
+  int zoo_level;
+  int resource_bricks;
+  int resource_gems;
+  int resource_beasts;
   int cards_at_hand[10];
   am_st1 arr_6C[10];
 };
@@ -185,7 +182,7 @@
   char pPlayer1Name[32];
   char pPlayer2Name[32];
   char field_F4;
-  char field_F5;
+  char GameOver;
   char field_F6;
   char field_F7;
   char field_F8;
@@ -199,41 +196,41 @@
 
 extern ArcomageGame *pArcomageGame;
 extern ArcomageCard pCards[87];
-extern ArcomagePlayer am_Players[2];
+
 
 
 #pragma pack(push, 1)
 struct stru272_stru1
-    {
-    int field_0;
-    POINT field_4;
-    int field_C;
-    int field_10;
-    int field_14;
-    int field_18;
-    };
+{
+  int field_0;
+  POINT field_4;
+  int field_C;
+  int field_10;
+  int field_14;
+  int field_18;
+};
 #pragma pack(pop)
 
 /*  404 */
 #pragma pack(push, 1)
 struct stru272_stru2
-    {
-    int field_0;
-    int field_4;
-    int field_8;
-    int field_C;
-    int field_10;
-    int field_14;
-    int field_18;
-    float field_1Cf;
-    int field_20;
-    float field_24f;
-    float field_28f;
-    float field_2Cf;
-    int field_30;
-    int field_34;
-    stru272_stru1* field_38;
-    };
+{
+  int field_0;
+  int field_4;
+  int field_8;
+  int field_C;
+  int field_10;
+  int field_14;
+  int field_18;
+  float field_1Cf;
+  int field_20;
+  float field_24f;
+  float field_28f;
+  float field_2Cf;
+  int field_30;
+  int field_34;
+  stru272_stru1* field_38;
+};
 #pragma pack(pop)
 
 
@@ -241,10 +238,10 @@
 #pragma pack(push, 1)
 struct stru272_stru0         // ARCOMAGE stuff
 {
-  static void _40DFD1(stru272_stru0 *a1);
-  int _40DFFE();
+  static void Ctor(stru272_stru0 *a1);
+  int Dtor();
   int _40E01A(stru272_stru2* a2);
-  int _40E0F5(char a2, char a3);
+  int Empty(char a2, char a3);
   int _40E133();
   int _40E2A7();
 
@@ -277,48 +274,28 @@
 };
 #pragma pack(pop)
 
+#define DECK_SIZE 108
 
-/*  266 */
-//#pragma pack(push, 1)
-//struct stru272
-//{
-//  void _40DFD1();
-//
-//  struct stru272_stru0 *ptr_0;
-//  char field_4[4264];
-//};
-//#pragma pack(pop)
+#pragma pack(push, 1)
+struct ArcomageDeck
+{
+  char name[32];
+  char cardsInUse[DECK_SIZE];
+  int cards_IDs[DECK_SIZE];
+};
 
-
-
-
-
+#pragma pack(pop)
 
 #pragma pack(push, 1)
 struct stru272
-    {
-    char field_0;
-    char field_1;
-    char field_2;
-    char field_3;
-    stru272_stru2 field_4;
-    /*int field_4;
-    int field_8;
-    int field_C;
-    int field_10;
-    int field_14;
-    int field_18;
-    int field_1C;
-    float field_20f;
-    int field_24;
-    float field_28f;
-    float field_2Cf;
-    float field_30f;
-    int field_34;
-    int field_38;
-    stru272_stru1* field_3C;*/
-    stru272_stru0 *field_40;
-    stru272_stru1 field_44[150];
-    };
+{
+  char field_0;
+  char field_1;
+  char _pad_2;
+  char _pad_3;
+  stru272_stru2 field_4;
+  stru272_stru0 *field_40;
+  stru272_stru1 field_44[150];
+};
 #pragma pack(pop)
 
--- a/ArcomageCards.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/ArcomageCards.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -1,265 +1,352 @@
 
 #include "Arcomage.h"
-struct ArcomageCard pCards[87] = 
+ArcomageCard pCards[87] = 
 {
- {"Brick Shortage", 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Brick Shortage", 
+  0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Lucky Cache", 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Lucky Cache", 
+  1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Friendly Terrain", 2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Friendly Terrain", 
+  2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Miners", 3, 1, 0, 0, 0, 3, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Miners", 
+  3, 1, 0, 0, 0, 3, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Mother Lode", 4, 1, 0, 0, 0, 4, 0, 0, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Mother Lode", 
+ 4, 1, 0, 0, 0, 4, 0, 0, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Dwarven Miners", 5, 1, 0, 0, 0, 7, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Dwarven Miners",
+ 5, 1, 0, 0, 0, 7, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Work Overtime", 6, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Work Overtime", 
+ 6, 1, 0, 0, 0, 2, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, -6, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Copping the Tech", 7, 1, 0, 0, 0, 5, 0, 0, 1, 2, 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Copping the Tech", 
+  7, 1, 0, 0, 0, 5, 0, 0, 1, 2, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Basic Wall", 8, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Basic Wall", 
+  8, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Sturdy Wall", 9, 1, 0, 0, 0, 3, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Sturdy Wall", 
+  9, 1, 0, 0, 0, 3, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Innovations", 10, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Innovations", 
+  10, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Foundations", 11, 1, 0, 0, 0, 3, 0, 0, 1, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Foundations", 
+  11, 1, 0, 0, 0, 3, 0, 0, 1, 11,  0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Tremors", 12, 1, 0, 0, 0, 7, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Tremors", 
+  12, 1, 0, 0, 0, 7, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Secret Room", 13, 1, 0, 0, 0, 8, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Secret Room", 
+  13, 1, 0, 0, 0, 8, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Earthquake", 14, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Earthquake", 
+  14, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Big Wall", 15, 1, 0, 0, 0, 5, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Big Wall", 
+  15, 1, 0, 0, 0, 5, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Collapse!", 16, 1, 0, 0, 0, 4, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0,
+ {"Collapse!", 
+  16, 1, 0, 0, 0, 4, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"New Equipment", 17, 1, 0, 0, 0, 6, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"New Equipment", 
+  17, 1, 0, 0, 0, 6, 0, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Strip Mine", 18, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 255, 0, 0, 0, 5, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Strip Mine", 
+  18, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0, 5, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Reinforced Wall", 19, 1, 0, 0, 0, 8, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Reinforced Wall", 
+  19, 1, 0, 0, 0, 8, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Porticulus", 20, 1, 0, 0, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Porticulus", 
+  20, 1, 0, 0, 0, 9, 0, 0, 1, 1,  0, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Crystal Rocks", 21, 1, 0, 0, 0, 9, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Crystal Rocks", 
+ 21, 1, 0, 0, 0, 9, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Harmonic Ore", 22, 1, 0, 0, 0, 11, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Harmonic Ore", 
+ 22, 1, 0, 0, 0, 11, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Mondo Wall", 23, 1, 0, 0, 0, 13, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Mondo Wall", 
+ 23, 1, 0, 0, 0, 13, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Focused Designs", 24, 1, 0, 0, 0, 15, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 5, 0, 0, 0, 0, 0, 0, 0,
+ {"Focused Designs", 
+ 24, 1, 0, 0, 0, 15, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 5, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Great Wall", 25, 1, 0, 0, 0, 16, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Great Wall", 
+ 25, 1, 0, 0, 0, 16, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Rock Launcer", 26, 1, 0, 0, 0, 18, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 246,
+ {"Rock Launcer", 
+ 26, 1, 0, 0, 0, 18, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, -10,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Dragon's Heart", 27, 1, 0, 0, 0, 24, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 8, 0, 0, 0, 0, 0, 0, 0,
+ {"Dragon's Heart", 
+ 27, 1, 0, 0, 0, 24, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 8, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Quartz", 30, 2, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Quartz", 
+ 30, 2, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Smoky Quartz", 31, 2, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Smoky Quartz", 
+ 31, 2, 0, 0, 0, 0, 2, 0, 1, 1,  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Amethyst", 32, 2, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Amethyst", 
+ 32, 2, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Spell Weavers", 33, 2, 0, 0, 0, 0, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Spell Weavers", 
+ 33, 2, 0, 0, 0, 0, 3, 0, 1, 1,  0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Prism", 34, 2, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Prism", 
+ 34, 2, 0, 0, 0, 0, 2, 0, 1, 1,  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Lodestone", 35, 2, 0, 0, 0, 0, 5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Lodestone", 
+ 35, 2, 0, 0, 0, 0, 5, 0, 0, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Solar Flare", 36, 2, 0, 0, 0, 0, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
- 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Solar Flare", 
+ 36, 2, 0, 0, 0, 0, 4, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Crystal Matrix", 37, 2, 0, 0, 0, 0, 6, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ {"Crystal Matrix",
+ 37, 2, 0, 0, 0, 0, 6, 0, 1, 1,  0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Gemstone Flaw", 38, 2, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Gemstone Flaw", 
+ 38, 2, 0, 0, 0, 0, 2, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Ruby", 39, 2, 0, 0, 0, 0, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Ruby", 
+ 39, 2, 0, 0, 0, 0, 3, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Gem Spear", 40, 2, 0, 0, 0, 0, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Gem Spear", 
+ 40, 2, 0, 0, 0, 0, 4, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Power Burn", 41, 2, 0, 0, 0, 0, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Power Burn", 
+ 41, 2, 0, 0, 0, 0, 3, 0, 1, 1,  0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Harmonic Vibe", 42, 2, 0, 0, 0, 0, 7, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Harmonic Vibe", 
+ 42, 2, 0, 0, 0, 0, 7, 0, 1, 1,  0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Parity", 43, 2, 0, 0, 0, 0, 7, 0, 1, 3, 0, 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Parity", 
+ 43, 2, 0, 0, 0, 0, 7, 0, 1, 3,  0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Emerald", 44, 2, 0, 0, 0, 0, 6, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Emerald", 
+ 44, 2, 0, 0, 0, 0, 6, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Pearl of Wisdom", 45, 2, 0, 0, 0, 0, 9, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
+ {"Pearl of Wisdom", 
+ 45, 2, 0, 0, 0, 0, 9, 0, 1, 1,  0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Shatter", 46, 2, 0, 0, 0, 0, 8, 0, 1, 1, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Shatter", 
+ 46, 2, 0, 0, 0, 0, 8, 0, 1, 1,  0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Crumblestone", 47, 2, 0, 0, 0, 0, 7, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 250, 0, 0, 0,
+ {"Crumblestone", 
+ 47, 2, 0, 0, 0, 0, 7, 0, 1, 1,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, -6, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Sapphire", 48, 2, 0, 0, 0, 0, 10, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Sapphire", 
+ 48, 2, 0, 0, 0, 0, 10, 0, 1, 1,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Discord", 49, 2, 0, 0, 0, 0, 5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 255, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Discord", 
+ 49, 2, 0, 0, 0, 0, 5, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Fire Ruby", 50, 2, 0, 0, 0, 0, 13, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
- 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Fire Ruby", 
+ 50, 2, 0, 0, 0, 0, 13, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
+ -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Quarry's Help", 51, 2, 0, 0, 0, 0, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 246, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0,
+ {"Quarry's Help", 
+ 51, 2, 0, 0, 0, 0, 4, 0, 1, 1,  0, 0, 0, 0, 0, -10, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  
- {"Crystal Shield", 52, 2, 0, 0, 0, 0, 12, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 0, 0, 0, 0, 0, 0, 0,
+ {"Crystal Shield", 
+ 52, 2, 0, 0, 0, 0, 12, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 8, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Empathy Gem", 53, 2, 0, 0, 0, 0, 14, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Empathy Gem", 
+ 53, 2, 0, 0, 0, 0, 14, 0, 1, 1,  0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Diamond", 54, 2, 0, 0, 0, 0, 16, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 
+ {"Diamond", 
+ 54, 2, 0, 0, 0, 0, 16, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Sanctuary", 55, 2, 0, 0, 0, 0, 15, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Sanctuary", 
+ 55, 2, 0, 0, 0, 0, 15, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 5, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Lava Jewel", 56, 2, 0, 0, 0, 0, 17, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 250,
+ {"Lava Jewel", 
+ 56, 2, 0, 0, 0, 0, 17, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, -6,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Dragon's Eye", 57, 2, 0, 0, 0, 0, 21, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
+ {"Dragon's Eye", 
+ 57, 2, 0, 0, 0, 0, 21, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Mad Cow Disease", 60, 3, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Mad Cow Disease", 
+ 60, 3, 0, 0, 0, 0, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Faerie", 61, 3, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0,
+ {"Faerie", 
+ 61, 3, 0, 0, 0, 0, 0, 1, 1, 1,  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Moody Goblins", 62, 3, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Moody Goblins", 
+ 62, 3, 0, 0, 0, 0, 0, 1, 1, 1,  0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Husbandry", 63, 3, 0, 0, 0, 0, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Husbandry", 
+ 63, 3, 0, 0, 0, 0, 0, 3, 1, 1,  0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Elvin Scout", 64, 3, 0, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Elvin Scout",
+ 64, 3, 0, 0, 0, 0, 0, 2, 1, 1,  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Goblin Mob", 65, 3, 0, 0, 0, 0, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 0, 0, 0, 0, 0, 0, 0, 0, 250,
+ {"Goblin Mob", 
+ 65, 3, 0, 0, 0, 0, 0, 3, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, -6,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Goblin Archers", 66, 3, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Goblin Archers", 
+ 66, 3, 0, 0, 0, 0, 0, 4, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Shadow Faerie", 67, 3, 0, 0, 0, 0, 0, 6, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Shadow Faerie", 
+ 67, 3, 0, 0, 0, 0, 0, 6, 1, 1,  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Orc", 68, 3, 0, 0, 0, 0, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 0, 0, 0,
+ {"Orc", 
+ 68, 3, 0, 0, 0, 0, 0, 3, 1, 1,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Dwarves", 69, 3, 0, 0, 0, 0, 0, 5, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0,
+ {"Dwarves", 
+ 69, 3, 0, 0, 0, 0, 0, 5, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Little Snakes", 70, 3, 0, 0, 0, 0, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Little Snakes", 
+ 70, 3, 0, 0, 0, 0, 0, 6, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Troll Keepers", 71, 3, 0, 0, 0, 0, 0, 7, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Troll Keepers", 
+ 71, 3, 0, 0, 0, 0, 0, 7, 1, 1,   0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Tower Gremlins", 72, 3, 0, 0, 0, 0, 0, 8, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0,
- 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Tower Gremlins", 
+ 72, 3, 0, 0, 0, 0, 0, 8, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0,
+ -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Full Moon", 73, 3, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Full Moon", 
+ 73, 3, 0, 0, 0, 0, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Slasher", 74, 3, 0, 0, 0, 0, 0, 5, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0,
+ {"Slasher", 
+ 74, 3, 0, 0, 0, 0, 0, 5, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Ogre", 75, 3, 0, 0, 0, 0, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0,
+ {"Ogre", 
+ 75, 3, 0, 0, 0, 0, 0, 6, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Rabid Sheep", 76, 3, 0, 0, 0, 0, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253,
- 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Rabid Sheep", 
+ 76, 3, 0, 0, 0, 0, 0, 6, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3,
+ -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Imp", 77, 3, 0, 0, 0, 0, 0, 5, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 0,
- 0, 0, 251, 251, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Imp", 
+ 77, 3, 0, 0, 0, 0, 0, 5, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0,
+ 0, 0, -5, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Spizzer", 78, 3, 0, 0, 0, 0, 0, 8, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Spizzer", 
+ 78, 3, 0, 0, 0, 0, 0, 8, 1, 13,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Werewolf", 79, 3, 0, 0, 0, 0, 0, 9, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 0,
+ {"Werewolf", 
+ 79, 3, 0, 0, 0, 0, 0, 9, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -9, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Corrosion Cloud", 80, 3, 0, 0, 0, 0, 0, 11, 1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Corrosion Cloud", 
+ 80, 3, 0, 0, 0, 0, 0, 11, 1, 14,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Unicorn", 81, 3, 0, 0, 0, 0, 0, 9, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Unicorn", 
+ 81, 3, 0, 0, 0, 0, 0, 9, 1, 9,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -12, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Elvin Archers", 82, 3, 0, 0, 0, 0, 0, 10, 1, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Elvin Archers", 
+ 82, 3, 0, 0, 0, 0, 0, 10, 1, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Succubus", 83, 3, 0, 0, 0, 0, 0, 14, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 0, 0,
- 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Succubus", 
+ 83, 3, 0, 0, 0, 0, 0, 14, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0, 0,
+ -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Rock Stompers", 84, 3, 0, 0, 0, 0, 0, 11, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0,
- 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {"Rock Stompers", 
+ 84, 3, 0, 0, 0, 0, 0, 11, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0,
+ -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Thief", 85, 3, 0, 0, 0, 0, 0, 12, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 0, 0, 0, 0, 0, 0, 0, 251, 246, 0, 0, 0,
+ {"Thief", 
+ 85, 3, 0, 0, 0, 0, 0, 12, 1, 1,  0, 0, 0, 0, 0, 3, 5, 0, 0, 0, 0, 0, 0, 0, -5, -10, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Stone Giant", 86, 3, 0, 0, 0, 0, 0, 15, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 246,
+ {"Stone Giant", 
+ 86, 3, 0, 0, 0, 0, 0, 15, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, -10,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Vampire", 87, 3, 0, 0, 0, 0, 0, 17, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 251, 246,
+ {"Vampire",
+ 87, 3, 0, 0, 0, 0, 0, 17, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -5, -10,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Dragon", 88, 3, 0, 0, 0, 0, 0, 25, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 246, 0, 236, 0,
+ {"Dragon", 
+ 88, 3, 0, 0, 0, 0, 0, 25, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -10, 0, -20, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Forced Labor", 28, 1, 0, 0, 0, 7, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
+ {"Forced Labor", 
+ 28, 1, 0, 0, 0, 7, 0, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, -5, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
- {"Crystallize", 58, 2, 0, 0, 0, 0, 8, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 11, 0, 0, 0, 0, 0, 0, 0,
+ {"Crystallize", 
+ 58, 2, 0, 0, 0, 0, 8, 0, 1, 1,  0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 11, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  };
\ No newline at end of file
--- a/AudioPlayer.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/AudioPlayer.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -36,13 +36,13 @@
 int uFindSound_BinSearch_ResultID; // weak
 int uLastLoadedSoundID; // weak
 int sLastTrackLengthMS;
-Sound pSounds[3000];
+std::array<Sound, 3000> pSounds;
 AudioPlayer *pAudioPlayer;
 SoundList *pSoundList;
 
 
-stru339_spell_sound stru_A750F8[4];
-stru339_spell_sound stru_AA1058[4];
+std::array<stru339_spell_sound, 4> stru_A750F8;
+std::array<stru339_spell_sound, 4> stru_AA1058;
 
 
 
@@ -51,7 +51,7 @@
 unsigned __int8 uMusicVolimeMultiplier = 4;
 int bWalkSound; // idb
 
-float pSoundVolumeLevels[10] = 
+std::array<float, 10> pSoundVolumeLevels = 
 {
   0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f,
  0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9900000f
@@ -1681,7 +1681,7 @@
       case OBJECT_Actor:
       {
         assert(source_id < uNumActors);
-        auto actor = pActors + source_id;
+        auto actor = &pActors[source_id];
 
         source_x = actor->vPosition.x;
         source_y = actor->vPosition.y;
@@ -2413,7 +2413,7 @@
 {
   unsigned int v0; // eax@1
 
-  v0 = pMapStats->GetMapInfo(pCurrentMapName);
+  v0 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( v0 )
     pAudioPlayer->PlayMusicTrack((MusicID)pMapStats->pInfos[v0].uRedbookTrackID);
 }
@@ -2447,7 +2447,7 @@
   int v3; // [sp+4h] [bp-4h]@3
 
   v1 = this;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName);
+  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( v1->b3DSoundInitialized && v1->bEAXSupported )
   {
     v3 = pMapStats->pInfos[v2].uEAXEnv;
@@ -2482,7 +2482,7 @@
   int v13; // [sp+20h] [bp-4h]@6
 
   v1 = this;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName);
+  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   v3 = v1->b3DSoundInitialized == 0;
   v4 = v2;
   v12 = v2;
--- a/AudioPlayer.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/AudioPlayer.h	Mon Jun 10 09:30:21 2013 +0600
@@ -303,7 +303,7 @@
 extern int uFindSound_BinSearch_ResultID; // weak
 extern int uLastLoadedSoundID; // weak
 extern int sLastTrackLengthMS;
-extern Sound pSounds[3000];
+extern std::array<Sound, 3000> pSounds;
 extern AudioPlayer *pAudioPlayer;
 extern SoundList *pSoundList;
 
@@ -312,7 +312,7 @@
 extern unsigned __int8 uMusicVolimeMultiplier;
 extern int bWalkSound; // idb
 
-extern float pSoundVolumeLevels[10]; // idb
+extern std::array<float, 10> pSoundVolumeLevels; // idb
 
 
 
@@ -335,5 +335,5 @@
   int pSoundsOffsets[2];
 };
 #pragma pack(pop)
-extern stru339_spell_sound stru_A750F8[4];
-extern stru339_spell_sound stru_AA1058[4];
+extern std::array<stru339_spell_sound, 4> stru_A750F8;
+extern std::array<stru339_spell_sound, 4> stru_AA1058;
--- a/Autonotes.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Autonotes.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 
 
@@ -22,4 +22,4 @@
   AUTONOTE_TYPE  eType;
 };
 #pragma pack(pop)
-extern Autonote pAutonoteTxt[195]; // weak
+extern std::array<Autonote, 195> pAutonoteTxt; // weak
--- a/Awards.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Awards.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 /*  353 */
 #pragma pack(push, 1)
@@ -9,7 +9,7 @@
   unsigned int  uPriority;
 };
 #pragma pack(pop)
-extern Award pAwards[105];
+extern std::array<Award, 105> pAwards;
 
 
 
@@ -122,6 +122,6 @@
   , Award_ArcomageLoses = 104
 
 };
-extern AwardType achieved_awards[1000];
+extern std::array<AwardType, 1000> achieved_awards;
 extern int       num_achieved_awards;
 extern int       num_achieved_awards_2;
\ No newline at end of file
--- a/CastSpellInfo.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/CastSpellInfo.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 
 /*  271 */
@@ -34,5 +34,5 @@
 #pragma pack(pop)
 
 
-extern CastSpellInfo pCastSpellInfo[10];
+extern std::array<CastSpellInfo, 10> pCastSpellInfo;
 extern CastSpellInfo stru_50CDB4; // idb
--- a/Chest.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Chest.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -31,7 +31,7 @@
 
 size_t uNumChests; // idb
 struct ChestList *pChestList;
-Chest pChests[20];
+std::array<Chest, 20> pChests;
 
 
 const int pChestPixelOffsetX[8]  = {42, 18, 18, 42, 42, 42, 18, 42};
@@ -104,7 +104,7 @@
   if ( !uActiveCharacter )
     return 0;
   *(float *)&sRotY = 0.0;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName);
+  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( !chest->Trapped() || !v2 )
     goto LABEL_12;
   if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].LockX5 )
@@ -285,8 +285,8 @@
     chest_offs_y = pChestPixelOffsetY[chestBitmapId];
     chestWidthCells = pChestWidthsByType[chestBitmapId];
     chestHeghtCells = pChestHeightsByType[chestBitmapId];
-    sprintf(pTmpBuf, "chest%02d", pChestList->pChests[chestBitmapId].uTextureID);
-    v5 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID);
+    v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
     pRenderer->DrawTextureIndexed(8u, 8u, pIcons_LOD->GetTexture(v5));
 
     for (item_counter = 0; item_counter< chestWidthCells * chestHeghtCells; ++item_counter)
--- a/Chest.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Chest.h	Mon Jun 10 09:30:21 2013 +0600
@@ -73,4 +73,4 @@
 
 extern size_t uNumChests; // idb
 extern struct ChestList *pChestList;
-extern Chest pChests[20];
\ No newline at end of file
+extern std::array<Chest, 20> pChests;
\ No newline at end of file
--- a/Events.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Events.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -34,29 +34,29 @@
 
 
 
-EventIndex pSomeOtherEVT_Events[4400];
+std::array<EventIndex, 4400> pSomeOtherEVT_Events;
 signed int uSomeOtherEVT_NumEvents;
 char *pSomeOtherEVT;
-EventIndex pSomeEVT_Events[4400];
+std::array<EventIndex, 4400> pSomeEVT_Events;
 signed int uSomeEVT_NumEvents;
 char *pSomeEVT;
 
 unsigned int uGlobalEVT_NumEvents;
 unsigned int uGlobalEVT_Size;
-char pGlobalEVT[46080];
-EventIndex pGlobalEVT_Index[4400];
+std::array<char, 46080> pGlobalEVT;
+std::array<EventIndex, 4400> pGlobalEVT_Index;
 
-unsigned int pLevelStrOffsets[500];
+std::array<unsigned int, 500> pLevelStrOffsets;
 unsigned int uLevelStrNumStrings;
 unsigned int uLevelStrFileSize;
 signed int uLevelEVT_NumEvents;
 unsigned int uLevelEVT_Size;
-char pLevelStr[9216];
-char pLevelEVT[9216];
-EventIndex pLevelEVT_Index[4400];
+std::array<char, 9216> pLevelStr;
+std::array<char, 9216> pLevelEVT;
+std::array<EventIndex, 4400> pLevelEVT_Index;
 
 
-_2devent p2DEvents[525]; // weak
+std::array<_2devent, 525> p2DEvents; // weak
 
 
 
@@ -102,12 +102,12 @@
 	unsigned int offset_in; 
 	raw_event_header *current_hdr; 
 	uGlobalEVT_NumEvents = 0;
-	uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 46080);
+	uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080);
 	if ( !uGlobalEVT_Size )
 		return;
-	memset(pGlobalEVT_Index, 0x80, sizeof(pGlobalEVT_Index));//52800
+	memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800
 	events_count = uGlobalEVT_NumEvents;
-	current_hdr=(raw_event_header *)pGlobalEVT;
+	current_hdr=(raw_event_header *)pGlobalEVT.data();
 	offset_in=0;
 	for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count)
 		{
@@ -143,12 +143,12 @@
 		return;
 
 	memset(array_5B5928_timers, 0, 3200);
-	memset(pLevelEVT_Index, 80, sizeof(EventIndex)*4400);
+	memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400);
 
 	uLevelEVT_NumEvents = 0;
 	dword_5B65C8_timers_count = 0;
 
-    current_hdr=(raw_event_header *)pLevelEVT;
+    current_hdr=(raw_event_header *)pLevelEVT.data();
     offset_in=0;
     for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count)
         {
@@ -440,14 +440,14 @@
 	if ( activeLevelDecoration )
 		{
 		uSomeEVT_NumEvents = uGlobalEVT_NumEvents;
-		pSomeEVT = pGlobalEVT;
-		memcpy(pSomeEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); //4400 evts
+		pSomeEVT = pGlobalEVT.data();
+		memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts
 		}
 	else
 		{
 		uSomeEVT_NumEvents = uLevelEVT_NumEvents;
-		pSomeEVT = pLevelEVT;
-		memcpy(pSomeEVT_Events, pLevelEVT_Index, sizeof(EventIndex)*4400);
+		pSomeEVT = pLevelEVT.data();
+		memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400);
 		}
 
 	v4 = 0;
@@ -749,7 +749,7 @@
 				__debugbreak();
 				if ( (signed int)uNumActors > 0 )
 					{
-					v41 = pActors;//[0].uGroup;
+					v41 = pActors.data();//[0].uGroup;
 					do
 						{
 						if ( v41->uGroup == v38 )
@@ -772,7 +772,7 @@
 				__debugbreak();
 				if ( (signed int)uNumActors > 0 )
 					{
-					v45 = pActors;//[0].uAlly;
+					v45 = pActors.data();//[0].uAlly;
 					do
 						{
 						if ( v45->uGroup == v42 )
@@ -1108,7 +1108,7 @@
 			case EVENT_InputString:
 				if ( !entry_line )
 					{
-					strcpy(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
+					strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
 					v105 = curr_seq_num;
 					v121 = 26;
 LABEL_295:
@@ -1119,8 +1119,8 @@
 					return;
 					}
 				v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
-				if ( !_stricmp(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
-					|| !_stricmp(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) )
+				if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
+					|| !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) )
 					{
 					v11 = _evt->v17;
 LABEL_130:
@@ -1290,7 +1290,7 @@
 					}
 				else
 					{
-					strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]);
+					strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]);
 					}
 				++curr_seq_num;
 				v4 = v124;
--- a/Events.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Events.h	Mon Jun 10 09:30:21 2013 +0600
@@ -303,26 +303,26 @@
 #define EVT_STRING(x) (unsigned char*)&x
 #define EVT_BYTE(x) (unsigned char)x
 
-extern EventIndex pSomeOtherEVT_Events[4400];
+extern std::array<EventIndex, 4400> pSomeOtherEVT_Events;
 extern signed int uSomeOtherEVT_NumEvents;
 extern char *pSomeOtherEVT;
-extern EventIndex pSomeEVT_Events[4400];
+extern std::array<EventIndex, 4400> pSomeEVT_Events;
 extern signed int uSomeEVT_NumEvents;
 extern char *pSomeEVT;
 
 extern unsigned int uGlobalEVT_NumEvents;
 extern unsigned int uGlobalEVT_Size;
-extern char pGlobalEVT[46080];
-extern EventIndex pGlobalEVT_Index[4400];
+extern std::array<char, 46080> pGlobalEVT;
+extern std::array<EventIndex, 4400> pGlobalEVT_Index;
 
-extern unsigned int pLevelStrOffsets[500];
+extern std::array<unsigned int, 500> pLevelStrOffsets;
 extern unsigned int uLevelStrNumStrings;
 extern unsigned int uLevelStrFileSize;
 extern signed int uLevelEVT_NumEvents;
 extern unsigned int uLevelEVT_Size;
-extern char pLevelStr[9216];
-extern char pLevelEVT[9216];
-extern EventIndex pLevelEVT_Index[4400];
+extern std::array<char, 9216> pLevelStr;
+extern std::array<char, 9216> pLevelEVT;
+extern std::array<EventIndex, 4400> pLevelEVT_Index;
 
 
 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize);
--- a/Events2D.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Events2D.h	Mon Jun 10 09:30:21 2013 +0600
@@ -64,4 +64,4 @@
 #pragma pack(pop)
 
 
-extern _2devent p2DEvents[525]; // weak
\ No newline at end of file
+extern std::array<_2devent, 525> p2DEvents; // weak
\ No newline at end of file
--- a/GUIButton.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/GUIButton.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -100,10 +100,10 @@
 struct GUIButton *pBtnLoadSlot;
 
 
-GUIButton *pCreationUI_BtnPressRight2[4];
-GUIButton *pCreationUI_BtnPressLeft2[4];
-GUIButton *pCreationUI_BtnPressLeft[4];
-GUIButton *pCreationUI_BtnPressRight[4];
+std::array<GUIButton*, 4> pCreationUI_BtnPressRight2;
+std::array<GUIButton*, 4> pCreationUI_BtnPressLeft2;
+std::array<GUIButton*, 4> pCreationUI_BtnPressLeft;
+std::array<GUIButton*, 4> pCreationUI_BtnPressRight;
 
 
 
--- a/GUIFont.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/GUIFont.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -29,7 +29,7 @@
 
 char temp_string[2048];
 
-char pTmpBuf3[10000];
+std::array<char, 10000> pTmpBuf3;
 
 void DrawCharToBuff(unsigned short* uXpos,unsigned char* pCharPixels, int uCharWidth, int uCharHeight, unsigned __int16* pFontPalette, __int16 draw_color, int line_width);
 
@@ -50,8 +50,8 @@
         pallete_index =pIcons_LOD->LoadTexture(pFontPalette, TEXTURE_16BIT_PALETTE);
         if (pallete_index == -1)
             {
-            wsprintfA(pTmpBuf, "Unable to open %s", pFontPalette);
-            Abortf(pTmpBuf);
+            wsprintfA(pTmpBuf.data(), "Unable to open %s", pFontPalette);
+            Abortf(pTmpBuf.data());
             }	
         pFont->pFontPalettes[palletes_count] = pIcons_LOD->pTextures[pallete_index].pPalette16;
         ++palletes_count;
@@ -286,9 +286,9 @@
   currentFont=pFontMain; // esi@3
   uInStrLen = strlen(pString);
   assert(uInStrLen < sizeof(pTmpBuf3));
-  strcpy(pTmpBuf3, pString);
+  strcpy(pTmpBuf3.data(), pString);
   if (uInStrLen==0)
-      return pTmpBuf3;
+      return pTmpBuf3.data();
 
   start_pixel_offset=string_pixel_Width=startPixlOff;
   possible_transition_point=0;
@@ -379,7 +379,7 @@
               }
           }
       }
-  return pTmpBuf3;
+  return pTmpBuf3.data();
 
 }
 
--- a/GUIWindow.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/GUIWindow.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -34,7 +34,7 @@
 
 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb
 struct GUIWindow *pWindow_MainMenu;
-struct GUIWindow pWindowList[20];
+std::array<struct GUIWindow, 20> pWindowList;
 
 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue;
 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue;
@@ -159,34 +159,19 @@
   v1 = toupper(uHotkey);
   v2 = uNumVisibleWindows;
   v3 = v1;
-  if ( uNumVisibleWindows >= 0 )
+  for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- )
   {
-    while ( 2 )
-    {
-      v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1];
-      for ( result = v4->pControlsHead; result; result = result->pNext )
-      {
-        if ( result->uHotkey == v3 )
-        {
-          pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0);
-          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-          {
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }*/
-          return result;
-        }
-      }
-      if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 && v4->uFrameHeight == 480) )
-      {
-        --v2;
-        if ( v2 >= 0 )
-          continue;
-      }
-      break;
-    }
+	v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1];
+	for ( result = v4->pControlsHead; result; result = result->pNext )
+	{
+	  if ( result->uHotkey == v3 )
+	  {
+		pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0);
+		return result;
+	  }
+	}
+	if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == 640 && v4->uFrameHeight == 480) )
+	  break;
   }
   return 0;
 }
@@ -242,7 +227,7 @@
   v20 = 0;
   GetTickCount();
   v8 = &_4E2B21_buff_spell_tooltip_colors[1];
-  v16 = aSpellNames;
+  v16 = aSpellNames.data();
   v18 = pParty->pPartyBuffs;
   do
   {
@@ -558,7 +543,7 @@
                                      1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
                                      pTex_tab_an_7b__zoot_on, 0);
       num_achieved_awards = 0;
-      memset(achieved_awards, 0, 4000);
+      memset(achieved_awards.data(), 0, 4000);
       for ( i = dword_506528; i < 512; ++i )
           {
           v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i];
@@ -686,7 +671,7 @@
       v26.uFrameHeight = v2 * 264 / v2;
       v26.uFrameW = v26.uFrameHeight + 69;
       memset(&achieved_awards, 0, 4000);
-      memset(byte_5C6D50, 0, 0x64u);
+      memset(byte_5C6D50.data(), 0, 0x64u);
       if ( dword_506528 < 29 )
           {
           v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528];
@@ -870,7 +855,7 @@
     if ( v5 )
       pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0);
     else
-      *((int *)&pSavegameThumbnails->pPixels + 10 * v2) = 0;
+      *((int *)&pSavegameThumbnails.data()->pPixels + 10 * v2) = 0;
   }
 }
 
@@ -1036,11 +1021,11 @@
             pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3);
             continue;
           }
-          pTitleText = HouseNPCData[v8 - (dword_591080 != 0)]->pName;
-          v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
+          pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName;
+          v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
         }
         v10 = v9;
-        pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, pTitleText, 3);
+        pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3);
       }
     }
       if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
@@ -1077,10 +1062,10 @@
   }
   else
   {
-    sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429],
+    sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429],
       p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName,
       p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle);
-    pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf, 3);
+    pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3);
       switch ( in_current_building_type )
       {
         case BildingType_WeaponShop:
@@ -1177,14 +1162,14 @@
   v17 = (signed __int64)__PAIR__(v2, v3) % 60;
   v16 = (signed __int64)__PAIR__(v4, v5) % 60;
   v7 = v6 % 24;
-  strcpy(pTmpBuf, pGlobalTXT_LocalizationStrings[532]);
+  strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]);
   if ( (unsigned int)v6 /24 )
   {
     v8 = pGlobalTXT_LocalizationStrings[57];
     if ( v18 <= 1 )
       v8 = pGlobalTXT_LocalizationStrings[56];
-    sprintf(pTmpBuf2, "%d %s ", v18, v8);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintf(pTmpBuf2.data(), "%d %s ", v18, v8);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v7 )
   {
@@ -1192,8 +1177,8 @@
       v9 = pGlobalTXT_LocalizationStrings[109];
     else
       v9 = pGlobalTXT_LocalizationStrings[110];
-    sprintf(pTmpBuf2, "%d %s ", v7, v9);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintf(pTmpBuf2.data(), "%d %s ", v7, v9);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v16 && !v18 )
   {
@@ -1201,8 +1186,8 @@
       v10 = pGlobalTXT_LocalizationStrings[437];//"Minute"
     else
       v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes"
-    sprintf(pTmpBuf2, "%d %s ", v16, v10);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintf(pTmpBuf2.data(), "%d %s ", v16, v10);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v17 && !v7 )
   {
@@ -1210,12 +1195,12 @@
       v11 = pGlobalTXT_LocalizationStrings[439]; //"Second"	
     else
       v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds"
-    sprintf(pTmpBuf2, "%d %s ", v17, v11);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintf(pTmpBuf2.data(), "%d %s ", v17, v11);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  v13 = pFontArrus->CalcTextHeight(pTmpBuf, v15, 0, 0);
-  v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u);
+  v13 = pFontArrus->CalcTextHeight(pTmpBuf.data(), v15, 0, 0);
+  v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf.data(), 3u);
 }
 
 
@@ -1462,10 +1447,10 @@
     pWindow->DrawText(pFont, uX, uY, uColor, Str1, 0, 0, 0);
     return pLineWidth;
   }
-  strcpy(pTmpBuf2, Str1);
+  strcpy(pTmpBuf2.data(), Str1);
   v11 = 0;
   if ( a8 )
-    _strrev(pTmpBuf2);
+    _strrev(pTmpBuf2.data());
   Str1a = 0;
   if ( (signed int)pNumLen > 0 )
   {
@@ -1509,10 +1494,10 @@
     while ( (signed int)Str1a < (signed int)pNumLen );
   }
   pTmpBuf2[Str1a - 1] = 0;
-  pNumLen = strlen(pTmpBuf2);
-  v28 = pFont->GetLineWidth(pTmpBuf2);
+  pNumLen = strlen(pTmpBuf2.data());
+  v28 = pFont->GetLineWidth(pTmpBuf2.data());
   if ( a8 )
-    _strrev(pTmpBuf2);
+    _strrev(pTmpBuf2.data());
   Str1b = 0;
   v13 = uX + pWindow->uFrameX;
   v14 = uY + pWindow->uFrameY;
@@ -1796,8 +1781,8 @@
                 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//
                 if (speakingNPC->Hired())
                 {
-                  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //
-                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf, 0);
+                  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //
+                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0);
                 }
                 else
                 {
@@ -1842,15 +1827,12 @@
   if (eWindowType == WINDOW_HouseInterior)
   {
     pCurrentScreen = SCREEN_HOUSE;
-    pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//  
+    pBtn_ExitCancel = pWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//  
                    pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
-    v25 = uNumDialogueNPCPortraits;
-    v26 = 0;
-    if ( uNumDialogueNPCPortraits > 0 )
-    {
+  
       for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
       {
-        if ( v26 + 1 == v25 && uHouse_ExitPic )
+        if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
         {
           v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
           v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
@@ -1858,21 +1840,19 @@
         else
         {
           if ( v26 || !dword_591080 )
-            v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName;
+            v27 = HouseNPCData[v26 +1 - (dword_591080 != 0)]->pName;
           else
-            //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
           v30 = v27;
           v29 = (char*)pGlobalTXT_LocalizationStrings[435];
         }
-        sprintfex(byte_591180[v26], v29, v30);
-        HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
+        sprintfex(byte_591180[v26].data(), v29, v30);
+        dword_5913F4[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
                                                                  pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
-                                             0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26], 0, 0, 0);
-        v25 = uNumDialogueNPCPortraits;
+                                             0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0);
       }
-    }
-    if ( v25 == 1 )
+  
+    if ( uNumDialogueNPCPortraits == 1 )
     {
       window_SpeakInHouse = &pWindowList[uNextFreeWindowID];
       _4B4224_UpdateNPCTopics(0);
--- a/GUIWindow.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/GUIWindow.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,6 +1,6 @@
 #pragma once
 #include "Player.h"
-
+#include <array>
 
 
 
@@ -458,7 +458,7 @@
 
 extern int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[]; // idb
 extern struct GUIWindow *pWindow_MainMenu;
-extern struct GUIWindow pWindowList[20];
+extern std::array<struct GUIWindow, 20> pWindowList;
 
 
 
@@ -715,10 +715,10 @@
 extern struct GUIButton *pBtnLoadSlot;
 
 
-extern GUIButton *pCreationUI_BtnPressRight2[4];
-extern GUIButton *pCreationUI_BtnPressLeft2[4];
-extern GUIButton *pCreationUI_BtnPressLeft[4];
-extern GUIButton *pCreationUI_BtnPressRight[4];
+extern std::array<GUIButton*, 4> pCreationUI_BtnPressRight2;
+extern std::array<GUIButton*, 4> pCreationUI_BtnPressLeft2;
+extern std::array<GUIButton*, 4> pCreationUI_BtnPressLeft;
+extern std::array<GUIButton*, 4> pCreationUI_BtnPressRight;
 
 extern int uTextureID_GameUI_CharSelectionFrame; // 50C98C
 
@@ -730,7 +730,7 @@
 extern unsigned int ui_character_bonus_text_color_neg;
 extern unsigned int ui_character_skill_upgradeable_color;
 extern unsigned int ui_character_skill_default_color;
-extern unsigned int ui_character_award_color[6];
+extern std::array<unsigned int, 6> ui_character_award_color;
 extern unsigned int ui_game_minimap_outline_color;
 extern unsigned int ui_game_minimap_actor_friendly_color;
 extern unsigned int ui_game_minimap_actor_hostile_color;
@@ -738,7 +738,7 @@
 extern unsigned int ui_game_minimap_decoration_color_1;
 extern unsigned int ui_game_minimap_projectile_color;
 extern unsigned int ui_game_minimap_treasure_color;
-extern unsigned int ui_game_character_record_playerbuff_colors[24];
+extern std::array<unsigned int, 24> ui_game_character_record_playerbuff_colors;
 extern unsigned int ui_gamemenu_video_gamma_title_color;
 extern unsigned int ui_gamemenu_keys_action_name_color;
 extern unsigned int ui_gamemenu_keys_key_selection_blink_color_1;
--- a/Game.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Game.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -213,33 +213,33 @@
 
   if (render_framerate)
   {
-    sprintf(pTmpBuf, "FPS: % .4f", framerate);
-    pPrimaryWindow->DrawText(pFontArrus, 494, 0, TargetColor(0, 0, 0), pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "FPS: % .4f", framerate);
+    pPrimaryWindow->DrawText(pFontArrus, 494, 0, TargetColor(0, 0, 0), pTmpBuf.data(), 0, 0, 0);
   }
 
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
   {
     auto sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
-    sprintf(pTmpBuf, "Party Sector ID:        %u/%u\n", sector_id, pIndoor->uNumSectors);
-    pPrimaryWindow->DrawText(pFontArrus, 16, 16, TargetColor(255, 255, 255), pTmpBuf, 0, 0, 0xFFFFFFFF);
+    sprintf(pTmpBuf.data(), "Party Sector ID:        %u/%u\n", sector_id, pIndoor->uNumSectors);
+    pPrimaryWindow->DrawText(pFontArrus, 16, 16, TargetColor(255, 255, 255), pTmpBuf.data(), 0, 0, 0xFFFFFFFF);
   }
-  sprintf(pTmpBuf, "Party Position:         % d % d % d", pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
-  pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16, TargetColor(255, 255, 255), pTmpBuf, 0, 0, 0xFFFFFFFF);
+  sprintf(pTmpBuf.data(), "Party Position:         % d % d % d", pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
+  pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16, TargetColor(255, 255, 255), pTmpBuf.data(), 0, 0, 0xFFFFFFFF);
   
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
   {
     uint uFaceID;
     auto sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
     auto floor_level = BLV_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + 40, sector_id, &uFaceID);
-    sprintf(pTmpBuf, "BLV_GetFloorLevel: %d   face_id %d\n", floor_level, uFaceID);
+    sprintf(pTmpBuf.data(), "BLV_GetFloorLevel: %d   face_id %d\n", floor_level, uFaceID);
   }
   else
   {
     int on_water, _a6;
     auto floor_level = ODM_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z, 0, &on_water, &_a6, false);
-    sprintf(pTmpBuf, "ODM_GetFloorLevel: %d   on_water: %s    a6 = %d\n", floor_level, on_water ? "true" : "false", _a6);
+    sprintf(pTmpBuf.data(), "ODM_GetFloorLevel: %d   on_water: %s    a6 = %d\n", floor_level, on_water ? "true" : "false", _a6);
   }
-  pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16 + 16, TargetColor(255, 255, 255), pTmpBuf, 0, 0, 0xFFFFFFFF);
+  pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16 + 16, TargetColor(255, 255, 255), pTmpBuf.data(), 0, 0, 0xFFFFFFFF);
 
   GUI_UpdateWindows();
   pParty->UpdatePlayersAndHirelingsEmotions();
@@ -298,8 +298,8 @@
   for (uint i = 1; i < 5; ++i)
     for (uint j = 1; j < 6; ++j)
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
-      remove(pTmpBuf);
+      sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
+      remove(pTmpBuf.data());
     }
 
   LoadPlayerPortraintsAndVoices();
@@ -514,9 +514,9 @@
       pParty->uFallSpeed = 0;
       pParty->field_6E4 = 0;
       pParty->field_6E0 = 0;
-      if ( _stricmp(Source, pCurrentMapName) )
+      if ( _stricmp(Source, pCurrentMapName.data()) )
       {
-        strcpy(pCurrentMapName, Source);
+        strcpy(pCurrentMapName.data(), Source);
         _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
         _5B65AC_npcdata_fame_or_other = pParty->vPosition.y;
         _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
@@ -550,7 +550,7 @@
     dword_6BE340 = 0;
     pEventTimer->Pause();
     ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
-    if ( uGameState == GAME_STATE_3 )
+    if ( uGameState == GAME_STATE_LOADING_GAME )
     {
       sub_491E3A();
       LoadPlayerPortraintsAndVoices();
--- a/Game.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Game.h	Mon Jun 10 09:30:21 2013 +0600
@@ -16,7 +16,7 @@
   GAME_STATE_PLAYING = 0,
   GAME_FINISHED = 1,
   GAME_STATE_2 = 2,
-  GAME_STATE_3 = 3,
+  GAME_STATE_LOADING_GAME = 3,
   GAME_STATE_NEWGAME_OUT_GAMEMENU = 4,
   GAME_STATE_5 = 5,
   GAME_STATE_STARTING_NEW_GAME = 6,
--- a/IconFrameTable.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/IconFrameTable.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 
 
@@ -76,4 +76,4 @@
 extern struct UIAnimation *pUIAnum_Torchlight;
 extern struct UIAnimation *pUIAnim_WizardEye;
 
-extern struct UIAnimation *pUIAnims[4];
+extern std::array<struct UIAnimation *, 4> pUIAnims;
--- a/Indoor.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Indoor.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -51,7 +51,7 @@
 
 struct DecorationList *pDecorationList;
 
-LevelDecoration pLevelDecorations[3000];
+std::array<LevelDecoration, 3000> pLevelDecorations;
 size_t uNumLevelDecorations;
 LevelDecoration* activeLevelDecoration;
 
@@ -63,7 +63,7 @@
 BspRenderer_stru2 stru_F8A590;
 BspRenderer *pBspRenderer = new BspRenderer; // idb
 stru141 stru_721530;
-stru352 stru_F83B80[480];
+std::array<stru352, 480> stru_F83B80;
 
 
 
@@ -78,7 +78,7 @@
 };
 
 
-const char *_4E6BDC_loc_names[11]=
+std::array<const char *, 11> _4E6BDC_loc_names=
     {
     "mdt12.blv",
     "d18.blv",
@@ -1312,8 +1312,6 @@
     return;
   }
 
-
-
     if (p->uFaceID == uFaceID)
       return;
     if (!node_id &&
@@ -1337,10 +1335,8 @@
         nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ;
         nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY;
         nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
-        nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX,
-                                         pBLVRenderParams->uViewportY,
-                                         pBLVRenderParams->uViewportZ,
-                                         pBLVRenderParams->uViewportW);
+        nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
+                                         pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW);
         AddBspNodeToRenderList(++num_nodes - 1);
         return;
       }
@@ -1381,7 +1377,7 @@
 	  //savegame: qw , 0Bh and 0x1D4h
 	  //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ
       if (face_max_screenspace_x >= p->uViewportX &&
-//          face_min_screenspace_x <= p->uViewportZ &&
+          face_min_screenspace_x <= p->uViewportZ &&
           face_max_screenspace_y >= p->uViewportY &&
           face_min_screenspace_y <= p->uViewportW &&
           sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID))
@@ -2684,7 +2680,7 @@
   pGameLoadingUI_ProgressBar->Progress();
   
   memcpy(&uNumLevelDecorations, pData, 4);
-  memcpy(pLevelDecorations, pData + 4, uNumLevelDecorations * sizeof(LevelDecoration));
+  memcpy(pLevelDecorations.data(), pData + 4, uNumLevelDecorations * sizeof(LevelDecoration));
   pData += 4 + uNumLevelDecorations * sizeof(LevelDecoration);
 
   for (uint i = 0; i < uNumLevelDecorations; ++i)
@@ -2785,7 +2781,7 @@
   if (dword_6BE364_game_settings_1 & 0x2000 )
     _i = 29030400;
   bool _a = false;
-  if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") )
+  if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName.data(), "d29.dlv") )
     _a = true;
 
   //v154 = 875;
@@ -2879,21 +2875,21 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumActors, pData, 4);
-  memcpy(pActors, pData + 4, uNumActors * sizeof(Actor));
+  memcpy(pActors.data(), pData + 4, uNumActors * sizeof(Actor));
   pData += 4 + uNumActors * sizeof(Actor);
 
   pGameLoadingUI_ProgressBar->Progress();
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumSpriteObjects, pData, 4);
-  memcpy(pSpriteObjects, pData + 4, uNumSpriteObjects * sizeof(SpriteObject));
+  memcpy(pSpriteObjects.data(), pData + 4, uNumSpriteObjects * sizeof(SpriteObject));
   pData += 4 + uNumSpriteObjects * sizeof(SpriteObject);
 
   pGameLoadingUI_ProgressBar->Progress();
 
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto pItem = pSpriteObjects + i;
+    auto pItem = &pSpriteObjects[i];
  
     if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100))
     {
@@ -2912,7 +2908,7 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumChests, pData, 4);
-  memcpy(pChests, pData + 4, uNumChests * sizeof(Chest));
+  memcpy(pChests.data(), pData + 4, uNumChests * sizeof(Chest));
   pData += 4 + uNumChests * sizeof(Chest);
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -4322,7 +4318,7 @@
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
   }
-  if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d23.blv") )
+  if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d23.blv") )
     bNoNPCHiring = 1;
   pPaletteManager->pPalette_tintColor[0] = 0;
   pPaletteManager->pPalette_tintColor[1] = 0;
@@ -4330,7 +4326,7 @@
   pPaletteManager->RecalculateAll();
   if ( qword_A750D8 )
     qword_A750D8 = 0i64;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName);
+  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   v39 = v2;
   if ( v2 )
   {
@@ -4349,7 +4345,7 @@
   TryLoadLevelFromLOD();
   pStationaryLightsStack->uNumLightsActive = 0;
   v4 = pIndoor->Load(
-         pCurrentMapName,
+         pCurrentMapName.data(),
          (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1,
          v1,
          (char *)&pDest)
@@ -4484,7 +4480,7 @@
   
   for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    auto pDecortaion = pLevelDecorations + i;
+    auto pDecortaion = &pLevelDecorations[i];
     
     pDecorationList->InitializeDecorationSprite(pDecortaion->uDecorationDescID);
 
@@ -4546,7 +4542,7 @@
 
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto p = pSpriteObjects + i;
+    auto p = &pSpriteObjects[i];
     if (p->uObjectDescID)
     {
       auto uItemID = p->stru_24.uItemID;
@@ -4563,7 +4559,7 @@
   for (uint i = 0; i < uNumActors; ++i)
   //if ( (signed int)uNumActors > (signed int)v13 )
   {
-    Actor *pActor = pActors + i;
+    Actor *pActor = &pActors[i];
     //v26 = (char *)&pActors[0].uAttributes;
     //do
     //{
--- a/Indoor.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Indoor.h	Mon Jun 10 09:30:21 2013 +0600
@@ -39,7 +39,7 @@
   __int16 field_1E;
 };
 #pragma pack(pop)
-extern LevelDecoration pLevelDecorations[3000];
+extern std::array<LevelDecoration, 3000> pLevelDecorations;
 extern size_t uNumLevelDecorations;
 extern LevelDecoration* activeLevelDecoration;
 
--- a/Indoor_stuff.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Indoor_stuff.h	Mon Jun 10 09:30:21 2013 +0600
@@ -423,4 +423,4 @@
   int field_34;
 };
 #pragma pack(pop)
-extern stru352 stru_F83B80[480];
\ No newline at end of file
+extern std::array<stru352, 480> stru_F83B80;
\ No newline at end of file
--- a/Items.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Items.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -28,7 +28,7 @@
 	};
 
 
-const char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12};
+std::array<const char, 5> uItemsAmountPerShopType={ 0, 6, 8, 12, 12};
 
 const ITEM_VARIATION shopWeap_variation_ord[15] ={
 	{ 0, { 0, 0, 0, 0 }},
@@ -134,14 +134,14 @@
 const unsigned __int16 shopAlchSpc_treasure_lvl[13]   =  {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2};
 
 
-char byte_4E8168[7][14]={  //byte_4E8178
+std::array< std::array<char, 14>, 7> byte_4E8168={{  //byte_4E8178
     { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
     { 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
     { 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3},
     { 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4},
     { 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5},
     { 2, 2, 2, 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6},
-    { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}};
+    { 2, 2, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}};
 
 int  sub_4BE571(int a1, int *a2, int a3, int a4);
 
@@ -1477,10 +1477,10 @@
   equip_type = pItemsTable->pItems[uItemID].uEquipType;
   if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) )
   {
-    sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName);
-    return item__getname_buffer;
+    sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
+    return item__getname_buffer.data();
   }
-  sprintf(item__getname_buffer, "%s", pItemsTable->pItems[uItemID].pName);
+  sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName);
   if ( uItemID == ITEM_LICH_JAR )  //Lich Jar
   {
     if ( (uHolderPlayer >0 )&& (uHolderPlayer <= 4) )
@@ -1491,21 +1491,21 @@
           format_str = pGlobalTXT_LocalizationStrings[655]; //"%s' Jar"
         else
           format_str = pGlobalTXT_LocalizationStrings[654]; //"%s's Jar"
-		sprintf(item__getname_buffer, format_str, pPlayers[uHolderPlayer]->pName);
-		return item__getname_buffer;
+		sprintf(item__getname_buffer.data(), format_str, pPlayers[uHolderPlayer]->pName);
+		return item__getname_buffer.data();
       }
   }
   if ( !pItemsTable->IsMaterialNonCommon(this) )
   {
     if ( uEnchantmentType )
     {
-      strcat(item__getname_buffer, " ");
+      strcat(item__getname_buffer.data(), " ");
       nameModificator = pItemsTable->pEnchantments[uEnchantmentType-1].pOfName;
     }
     else
     {
       if ( !uSpecEnchantmentType )
-        return item__getname_buffer;
+        return item__getname_buffer.data();
       if ( uSpecEnchantmentType == 16 //Drain Hit Points from target.
         || uSpecEnchantmentType == 39 //Double damage vs Demons.
         || uSpecEnchantmentType == 40 //Double damage vs Dragons
@@ -1521,17 +1521,17 @@
         || uSpecEnchantmentType == 67 //Adds 5 points of Body damage and +2 Disarm skill.
         || uSpecEnchantmentType == 68 ) //Adds 6-8 points of Cold damage and +5 Armor Class.
       {  //enchantment and name positions inverted!
-        sprintf( item__getname_buffer, "%s %s",
+        sprintf( item__getname_buffer.data(), "%s %s",
 				  pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd,
 				  pItemsTable->pItems[uItemID].pName);
-        return item__getname_buffer;
+        return item__getname_buffer.data();
       }
-      strcat(item__getname_buffer, " ");
+      strcat(item__getname_buffer.data(), " ");
 	  nameModificator = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType-1].pNameAdd;
     }
-    strcat(item__getname_buffer, nameModificator);
+    strcat(item__getname_buffer.data(), nameModificator);
   }
-  return item__getname_buffer;
+  return item__getname_buffer.data();
 }
 
 
@@ -2053,7 +2053,7 @@
     signed int v23; // [sp+24h] [bp-4h]@2
 
     v18 = rand() % 100;  //main random
-    v0 = pMapStats->GetMapInfo(pCurrentMapName);
+    v0 = pMapStats->GetMapInfo(pCurrentMapName.data());
     //	v1 = pChests;
     v2 = &pMapStats->pInfos[v0];
     //v21 = pChests;
--- a/Items.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Items.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,4 +1,5 @@
 #pragma once
+#include <array>
 
 enum DAMAGE_TYPE:unsigned int
     {
@@ -329,7 +330,7 @@
 void GenerateSpecialShopItems();
 void GenerateItemsInChest();
 
-extern const char uItemsAmountPerShopType[]; // weak
+extern std::array<const char, 5> uItemsAmountPerShopType; // weak
 extern ItemGen *ptr_50C9A4;
 
 extern struct ItemsTable *pItemsTable;
--- a/LightmapBuilder.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/LightmapBuilder.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -671,7 +671,7 @@
   v19 = 0.0;
   thisa = this;
   v20 = 0.0;
-  result = _45CBD4(a3, a4, dword_69B010, &v22);
+  result = _45CBD4(a3, a4, dword_69B010.data(), &v22);
   for ( i = 0; i < v22; result = i )
   {
     v6 = a2;
--- a/MM7.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/MM7.h	Mon Jun 10 09:30:21 2013 +0600
@@ -88,7 +88,7 @@
   __int16 height;
 };
 #pragma pack(pop)
-extern stat_coord stat_string_coord[26];
+extern std::array<stat_coord, 26> stat_string_coord;
 
 /*  376 */
 #pragma pack(push, 1)
--- a/Math.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Math.h	Mon Jun 10 09:30:21 2013 +0600
@@ -16,12 +16,12 @@
   int pTanTable[520];
   int pCosTable[520];
   int pInvCosTable[520];
-  unsigned int uIntegerPi;
-  unsigned int uIntegerHalfPi;
-  unsigned int uIntegerDoublePi;
-  unsigned int uDoublePiMask;
-  unsigned int uPiMask;
-  unsigned int uHalfPiMask;
+  static const unsigned int uIntegerPi = 1024;
+  static const unsigned int uIntegerHalfPi = 512;
+  static const unsigned int uIntegerDoublePi = 2048;
+  static const unsigned int uDoublePiMask = 2047;
+  static const unsigned int uPiMask = 1023;
+  static const unsigned int uHalfPiMask = 511;
 };
 #pragma pack(pop)
 
--- a/Monsters.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Monsters.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -168,8 +168,8 @@
         return 73;
     else
         {
-        sprintf(pTmpBuf, "Unknown monster spell %s", tbl->pProperties[0]);
-        MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
+        sprintf(pTmpBuf.data(), "Unknown monster spell %s", tbl->pProperties[0]);
+        MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0);
         ++*next_token;
         return 0;
         }
@@ -1087,7 +1087,7 @@
                             if ( parsed_field.uPropCount  > 1 )
                                 {
                                 pTmpBuf[0] = 0;
-                                strcpy(pTmpBuf, parsed_field.pProperties[2]);
+                                strcpy(pTmpBuf.data(), parsed_field.pProperties[2]);
                                 if ( parsed_field.uPropCount  > 2 )
                                     {
                                     int prop_cnt = 3;
@@ -1095,9 +1095,9 @@
                                         {
                                         do
                                             {
-                                            strcat(pTmpBuf, " ");
+                                            strcat(pTmpBuf.data(), " ");
                                             char test_char = parsed_field.pProperties[prop_cnt][0];
-                                            strcat(pTmpBuf, parsed_field.pProperties[prop_cnt]);
+                                            strcat(pTmpBuf.data(), parsed_field.pProperties[prop_cnt]);
                                             if ( prop_cnt == (parsed_field.uPropCount - 1) )
                                                 {
                                                 switch (tolower(test_char))
@@ -1121,10 +1121,10 @@
                                     }
                                 if ( pMonsterList->uNumMonsters )
                                     {
-                                    pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf) + 1;
+                                    pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf.data()) + 1;
                                     if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
                                         {
-                                        sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf);
+                                        sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf.data());
                                         MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
                                         }
                                     }
--- a/NPC.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/NPC.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -13,7 +13,7 @@
 #include "NPC.h"
 
 int pDialogueNPCCount;
-struct Texture *pDialogueNPCPortraits[6];
+std::array<struct Texture *, 6> pDialogueNPCPortraits;
 int uNumDialogueNPCPortraits; // weak
 struct NPCStats *pNPCStats = nullptr;
 
--- a/NPC.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/NPC.h	Mon Jun 10 09:30:21 2013 +0600
@@ -70,7 +70,7 @@
   const char *pText;
 };
 
-extern NPCTopic pNPCTopics[789];
+extern std::array<NPCTopic, 789> pNPCTopics;
 
 
 /*  136 */
@@ -187,7 +187,7 @@
 #pragma pack(pop)
 
 extern int pDialogueNPCCount;
-extern struct Texture *pDialogueNPCPortraits[6];
+extern std::array<struct Texture *, 6> pDialogueNPCPortraits;
 extern int uNumDialogueNPCPortraits; // weak
 extern struct NPCStats *pNPCStats;
 
--- a/Outdoor.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Outdoor.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -43,7 +43,7 @@
 
 
 stru149 stru_8019C8;
-stru148 array_77EC08[2000 + 18000];
+std::array<stru148, 2000 + 18000> array_77EC08;
 Surf stru_80C980;
 Edge defaultEdge; // weak
 Edge stru_80C9A4;
@@ -76,8 +76,8 @@
 };
 
 //for future sky textures?
-int dword_4EC268[9]={3,3,3,3,3,3,3,3,3}; // weak
-int dword_4EC28C[7]={3,3,3,3,3,3,3}; // weak
+std::array<int, 9> dword_4EC268={{3,3,3,3,3,3,3,3,3}}; // weak
+std::array<int, 7> dword_4EC28C={{3,3,3,3,3,3,3}}; // weak
 int dword_4EC2A8=9; // weak
 int dword_4EC2AC=7; // weak
 
@@ -184,7 +184,7 @@
 
   pRenderer->DrawSpriteObjects_ODM();
   pRenderer->TransformBillboardsAndSetPalettesODM();
-  sub_485F53((Vec2_int_ *)unnamed_6BE060);
+  sub_485F53((Vec2_int_ *)unnamed_6BE060.data());
 }
 
 
@@ -651,9 +651,9 @@
 //----- (00489487) --------------------------------------------------------
 void OutdoorLocation::SetFog()
 {
-  strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
+  strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
 
-  auto map_id = pMapStats->GetMapInfo(pCurrentMapName);
+  auto map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
   if (map_id == MAP_INVALID || map_id == MAP_CELESTIA || map_id == MAP_THE_PIT || map_id > MAP_SHOALS)
     return;
 
@@ -1197,9 +1197,9 @@
   v6 = pAllocator->AllocNamedChunk(0, 2u, "IDLIST");
   v1->pFaceIDLIST = (unsigned __int16 *)v6;
   *(short *)v6 = 0;
-  strcpy(v1->pSkyTextureName, pDefaultSkyTexture);
+  strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data());
   v1->uSky_TextureID = pBitmaps_LOD->LoadTexture(v1->pSkyTextureName);
-  strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
+  strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data());
   v7 = pBitmaps_LOD->LoadTexture(v1->pGroundTileset);
   v8 = v1->uSky_TextureID == -1;
   v1->uMainTile_BitmapID = v7;
@@ -1816,10 +1816,10 @@
   pGameLoadingUI_ProgressBar->Progress();
   memcpy(&uNumTerrainNormals, pSrc, 4);
   //v43 = (char *)v43 + 4;
-  memcpy(pTerrainSomeOtherData, pSrc + 4, 0x20000);
+  memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000);
   pSrc += 4 + 0x20000;
   //v43 = (char *)v43 + 131072;
-  memcpy(pTerrainNormalIndices, pSrc, 0x10000);
+  memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000);
   pSrc += 0x10000;
   //v43 = (char *)v43 + 65536;
 
@@ -1993,7 +1993,7 @@
 
   assert(sizeof(LevelDecoration) == 32);
   //pFilename = (char *)(32 * uNumLevelDecorations);
-  memcpy(pLevelDecorations, pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration));
+  memcpy(pLevelDecorations.data(), pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration));
   pSrc += 4 + sizeof(LevelDecoration) * uNumLevelDecorations;
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -2294,7 +2294,7 @@
 
   assert(sizeof(Actor) == 836);
   //pFilename = (char *)(836 * uNumActors);
-  memcpy(pActors, pSrc + 4, uNumActors * sizeof(Actor));
+  memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor));
   pSrc += 4 + uNumActors * sizeof(Actor);
   //v92 = (char *)v91 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
@@ -2306,7 +2306,7 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   //pFilename = (char *)(112 * uNumSpriteObjects);
-  memcpy(pSpriteObjects, pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject));
+  memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject));
   pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject);
 
   //v94 = (char *)v93 + (int)pFilename;
@@ -2322,7 +2322,7 @@
 
   assert(sizeof(Chest) == 5324);
   //pFilename = (char *)(5324 * uNumChests);
-  memcpy(pChests, pSrc + 4 , uNumChests * sizeof(Chest));
+  memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest));
   pSrc += 4 + uNumChests * sizeof(Chest);
   //v96 = (char *)v95 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
@@ -2345,7 +2345,7 @@
   pTileTable->InitializeTileset(pTileTypes[2].tileset);
   //v108 = pTileTypes[3].uTileGroup;
   pTileTable->InitializeTileset(pTileTypes[3].tileset);
-  strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture);
+  strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data());
   //v97 = pTileTypes[0].uTileID;
   //v108 = 0;
   auto v98 = pTileTable->GetTileById(pTileTypes[0].uTileID);
@@ -2703,12 +2703,12 @@
 
   v1 = 0;
   v8 = 0;
-  if ( !_stricmp(pCurrentMapName, "out09.odm") )
+  if ( !_stricmp(pCurrentMapName.data(), "out09.odm") )
     v8 = 1;
 
   for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    auto decor = pLevelDecorations + i;
+    auto decor = &pLevelDecorations[i];
 
       pDecorationList->InitializeDecorationSprite(decor->uDecorationDescID);
       v4 = pDecorationList->pDecorations[decor->uDecorationDescID].uSoundID;
@@ -2943,7 +2943,7 @@
     //v1 = pActors;//[0].vPosition.z;
     //do
     //{
-    auto actor = pActors + i;
+    auto actor = &pActors[i];
 	  //v2 = actor->uAIState;
 
 	actor->uAttributes &= 0xFFFFFFF7u;
--- a/Outdoor_stuff.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Outdoor_stuff.h	Mon Jun 10 09:30:21 2013 +0600
@@ -99,7 +99,7 @@
   float field_14;
 };
 #pragma pack(pop)
-extern stru148 array_77EC08[];
+extern std::array<stru148, 2000 + 18000> array_77EC08;
 
 
 
--- a/Party.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Party.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -196,7 +196,7 @@
 	  byte_AE3368[v4] = 1;
   }
   if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] )
-    memset(byte_AE3368, 0, 4u);
+    memset(byte_AE3368.data(), 0, 4u);
   v2 = v12;
   if ( v12 )
     return v2 + 1;
@@ -849,7 +849,7 @@
     v4 = 0;
     if ( (signed int)uNumActors > 0 )
     {
-      v0 = pActors;//[0].pMonsterInfo.uMovementType;
+      v0 = pActors.data();//[0].pMonsterInfo.uMovementType;
       do
       {
         if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long && v0->pMonsterInfo.uMovementType != 5 )
--- a/Player.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Player.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -109,7 +109,7 @@
 
 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF};
 
-unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0};
+std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}};
 
 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175,
                          150, 125, 100,  75,  50,  40,  35,  30,  25,  21,
@@ -564,7 +564,7 @@
   //v4 = a2;//102
   v5 = 0;
   pSoundId = 0;
-  v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ???
+  v6 = SoundSetAction[speech].data();//byte_4ED280 &byte_4ED3D8[4 * v4] ???
   if (uVoicesVolumeMultiplier)
   {
     v7 = 0;
@@ -1431,8 +1431,8 @@
   }
   else
   {
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName);
-    ShowStatusBarString(pTmpBuf, 2u);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName);
+    ShowStatusBarString(pTmpBuf.data(), 2u);
     result = 0;
   }
   return result;
@@ -3444,8 +3444,8 @@
           {
             party_finds_gold(v19, 2);
             v22 = v19;
-            v23 = pTmpBuf2;
-            sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22);
+            v23 = pTmpBuf2.data();
+            sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22);
 LABEL_43:
             ShowStatusBarString(v23, 2u);
             return _steal_perma;
@@ -3493,11 +3493,11 @@
             }
             sub_421B2C_PlaceInInventory_or_DropPickedItem();
             sprintf(
-              pTmpBuf2,
+              pTmpBuf2.data(),
               pGlobalTXT_LocalizationStrings[304],
               v31->pName,
               pItemsTable->pItems[v16].pUnidentifiedName);
-            ShowStatusBarString(pTmpBuf2, 2u);
+            ShowStatusBarString(pTmpBuf2.data(), 2u);
             sub_421B2C_PlaceInInventory_or_DropPickedItem();
             memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem));
             pMouse->SetCursorBitmapFromItemID(v16);
@@ -3508,8 +3508,8 @@
       v26 = (int)v31->pName;
       v25 = pGlobalTXT_LocalizationStrings[377];
     }
-    v23 = pTmpBuf2;
-    sprintfex(pTmpBuf2, v25, v26);
+    v23 = pTmpBuf2.data();
+    sprintfex(pTmpBuf2.data(), v25, v26);
     goto LABEL_43;
   }
   return 0;
@@ -6747,8 +6747,8 @@
         else
             {    
             v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf, 2);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+            ShowStatusBarString(pTmpBuf.data(), 2);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7039,8 +7039,8 @@
 
         default:
             v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7083,8 +7083,8 @@
             {
 
             v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
-        ShowStatusBarString(pTmpBuf, 2u);
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
             }
@@ -7127,16 +7127,16 @@
         if ( v72 )
             {
             v66 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
         if ( !pParty->pPlayers[player_num-1].CanAct() )
             {
             v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7156,8 +7156,8 @@
         if ( v16 > v67 || !v17 )
             {
             v22 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             v3->PlaySound((PlayerSpeech)20, 0);
             return; 
             }
@@ -7203,8 +7203,8 @@
             return;
             }
         v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
-        ShowStatusBarString(pTmpBuf, 2u);
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
         }
@@ -7221,47 +7221,47 @@
                 {
             case 0:
                 v3->uMight += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 1:
                 v3->uIntelligence += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 2:
                 v3->uWillpower += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 3:
                 v3->uEndurance += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 4:
                 v3->uAccuracy += thisa;
-               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 5:
                 v3->uSpeed += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 6:
                 v3->uLuck += thisa;
-               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 7:
                 party_finds_gold(1000 * thisa, 0);
-                sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
+                sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
                 break;
             case 8:
                 Party::GiveFood(5 * thisa); 
-                sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
+                sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
                 break;
             case 9u:
                 v3->uSkillPoints += 2 * thisa;
-                sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
+                sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
                 break;
             case 10:
                 v3->uExperience += 2500 * thisa;
-                sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
+                sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
                 break;
             case 11:
                 v8 = rand() % 6;
@@ -7292,11 +7292,11 @@
                     v13 = pGlobalTXT_LocalizationStrings[29];
                     break;
                     }
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
                 break;
 
                 }
-            ShowStatusBarString(pTmpBuf, 2u);
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pMouse->RemoveHoldingItem();
             pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
             v3->PlaySound(SPEECH_93, 0);
@@ -7355,8 +7355,8 @@
                 {
    
                 v68 = pParty->pPickedItem.GetDisplayName();
-                sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
-                ShowStatusBarString(pTmpBuf, 2u);
+                sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
+                ShowStatusBarString(pTmpBuf.data(), 2u);
                 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
@@ -8047,15 +8047,15 @@
         case VAR_RandomGold:
           v6 = rand() % var_value + 1;
           Party::SetGold(v6);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           return;
         case VAR_RandomFood:
           v7 = rand() % var_value + 1;
           Party::SetFood(v7);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           goto LABEL_124;
         case VAR_Sex:
@@ -8481,8 +8481,8 @@
                 val = 1;
               v7 = rand() % val + 1;
               Party::GiveFood(v7);
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
-              ShowStatusBarString(pTmpBuf, 2u);
+              sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
+              ShowStatusBarString(pTmpBuf.data(), 2u);
               GameUI_DrawFoodAndGold();
               goto _play_sound;
             case VAR_Sex:
@@ -8611,8 +8611,8 @@
               goto LABEL_82;
             case VAR_FixedFood:
               Party::GiveFood(val);
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val);
-              ShowStatusBarString(pTmpBuf, 2u);
+              sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
+              ShowStatusBarString(pTmpBuf.data(), 2u);
               if ( pParty->uNumFoodRations > 0xFFFF )
                 Party::SetFood(0xFFFFu);
               goto _play_sound;
@@ -9121,8 +9121,8 @@
           if ( v6 > pParty->uNumGold )
             v6 = pParty->uNumGold;
           Party::TakeGold(v6);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6);
-          ShowStatusBarString(pTmpBuf, 2);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6);
+          ShowStatusBarString(pTmpBuf.data(), 2);
           GameUI_DrawFoodAndGold();
           return result;
         case VAR_RandomFood:
@@ -9130,8 +9130,8 @@
           if ( v7 > pParty->uNumFoodRations )
             v7 = pParty->uNumFoodRations;
           Party::TakeFood(v7);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7);
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7);
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;
--- a/Render.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Render.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -267,7 +267,7 @@
   v0 = pRenderer->pTargetSurface;
   v1 = pOutdoorCamera->numStru148s;
   a1 = pRenderer->pTargetSurface;
-  v2 = array_77EC08;
+  v2 = array_77EC08.data();
   v37 = pOutdoorCamera->numStru148s;
   if ( !(pParty->uFlags & 2) )
   {
@@ -1134,7 +1134,7 @@
       if ( v120 > terrain_76DFC8[v17] )
       {
         v125 = v120;
-        memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - terrain_76DFC8[v17] + 1));
+        memset32(terrain_76D9C8.data(), v119 + 1, 4 * (v120 - terrain_76DFC8[v17] + 1));
         v19 = v120;
         do
           terrain_76DBC8[v126++] = v19--;
@@ -1182,7 +1182,7 @@
       if ( v120 > terrain_76E3C8[v18] )
       {
         v125 = v120;
-        memset32(terrain_76D5C8, v122, 4 * (v120 - terrain_76E3C8[v18] + 1));
+        memset32(terrain_76D5C8.data(), v122, 4 * (v120 - terrain_76E3C8[v18] + 1));
         do
         {
           v25 = v126;
@@ -1235,7 +1235,7 @@
       if ( v122 < terrain_76DDC8[v17] )
       {
         v106 = v122;
-        memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1));
+        memset32(terrain_76DBC8.data(), v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1));
         for ( v32 = v122; v32 <= terrain_76DDC8[v17]; v32++)
           terrain_76D9C8[v126++] = v32;
         if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
@@ -1280,7 +1280,7 @@
       if ( v122 < v37 )
       {
         v114 = v122;
-        memset32(terrain_76D7C8, i, 4 * (v37 - v122 + 1));
+        memset32(terrain_76D7C8.data(), i, 4 * (v37 - v122 + 1));
         do
         {
           v38 = v126;
@@ -1332,7 +1332,7 @@
       if ( v119 > terrain_76DDC8[v17] )
       {
         v106 = v119;
-        memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1));
+        memset32(terrain_76DBC8.data(), i, 4 * (v119 - terrain_76DDC8[v17] + 1));
         for ( v45 = v119; v45 >= terrain_76DDC8[v17]; v45--)
           terrain_76D9C8[v126++] = v45;
         if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] )
@@ -1377,7 +1377,7 @@
       if ( v119 > v49 )
       {
         v125 = v119;
-        memset32(terrain_76D7C8, v120 + 1, 4 * (v119 - v49 + 1));
+        memset32(terrain_76D7C8.data(), v120 + 1, 4 * (v119 - v49 + 1));
         do
         {
           v50 = v126;
@@ -1429,7 +1429,7 @@
       if ( i < terrain_76DFC8[v17] )
       {
         v106 = i;
-        memset32(terrain_76D9C8, v122, 4 * (terrain_76DFC8[v17] - i + 1));
+        memset32(terrain_76D9C8.data(), v122, 4 * (terrain_76DFC8[v17] - i + 1));
         v56 = i;
         do
         {
@@ -1480,7 +1480,7 @@
       if ( i < v62 )
       {
         v114 = i;
-        memset32(terrain_76D5C8, v119 + 1, 4 * (v62 - i + 1));
+        memset32(terrain_76D5C8.data(), v119 + 1, 4 * (v62 - i + 1));
         do
         {
           v63 = v126;
@@ -2831,7 +2831,7 @@
           v17->field_34 = v58->distance;
           v17->terrain_grid_z = v94;
           v17->terrain_grid_x = LOBYTE(v99);
-          v59 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + LODWORD(v93));
+          v59 = *(unsigned __int16 *)((char *)pTerrainNormalIndices.data() + LODWORD(v93));
           if ( v59 > (signed int)(uNumTerrainNormals - 1) )
           {
             pNormalb = 0;
@@ -3079,7 +3079,7 @@
   //v41 = 0;
   for (int i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto object = pSpriteObjects + i;
+    auto object = &pSpriteObjects[i];
     //auto v0 = (char *)&pSpriteObjects[i].uSectorID;
     //v0 = (char *)&pSpriteObjects[0].uSectorID;
     //do
@@ -3500,7 +3500,7 @@
     //do
   for (int i = 0; i < uNumLevelDecorations; ++i)
   {
-    auto decor = pLevelDecorations + i;
+    auto decor = &pLevelDecorations[i];
     auto v0 = (char *)&pLevelDecorations[i].vPosition.y;
 
       if ( (!(decor->field_2 & 0x40) || decor->_47A825()) && !(decor->field_2 & 0x20) )
@@ -8975,7 +8975,7 @@
     LODWORD(v40) = (int)v14;
 
     int __i = 0;
-    v15 = dword_F1B430;
+    v15 = dword_F1B430.data();
     do
     {
       v16 = v3;
--- a/SaveLoad.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/SaveLoad.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -32,9 +32,9 @@
 
 struct SavegameList *pSavegameList = new SavegameList;
 unsigned int uNumSavegameFiles;
-unsigned int pSavegameUsedSlots[45];
-struct RGBTexture pSavegameThumbnails[45];
-SavegameHeader    pSavegameHeader[45];
+std::array<unsigned int, 45> pSavegameUsedSlots;
+std::array<struct RGBTexture, 45> pSavegameThumbnails;
+std::array<SavegameHeader, 45> pSavegameHeader;
 
 
 
@@ -66,8 +66,8 @@
   for (uint i = 1; i < 5; ++i)
     for (uint j = 1; j < 6; ++j)
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
-      remove(pTmpBuf);
+      sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
+      remove(pTmpBuf.data());
     }
 
 
@@ -89,10 +89,10 @@
         }
     }
 
-  sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName);
+  sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[uSlot].pSaveFileName);
 
   pNew_LOD->CloseWriteFile();
-  if (!CopyFileA(pTmpBuf, "data\\new.lod", 0))
+  if (!CopyFileA(pTmpBuf.data(), "data\\new.lod", 0))
     int e = GetLastError();
 
   pNew_LOD->LoadFile("data\\new.lod", 0);
@@ -206,15 +206,15 @@
   pEventTimer->StopGameTime();
 
   v25 = pGames_LOD->DoesContainerExist(header.pLocationName);
-  sprintf(pTmpBuf, "levels\\%s", header.pLocationName);
-  v26 = _access(pTmpBuf, 4) != -1;
+  sprintf(pTmpBuf.data(), "levels\\%s", header.pLocationName);
+  v26 = _access(pTmpBuf.data(), 4) != -1;
   if ( !v25 && !v26 )
   {
-    sprintf(pTmpBuf, "Unable to find: %s!", header.pLocationName);
-    Abortf(pTmpBuf);
+    sprintf(pTmpBuf.data(), "Unable to find: %s!", header.pLocationName);
+    Abortf(pTmpBuf.data());
   }
 
-  strcpy(pCurrentMapName, header.pLocationName);
+  strcpy(pCurrentMapName.data(), header.pLocationName);
   dword_6BE364_game_settings_1 |= 0x2001;
 
   for (uint i = 0; i < uNumSavegameFiles; ++i)
@@ -259,8 +259,8 @@
   unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23
  
   //v66 = a2;
-  strcpy(byte_6BE3B0, pCurrentMapName);
-  if (!_stricmp(pCurrentMapName, "d05.blv")) // arena
+  strcpy(byte_6BE3B0.data(), pCurrentMapName.data());
+  if (!_stricmp(pCurrentMapName.data(), "d05.blv")) // arena
     return;
 
   uncompressed_buff = (char*)malloc(1000000);
@@ -310,7 +310,7 @@
   memset(save_header.pName, 0, 20);
   memset(save_header.pLocationName, 0, 20);
   memset(save_header.field_30, 0, 52);
-  strcpy(save_header.pLocationName, pCurrentMapName);
+  strcpy(save_header.pLocationName, pCurrentMapName.data());
   save_header.uWordTime = pParty->uTimePlayed;
   strcpy(pLodDirectory.pFilename, "header.bin");
   pLodDirectory.uDataSize = sizeof(SavegameHeader);
@@ -419,15 +419,15 @@
         }
       memcpy(data_write_pos, &uNumActors, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pActors, 836 * uNumActors);
+      memcpy(data_write_pos, pActors.data(), 836 * uNumActors);
       data_write_pos += 836 * uNumActors;
       memcpy(data_write_pos, &uNumSpriteObjects, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects);
+      memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects);
       data_write_pos += 112 * uNumSpriteObjects;
       memcpy(data_write_pos, &uNumChests, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pChests, sizeof(Chest)*uNumChests);//5324 *
+      memcpy(data_write_pos, pChests.data(), sizeof(Chest)*uNumChests);//5324 *
       data_write_pos += sizeof(Chest)* uNumChests;
       memcpy(data_write_pos, pIndoor->pDoors, 0x3E80);
       data_write_pos += 16000;
@@ -468,22 +468,22 @@
         }
       memcpy(data_write_pos, &uNumActors, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pActors, 836 * uNumActors);
+      memcpy(data_write_pos, pActors.data(), 836 * uNumActors);
       data_write_pos +=  836 * uNumActors;
       memcpy(data_write_pos, &uNumSpriteObjects, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects);
+      memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects);
       data_write_pos += 112 * uNumSpriteObjects;
       memcpy(data_write_pos, &uNumChests, 4);
       data_write_pos += 4;
-      memcpy(data_write_pos, pChests, sizeof(Chest)* uNumChests);
+      memcpy(data_write_pos, pChests.data(), sizeof(Chest)* uNumChests);
       data_write_pos += sizeof(Chest)* uNumChests;
       memcpy(data_write_pos, &stru_5E4C90, 0xC8);
       data_write_pos += 200;
       memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
       data_write_pos += 56;
     }
-    strcpy(Source, pCurrentMapName);
+    strcpy(Source, pCurrentMapName.data());
     _splitpath(Source, Drive, Dir, Filename, Ext);
    
     Size = (int)data_write_pos - (int)uncompressed_buff;
@@ -539,20 +539,20 @@
 
   //v1 = uSlot;
   //v6 = uSlot;
-  bNotArena = _stricmp(pCurrentMapName, "d05.blv");
+  bNotArena = _stricmp(pCurrentMapName.data(), "d05.blv");
   if ( bNotArena )
   {
     LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
     SaveGame(0, 0);
     //v2 = 100 * v1;
-    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName);
+    strcpy(pSavegameHeader[uSlot].pLocationName, pCurrentMapName.data());
     pSavegameHeader[uSlot].uWordTime = pParty->uTimePlayed;
     strcpy(pDir.pFilename, "header.bin");
     pDir.uDataSize = 100;
     pNew_LOD->Write(&pDir, &pSavegameHeader[uSlot], 0);
-    sprintf(pTmpBuf, "saves\\save%03d.mm7", uSlot);
+    sprintf(pTmpBuf.data(), "saves\\save%03d.mm7", uSlot);
     pNew_LOD->CloseWriteFile();
-    CopyFileA("data\\new.lod", pTmpBuf, 0);
+    CopyFileA("data\\new.lod", pTmpBuf.data(), 0);
   }
   GUI_UpdateWindows();
   pGUIWindow_CurrentMenu->Release();
@@ -597,14 +597,14 @@
 
     for (uint i = 0; i < 40; ++i)
     {
-      sprintf(pTmpBuf, "save%03d.mm7", i);
-      if (_access(pTmpBuf, 0) == -1)
+      sprintf(pTmpBuf.data(), "save%03d.mm7", i);
+      if (_access(pTmpBuf.data(), 0) == -1)
         continue;
 
       uint idx = i;
       if (!bHideEmptySlots)
         idx = uNumSavegameFiles;
-      strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf);
+      strcpy(pSavegameList->pFileList[idx].pSaveFileName, pTmpBuf.data());
 
       ++uNumSavegameFiles;
     }
--- a/SaveLoad.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/SaveLoad.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,4 +1,5 @@
 #pragma once
+#include<array>
 
 #pragma pack(push, 1)
 struct SaveFile_
@@ -41,7 +42,6 @@
 
 
 extern unsigned int uNumSavegameFiles;
-extern unsigned int pSavegameUsedSlots[45];
+extern std::array<unsigned int, 45> pSavegameUsedSlots;
 extern struct SavegameList  *pSavegameList;
-extern struct RGBTexture     pSavegameThumbnails[];
-extern struct SavegameHeader pSavegameHeader[];
\ No newline at end of file
+extern std::array<SavegameHeader, 45>  pSavegameHeader;
\ No newline at end of file
--- a/Spells.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Spells.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -15,21 +15,21 @@
 
 
 
-TownPortalData TownPortalList[6] = //4ECBB8
-{
+std::array<TownPortalData, 6> TownPortalList = //4ECBB8
+{{
  {Vec3_int_(-5121, 2107, 1), 1536, 0, 21, 0},
  {Vec3_int_(-15148, -10240, 1473), 0, 0, 4, 0},
  {Vec3_int_(-10519, 5375, 753), 512, 0, 3, 0},
  {Vec3_int_(3114, -11055, 513), 0, 0, 10, 0},
  {Vec3_int_(-158, 7624, 1), 512, 0, 7, 0},
  {Vec3_int_(-1837, -4247, 65), 65, 0, 8, 0}
-} ;
+}} ;
 
 struct SpellStats *pSpellStats;
 
 
-stru324_spell stru_4E3ACC[103] =
-{
+std::array<stru324_spell, 103> stru_4E3ACC =
+{{
   {10, 0},
   {1000, 0}, {1010, 0}, {1020, 0}, {1030, 0}, {1040, 0}, {1050, 0}, {1060, 0}, {1070, 0}, {1080, 0}, {1090, 0}, {1100, 0},
   {2000, 0}, {2010, 0}, {2020, 0}, {2030, 0}, {2040, 0}, {2050, 0}, {2060, 0}, {2070, 0}, {2080, 0}, {2090, 0}, {2100, 0},
@@ -43,9 +43,9 @@
   {545, 0},
   {545, 0},
   {555, 0}
-};
+}};
  //9 spellbook pages  11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1!
-SpellData pSpellDatas[100]={
+std::array<SpellData, 100> pSpellDatas={{
 					 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
 					 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},//0
@@ -155,10 +155,10 @@
 	                 {50, 50, 50, 50, 120, 120, 120, 100, 6400, 0},
 	                 {55, 55, 55, 55, 250, 250, 250, 250, 306, 0},
 	                 {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0}
-	};
+  }};
 
 
-unsigned int wand_spell_ids[25] =
+std::array<unsigned int, 25> wand_spell_ids =
 {
 // 135 Wand of Fire               136 Wand of Sparks             137 Wand of Poison             138 Wand of Stunning           139 Wand of Harm
   SPELL_FIRE_FIRE_BOLT,           SPELL_AIR_SPARKS,              SPELL_WATER_POISON_SPRAY,      SPELL_EARTH_STUN,              SPELL_BODY_HARM,
@@ -173,8 +173,8 @@
 };
 
 
-	unsigned char pSpellbookSpellIndices[9][12] = // 4E2430
-	{  //0   1   2   3  4    5   6  7    8  9   10  11
+std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices = // 4E2430
+	{{  //0   1   2   3  4    5   6  7    8  9   10  11
 		{0,  3,  1,  8, 11,  7,  4, 10,  6,  2,  5,  9},
 		{0, 11,  2,  9,  6,  8,  5, 10,  3,  7,  1,  4},
 		{0,  4,  8,  9,  1, 10,  3, 11,  7,  6,  2,  5}, 
@@ -184,45 +184,45 @@
 		{0,  1,  6,  9,  3,  5,  8, 11,  7, 10,  4,  2},
 		{0,  1, 10, 11,  9,  4,  3,  6,  5,  7,  8,  2},
 		{0,  9,  3,  7,  1,  5,  2, 10, 11,  8,  6,  4}
-	};
+}};
 
-	struct SpellBookIconPos pIconPos[9][12]={
+	std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos={{
 
-		{{  0,   0}, { 17,  13}, {115,   2}, {217,  15},
-		 {299,   6}, { 28, 125}, {130, 133}, {294, 114},
-		 { 11, 232}, {134, 233}, {237, 171}, {296, 231}},
+		 {  0,   0,  17,  13, 115,   2, 217,  15,
+		 299,   6,  28, 125, 130, 133, 294, 114,
+      11, 232, 134, 233, 237, 171, 296, 231},
 
-		{{  0,   0},  {19,   9}, {117,   3}, {206,  13},	
-		 {285,   7},  {16, 123}, {113, 101}, {201, 118},
-		 {317, 110},  {11, 230}, {149, 236}, {296, 234}},
+		 {  0,   0, 19,   9, 117,   3, 206,  13,	
+		 285,   7,  16, 123, 113, 101, 201, 118,
+		 317, 110,  11, 230, 149, 236, 296, 234},
 
-		{{  0,   0},  {17,   9}, {140,   0}, {210,  34},
-		 {293,   5},  {15,  98}, { 78, 121}, {175, 136},
-		 {301, 115},  {15, 226}, {154, 225}, {272, 220}},
+		 {  0,   0,  17,   9, 140,   0, 210,  34,
+		 293,   5,   15,  98,  78, 121, 175, 136,
+     301, 115,   15, 226, 154, 225, 272, 220},
 
-		{{ 0,    0}, {  7,   9}, {156,   2}, {277,   9},
-		 { 11, 117}, {111,  82}, {180, 102}, {303, 108},
-		 { 10, 229}, {120, 221}, {201, 217}, {296, 225}},
+		 { 0,    0,   7,   9, 156,   2, 277,   9,
+		  11, 117, 111,  82, 180, 102, 303, 108,
+		  10, 229, 120, 221, 201, 217, 296, 225},
 
-		{{  0,   0},  {18,   8}, { 89,  15}, {192,  14},
-		 {292,   7},  {22, 129}, {125, 146}, {217, 136},
-		 {305, 115},  {22, 226}, {174, 237}, {290, 231}},
+		 {  0,   0,  18,   8,  89,  15, 192,  14,
+		 292,   7,  22, 129, 125, 146, 217, 136,
+		 305, 115,  22, 226, 174, 237, 290, 231},
 
-		{{ 0,    0}, { 18,  12}, {148,   9}, {292,   7},
-		 { 17, 122}, {121,  99}, {220,  87}, {293, 112},
-		 { 13, 236}, {128, 213}, {220, 223}, {315, 223}},
+     { 0,    0,  18,  12, 148,   9, 292,   7,
+     17, 122, 121,  99, 220,  87, 293, 112,
+     13, 236, 128, 213, 220, 223, 315, 223},
 
-		{{  0,   0},  {23,  14}, {127,   8}, {204, 0},
-		 {306,   8},  {14, 115}, {122, 132}, {200, 116},
-		 {293, 122},  {20, 228}, {154, 228}, {294, 239}},
+     {  0,   0,  23,  14, 127,   8, 204, 0,
+     306,   8,  14, 115, 122, 132, 200, 116,
+     293, 122,  20, 228, 154, 228, 294, 239},
 
-		{{  0,   0}, { 19,  14}, {124,  10}, {283,  12},
-		 {  8, 105}, {113,  89}, {190,  82}, {298, 108},
-		 { 18, 181}, {101, 204}, {204, 203}, {285, 218}},
+     {  0,   0,  19,  14, 124,  10, 283,  12,
+     8, 105, 113,  89, 190,  82, 298, 108,
+     18, 181, 101, 204, 204, 203, 285, 218},
 
-		{{  0,   0}, {18,  17}, {110,  16}, {201,  15},
-		 {307,  15}, {18, 148}, {125, 166}, {201, 123},
-		 {275, 120}, {28, 235}, {217, 222}, {324, 216}}};
+		 {  0,   0, 18,  17, 110,  16, 201,  15,
+		 307,  15, 18, 148, 125, 166, 201, 123,
+     275, 120, 28, 235, 217, 222, 324, 216}}};
 
 
 //----- (0042EB31) --------------------------------------------------------
--- a/Spells.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Spells.h	Mon Jun 10 09:30:21 2013 +0600
@@ -267,13 +267,13 @@
   __int16 field_12;
 };
 #pragma pack(pop)
-extern TownPortalData TownPortalList[6]; //4ECBB8
+extern std::array<TownPortalData, 6> TownPortalList; //4ECBB8
 
 
 extern struct SpellStats *pSpellStats;
 
-extern struct SpellBookIconPos pIconPos[9][12];
+extern std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos;
 
-extern stru324_spell stru_4E3ACC[];
-extern SpellData pSpellDatas[100];
-extern unsigned int wand_spell_ids[];
\ No newline at end of file
+extern std::array<stru324_spell, 103> stru_4E3ACC;
+extern std::array<SpellData, 100> pSpellDatas;
+extern std::array<unsigned int, 25> wand_spell_ids;
\ No newline at end of file
--- a/SpriteObject.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/SpriteObject.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -27,7 +27,7 @@
 
 
 size_t uNumSpriteObjects;
-SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS];
+std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects;
 
 //----- (00404828) --------------------------------------------------------
 SpriteObject::SpriteObject()
@@ -430,7 +430,7 @@
             v56 = 0;
             if ( (signed int)uNumActors > 0 )
             {
-              v60 = pActors;
+              v60 = pActors.data();
               v20 = &pActors[v19];
               do
               {
@@ -716,7 +716,7 @@
         {
           if ( (signed int)uNumActors > v8 )
           {
-            v39b = pActors;//[0].word_000086_some_monster_id;
+            v39b = pActors.data();//[0].word_000086_some_monster_id;
             do
             {
               //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1;
@@ -737,7 +737,7 @@
         {
           if ( (signed int)uNumActors > v8 )
           {
-            v39b = pActors;//[0].word_000086_some_monster_id;
+            v39b = pActors.data();//[0].word_000086_some_monster_id;
             do
             {
 				_46DF1A_collide_against_actor(v42++, pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius);
@@ -1017,7 +1017,7 @@
   int v18; // [sp+14h] [bp-4h]@14
 
   v1 = this;
-  pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
+  pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())];
   v3 = abs(pParty->vPosition.x - v1->vPosition.x);
   v15 = abs(pParty->vPosition.y - v1->vPosition.y);
   v16 = abs(pParty->vPosition.z + pParty->sEyelevel - v1->vPosition.z);
--- a/SpriteObject.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/SpriteObject.h	Mon Jun 10 09:30:21 2013 +0600
@@ -52,4 +52,4 @@
 
 
 extern size_t uNumSpriteObjects;
-extern SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS];
\ No newline at end of file
+extern std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects;
\ No newline at end of file
--- a/Texture.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Texture.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -28,7 +28,7 @@
 
 
 
-Texture *pTexture_LloydBeacons[2];
+std::array<Texture *, 2> pTexture_LloydBeacons;
 Texture *pTexture_50635C;
 Texture *pTexture_506368;
 Texture *pTexture_50636C;
@@ -46,17 +46,17 @@
 Texture *pTex_tab_an_6a__zoom_off;
 Texture *pTex_tab_an_7b__zoot_on;
 Texture *pTex_tab_an_6b__zoom_on;
-Texture *pTexture_TownPortalIcons[6]; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
-Texture *dword_5063D8[12];
-Texture *dword_506408[12];
+std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
+std::array<Texture *, 12> dword_5063D8;
+std::array<Texture *, 12> dword_506408;
 Texture *pTexture_50643C; // idb
 Texture *ptr_506440;
 Texture *pTexture_506444;
 Texture *pTexture_506448; // idb
-Texture *pTextures_tabs[9][2];
+std::array<std::array<Texture *, 2>, 9> pTextures_tabs;
 Texture *pTexture_mapbordr; // idb
 Texture *pTexture_pagemask; // idb
-Texture *pSpellBookPagesTextr[9];
+std::array<Texture *, 9> pSpellBookPagesTextr;
 Texture *pSpellBookPagesTextr_9;
 Texture *pSpellBookPagesTextr_10;
 Texture *pSpellBookPagesTextr_11;
@@ -110,12 +110,12 @@
 unsigned int uTextureID_BUTTMAKE;
 unsigned int uTextureID_BUTTYES2;
 unsigned int uTextureID_x_ok_u;
-Texture *pPlayerPortraits[22];
-Texture *pTexture_IC_KNIGHT[9];
+std::array<Texture *, 22> pPlayerPortraits;
+std::array<Texture *, 9> pTexture_IC_KNIGHT;
 Texture *pTexture_MAKESKY;
 Texture *pTexture_MAKETOP;
-Texture *pTextures_arrowr[20];
-Texture *pTextures_arrowl[20];
+std::array<Texture *, 20> pTextures_arrowr;
+std::array<Texture *, 20> pTextures_arrowl;
 Texture *pTexture_presleft;
 Texture *pTexture_pressrigh;
 Texture *pTexture_buttminu;
@@ -146,7 +146,7 @@
 unsigned int uTextureID_FONTPAL;
 unsigned int uTextureID_Btn_NPCRight;
 unsigned int uTextureID_Btn_NPCLeft;
-unsigned int pTextureIDs_pMapDirs[8];
+std::array<unsigned int, 8> pTextureIDs_pMapDirs;
 
 
 unsigned int uTextureID_BarRed;
@@ -173,7 +173,7 @@
 Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-unsigned int uTextureID_Optkb[5];
+std::array<unsigned int, 5> uTextureID_Optkb;
 
 unsigned int uTextureID_507C10; // weak
 unsigned int uTextureID_507C14; // weak
@@ -181,7 +181,7 @@
 unsigned int uTextureID_507C1C; // weak
 unsigned int uTextureID_507C20; // weak
 unsigned int uTextureID_507C24; // weak
-unsigned int pTextureIDs_GammaPositions[10];
+std::array<unsigned int, 10> pTextureIDs_GammaPositions;
 unsigned int uTextureID_507C50; // weak
 unsigned int uTextureID_507C54; // weak
 unsigned int uTextureID_507C58; // weak
@@ -442,8 +442,8 @@
   File = v3;
   if ( !v3 )
   {
-    sprintf(pTmpBuf, "Unable to load %s", pContainer);
-    Abortf(pTmpBuf);
+    sprintf(pTmpBuf.data(), "Unable to load %s", pContainer);
+    Abortf(pTmpBuf.data());
   }
   fread(&DstBuf, 1u, 0x30u, v3);
   Count = DstBuf.uTextureSize;
@@ -532,8 +532,8 @@
   File = v4;
   if ( !v4 )
   {
-    sprintf(pTmpBuf, "Unable to load %s", pContainer);
-    Abortf(pTmpBuf);
+    sprintf(pTmpBuf.data(), "Unable to load %s", pContainer);
+    Abortf(pTmpBuf.data());
   }
   fread(&DstBuf, 1u, 0x30u, v4);
   Count = DstBuf.uTextureSize;
--- a/Texture.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/Texture.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,6 @@
 #pragma once
 #include <stdio.h>
+#include<array>
 
 
 
@@ -126,7 +127,8 @@
 
 
 
-extern Texture *pTexture_LloydBeacons[2];
+extern std::array<struct RGBTexture, 45> pSavegameThumbnails;
+extern std::array<Texture *, 2> pTexture_LloydBeacons;
 extern Texture *pTexture_50635C;
 extern Texture *pTexture_506368;
 extern Texture *pTexture_50636C;
@@ -144,18 +146,18 @@
 extern Texture *pTex_tab_an_6a__zoom_off;
 extern Texture *pTex_tab_an_7b__zoot_on;
 extern Texture *pTex_tab_an_6b__zoom_on;
-extern Texture *pTexture_TownPortalIcons[]; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
+extern std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit
 
-extern Texture *dword_5063D8[];
-extern Texture *dword_506408[];
+extern std::array<Texture *, 12> dword_5063D8;
+extern std::array<Texture *, 12> dword_506408;
 extern Texture *pTexture_50643C; // idb
 extern Texture *ptr_506440;
 extern Texture *pTexture_506444;
 extern Texture *pTexture_506448; // idb
-extern Texture *pTextures_tabs[9][2];
+extern std::array<std::array<Texture *, 2>, 9> pTextures_tabs;
 extern Texture *pTexture_mapbordr; // idb
 extern Texture *pTexture_pagemask; // idb
-extern Texture *pSpellBookPagesTextr[9];
+extern std::array<Texture *, 9> pSpellBookPagesTextr;
 extern Texture *pSpellBookPagesTextr_9;
 extern Texture *pSpellBookPagesTextr_10;
 extern Texture *pSpellBookPagesTextr_11;
@@ -209,12 +211,12 @@
 extern unsigned int uTextureID_BUTTMAKE;
 extern unsigned int uTextureID_BUTTYES2;
 extern unsigned int uTextureID_x_ok_u;
-extern Texture *pPlayerPortraits[22];
-extern Texture *pTexture_IC_KNIGHT[];
+extern std::array<Texture *, 22> pPlayerPortraits;
+extern std::array<Texture *, 9> pTexture_IC_KNIGHT;
 extern Texture *pTexture_MAKESKY;
 extern Texture *pTexture_MAKETOP;
-extern Texture *pTextures_arrowr[20];
-extern Texture *pTextures_arrowl[20];
+extern std::array<Texture *, 20> pTextures_arrowr;
+extern std::array<Texture *, 20> pTextures_arrowl;
 extern Texture *pTexture_presleft;
 extern Texture *pTexture_pressrigh;
 extern Texture *pTexture_buttminu;
@@ -245,7 +247,7 @@
 extern unsigned int uTextureID_FONTPAL;
 extern unsigned int uTextureID_Btn_NPCRight;
 extern unsigned int uTextureID_Btn_NPCLeft;
-extern unsigned int pTextureIDs_pMapDirs[8];
+extern std::array<unsigned int, 8> pTextureIDs_pMapDirs;
 
 
 extern unsigned int uTextureID_BarRed;
@@ -272,7 +274,7 @@
 extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-extern unsigned int uTextureID_Optkb[5];
+extern std::array<unsigned int, 5> uTextureID_Optkb;
 
 extern unsigned int uTextureID_507C10; // weak
 extern unsigned int uTextureID_507C14; // weak
@@ -280,7 +282,7 @@
 extern unsigned int uTextureID_507C1C; // weak
 extern unsigned int uTextureID_507C20; // weak
 extern unsigned int uTextureID_507C24; // weak
-extern unsigned int pTextureIDs_GammaPositions[10];
+extern std::array<unsigned int, 10> pTextureIDs_GammaPositions;
 extern unsigned int uTextureID_507C50; // weak
 extern unsigned int uTextureID_507C54; // weak
 extern unsigned int uTextureID_507C58; // weak
--- a/Time.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Time.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -21,7 +21,7 @@
 //----- (00426317) --------------------------------------------------------
 unsigned __int64 Timer::Time()
 {
-  uint v2 = TimeQuant * timeGetTime() / 1000;
+  unsigned __int64 v2 = TimeQuant * timeGetTime() / 1000;
   if (v2 < uStartTime)
     uStartTime = 0;
   return v2;
--- a/UIBooks.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIBooks.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -264,39 +264,39 @@
 		v2=1;
   }
 
-  sprintf(pTmpBuf, "%s\t100:\t110%d:%02d %s - %s",
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%d:%02d %s - %s",
           pGlobalTXT_LocalizationStrings[526], // "Time"
           v0,
           pParty->uCurrentMinute,
           aAMPMNames[v2],
           GetDayPart());
-  a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf, 0, 0, 0);
+  a1.DrawText(pBookFont, 70, 55, ui_book_calendar_time_color, pTmpBuf.data(), 0, 0, 0);
 
-  sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
           pGlobalTXT_LocalizationStrings[56], // "Day"
           pParty->uDaysPlayed + 1,
           aDayNames[pParty->uDaysPlayed % 7]);
-  a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf, 0, 0, 0);
+  a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, ui_book_calendar_day_color, pTmpBuf.data(), 0, 0, 0);
 
-  sprintf(pTmpBuf, "%s\t100:\t110%d - %s",
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%d - %s",
           pGlobalTXT_LocalizationStrings[146], // "Month"
           pParty->uCurrentMonth + 1,
           aMonthNames[pParty->uCurrentMonth]);
-  a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf, 0, 0, 0);
+  a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, ui_book_calendar_month_color, pTmpBuf.data(), 0, 0, 0);
 
-  sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
-  a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); // "Year"
+  a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, ui_book_calendar_year_color, pTmpBuf.data(), 0, 0, 0);
 
-  sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
-  a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[pDayMoonPhase[pParty->uDaysPlayed]]); // "Moon"
+  a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, ui_book_calendar_moon_color, pTmpBuf.data(), 0, 0, 0);
   
-  v6 = pMapStats->GetMapInfo(pCurrentMapName);
+  v6 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( v6 )
     v3 = pMapStats->pInfos[v6].pName;
   else
     v3 = "Unknown";
-  sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
-  a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); // "Location"
+  a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, ui_book_calendar_location_color, pTmpBuf.data(), 0, 0, 0);
 }
 
 
@@ -332,10 +332,10 @@
   {
     pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
 
-    sprintf(pTmpBuf, "tab%da", i+1);
-    pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
-    sprintf(pTmpBuf, "tab%db", i+1);
-    pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "tab%da", i+1);
+    pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "tab%db", i+1);
+    pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
   }
 }
 
@@ -1103,7 +1103,7 @@
   map_window.uFrameY = game_viewport_y;
   map_window.uFrameZ = game_viewport_z;
   map_window.uFrameW = game_viewport_w;
-  map_id = pMapStats->GetMapInfo(pCurrentMapName);
+  map_id = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( map_id )
     map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3);
 
--- a/UICharacter.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UICharacter.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -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;
@@ -77,7 +77,7 @@
 unsigned int ui_book_journal_text_color;
 unsigned int ui_book_journal_text_shadow;
 
-unsigned int papredoll_dbrds[16];
+std::array<unsigned int, 16> papredoll_dbrds;
 unsigned int papredoll_drhs[4];
 unsigned int papredoll_dlhus[4];
 unsigned int papredoll_dlhs[4];
@@ -449,8 +449,8 @@
 {
   int y_offset = y;
   
-  sprintf(pTmpBuf, "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level"
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level"
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf.data(), 0, 0, 0);
 
   int num_skills_drawn = 0;
   for (uint i = 0; i < skill_list_size; ++i)
@@ -491,8 +491,8 @@
 
       if (SkillToMastery(skill_value) == 1)
       {
-        sprintfex(pTmpBuf, "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0);
+        sprintfex(pTmpBuf.data(), "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0);
       }
       else
       {
@@ -508,8 +508,8 @@
         if (!skill_mastery_color)
           skill_mastery_color = ui_character_header_text_color;
 
-        sprintfex(pTmpBuf, "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level);
-        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0);
+        sprintfex(pTmpBuf.data(), "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level);
+        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0);
       }
     }
   }
@@ -530,14 +530,14 @@
 {
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE));
 
-  sprintfex(pTmpBuf, "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000",
+  sprintfex(pTmpBuf.data(), "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000",
             pGlobalTXT_LocalizationStrings[206],        // Skills for
             ui_character_header_text_color,
             player->pName,
             pGlobalTXT_LocalizationStrings[207],        // Skill Points
             player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color,
             player->uSkillPoints);
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
 
   int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
   y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons"
@@ -588,12 +588,12 @@
     //int v22; // [sp+CCh] [bp-4h]@40
 
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
-  sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color);
+  sprintfex(pTmpBuf.data(), "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color);
   sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
-  strcat(pTmpBuf, Source);
-  strcat(pTmpBuf, "\f00000");
+  strcat(pTmpBuf.data(), Source);
+  strcat(pTmpBuf.data(), "\f00000");
 
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
   result = dword_506528;
   a1.uFrameX = 12;
   a1.uFrameY = 48;
@@ -644,20 +644,20 @@
             pTmpBuf[0] = 0;
             switch (v5)
             {
-              case Award_Arena_PageWins:    sprintf(pTmpBuf, v6, pParty->uNumArenaPageWins);     break;
-              case Award_Arena_SquireWins:  sprintf(pTmpBuf, v6, pParty->uNumArenaSquireWins);   break;
-              case Award_Arena_KnightWins:  sprintf(pTmpBuf, v6, pParty->uNumArenaKnightWins);   break;
-              case Award_Arena_LordWins:    sprintf(pTmpBuf, v6, pParty->uNumArenaLordWins);     break;
-              case Award_ArcomageWins:      sprintf(pTmpBuf, v6, pParty->uNumArcomageWins);      break;
-              case Award_ArcomageLoses:     sprintf(pTmpBuf, v6, pParty->uNumArcomageLoses);     break;
-              case Award_Deaths:            sprintf(pTmpBuf, v6, pParty->uNumDeaths);            break;
-              case Award_BountiesCollected: sprintf(pTmpBuf, v6, pParty->uNumBountiesCollected); break;
-              case Award_Fine:              sprintf(pTmpBuf, v6, pParty->uFine);                 break;
-              case Award_PrisonTerms:       sprintf(pTmpBuf, v6, pParty->uNumPrisonTerms);       break;
+              case Award_Arena_PageWins:    sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins);     break;
+              case Award_Arena_SquireWins:  sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins);   break;
+              case Award_Arena_KnightWins:  sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins);   break;
+              case Award_Arena_LordWins:    sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins);     break;
+              case Award_ArcomageWins:      sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins);      break;
+              case Award_ArcomageLoses:     sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses);     break;
+              case Award_Deaths:            sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths);            break;
+              case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break;
+              case Award_Fine:              sprintf(pTmpBuf.data(), v6, pParty->uFine);                 break;
+              case Award_PrisonTerms:       sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms);       break;
             }
 
-            if (*pTmpBuf)
-              v6 = pTmpBuf;
+            if (*pTmpBuf.data())
+              v6 = pTmpBuf.data();
 
 
             a1.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[v5].uPriority % 6], v6, 0, 0, 0);
@@ -1728,7 +1728,6 @@
 
     uCellY = 32 * (i / 14) + 17;
     uCellX = 32 * (i % 14) + 14;
-
     uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
     v7 = pIcons_LOD->GetTexture(item_texture_id);
 
@@ -1744,7 +1743,7 @@
                     v14 = v7->uTextureHeight;
                     if (v14 < 14 )
                         v14 = 14;
-                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];
+                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];   //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up
 
     if (item->uAttributes & 0xF0)
     {
@@ -1979,7 +1978,7 @@
       }
     }
   }
-  memset(byte_5111F6, 0, 16);
+  memset(byte_5111F6.data(), 0, 16);
   for (uint i = 0; i < 4; ++i)
   {
     auto player = pParty->pPlayers + i;
@@ -2293,64 +2292,64 @@
         //pPlayer = &pParty->pPlayers[uPlayerID-1];
         //pPlayer = player;
   pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
-  sprintf(pTmpBuf, "\f%05d", ui_character_header_text_color);
-  sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s"
-  strcat(pTmpBuf, pTmpBuf2);
-  sprintfex(pTmpBuf2,  "\f00000\r180%s: \f%05d%d\f00000\n\n\n",
+  sprintf(pTmpBuf.data(), "\f%05d", ui_character_header_text_color);
+  sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s"
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
+  sprintfex(pTmpBuf2.data(),  "\f00000\r180%s: \f%05d%d\f00000\n\n\n",
             pGlobalTXT_LocalizationStrings[207], // "Skill points"
             player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color,
             player->uSkillPoints);
-  strcat(pTmpBuf, pTmpBuf2);
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf.data(), 0, 0, 0);
 
   v10 = 53;
   v7 = player->GetBaseStrength();
   v8 = player->GetActualMight();
   v9 = UI_GetHealthManaStringColor(v8, v7);
-  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
   v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
   v13 = player->GetBaseIntelligence();
   v14 = player->GetActualIntelligence();
   v15 = UI_GetHealthManaStringColor(v14, v13);
-  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
   v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
   v19 = player->GetBaseWillpower();
   v20 = player->GetActualWillpower();
   v21 = UI_GetHealthManaStringColor(v20, v19);
-  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
   v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
   v25 = player->GetBaseEndurance();
   v26 = player->GetActualEndurance();
   v27 = UI_GetHealthManaStringColor(v26, v25);
-  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
   v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
   v31 = player->GetBaseAccuracy();
   v32 = player->GetActualAccuracy();
   v33 = UI_GetHealthManaStringColor(v32, v31);
-  sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
-  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v37 = player->GetBaseSpeed();
         v38 = player->GetActualSpeed();
         v39 = UI_GetHealthManaStringColor(v38, v37);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v43 = player->GetBaseLuck();
         v44 = player->GetActualLuck();
         v45 = UI_GetHealthManaStringColor(v44, v43);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5;
@@ -2358,8 +2357,8 @@
             a2 = "%s\f%05u\r388%d\f00000 / %d\n";
         v49 = player->GetMaxHealth();
         v50 = UI_GetHealthManaStringColor(player->sHealth, v49);
-        sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2367,36 +2366,36 @@
             a2a = "%s\f%05u\r388%d\f00000 / %d\n";
         v53 = player->GetMaxMana();
         v54 = UI_GetHealthManaStringColor(player->sMana, v53);
-        sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v58 = player->GetBaseAC();
         v59 = player->GetActualAC();
         v60 = UI_GetHealthManaStringColor(v59, v58);
-        sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2;
         v62 = player->GetMajorConditionIdx();
         v64 = GetConditionDrawColor(v62);
-        sprintf(pTmpBuf, "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]);
-        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
+        sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]);
+        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) + - 1;
         if (player->uQuickSpell)
             v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName;
         else
             v67 = pGlobalTXT_LocalizationStrings[153];
-        sprintf(pTmpBuf, "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
-        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0);
+        sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
+        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0);
 
         v10 = 50;
         v70 = player->GetBaseAge();
         v71 = player->GetActualAge();
         v72 = UI_GetHealthManaStringColor(v71, v70);
-        sprintf(pTmpBuf, "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2b = "%s\f%05u\t100%d\f00000 / %d\n";
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2405,8 +2404,8 @@
         v75 = player->GetBaseLevel();
         v76 = player->GetActualLevel();
         v77 = UI_GetHealthManaStringColor(v76, v75);
-        sprintf(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         if (player->uExperience <= 9999999)
@@ -2414,28 +2413,28 @@
         else
             v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp."
         v81 = player->GetExperienceDisplayColor();
-        sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience));
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience));
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight);
         v83 = player->GetActualAttack(0);
-        sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v85 = player->GetMeleeDamageString();
-        sprintf(pTmpBuf, "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v87 = player->GetRangedAttack();
-        sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
         v89 = player->GetRangedDamageString();
-        sprintf(pTmpBuf, "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2c = format_4E2E10;
         v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4;
@@ -2444,8 +2443,8 @@
         if ( v131 > 99 || v90 > 99 )
             a2c = "%s\f%05u\t180%d\f00000 / %d\n";
         v92 = UI_GetHealthManaStringColor(v131, v90);
-        sprintf(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2d = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2454,8 +2453,8 @@
         if ( v132 > 99 || v93 > 99 )
             a2d = "%s\f%05u\t180%d\f00000 / %d\n";
         v95 = UI_GetHealthManaStringColor(v132, v93);
-        sprintf(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2e = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2464,8 +2463,8 @@
         if ( v133 > 99 || v96 > 99 )
             a2e = "%s\f%05u\t180%d\f00000 / %d\n";
         v98 = UI_GetHealthManaStringColor(v133, v96);
-        sprintf(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2f = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2474,8 +2473,8 @@
         if ( v134 > 99 )
             a2f = "%s\f%05u\t180%d\f00000 / %d\n";
         v101 = UI_GetHealthManaStringColor(v134, v99);
-        sprintf(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99);
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        sprintf(pTmpBuf.data(), a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2g = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2484,13 +2483,13 @@
         if ( v135 > 99 || v102 > 99 )
             a2g = "%s\f%05u\t180%d\f00000 / %d\n";
         v104 = UI_GetHealthManaStringColor(v135, v102);
-        sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
+        sprintf(pTmpBuf.data(), a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
         if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 )
         {
             v106 = UI_GetHealthManaStringColor(v135, 200);
-            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
+            sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
         }
-        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0);
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 
         a2h = format_4E2E10;
         v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
@@ -2499,35 +2498,13 @@
         if ( v136 > 99 || v107 > 99 )
             a2h = "%s\f%05u\t180%d\f00000 / %d\n";
         v109 = UI_GetHealthManaStringColor(v136, v107);
-        sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
+        sprintf(pTmpBuf.data(), a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
         if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 )
         {
             v111 = UI_GetHealthManaStringColor(v136, 200);
-            sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
+            sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
         }
-        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;
+        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
 bool awardSort (int i,int j) { 
@@ -2566,10 +2543,10 @@
 {
         auto pPlayer = pPlayers[uActiveCharacter];
 
-        memset(achieved_awards, 0, 4000);
+        memset(achieved_awards.data(), 0, 4000);
         num_achieved_awards = 0;
 
-        memset(pTmpBuf2, 0, 0x7D0u);
+        memset(pTmpBuf2.data(), 0, 0x7D0u);
         BtnDown_flag = 0;
         BtnUp_flag = 0;
         dword_50651C = 0;
@@ -2587,7 +2564,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);
         }
     }
 
--- a/UIHouses.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIHouses.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -118,8 +118,8 @@
 
 
 
-const stru159 pAnimatedRooms[196] = //0x4E5F70
-{
+std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70
+{{
         {"",                            0x4, 0x1F4, 0, 0, 0},
         {"Human Armor01",               0x20, 0x2C0, 2, 58, 0},
         {"Necromancer Armor01",         0x20, 0x2D7, 2, 70, 0 },
@@ -316,7 +316,7 @@
         {"Human Temple02",              0x24, 0x3AB, 23, 27, 0 },
         {"Player Castle Good",          0x24, 0, 25, 0, 0 },
         {"Player Castle Bad",           0x24, 0, 25, 0, 0}
-};
+}};
 
 
 
@@ -336,110 +336,71 @@
   //int v11; // ecx@19
   //char pContainer[36]; // [sp+Ch] [bp-54h]@16
   int v13; // [sp+30h] [bp-30h]@11
-  int Dst[6]; // [sp+34h] [bp-2Ch]@1
+  int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1
   //unsigned int v15; // [sp+4Ch] [bp-14h]@1
   int uAnimationID; // [sp+50h] [bp-10h]@1
   //unsigned int *v17; // [sp+54h] [bp-Ch]@3
   //unsigned int v18; // [sp+58h] [bp-8h]@1
   //int v19; // [sp+5Ch] [bp-4h]@7
 
-  //v15 = uHouseID;
-  //v1 = 52 * uHouseID;
-  //uAnimationID = p2DEvents_minus1___02[26 * uHouseID];
+
   uAnimationID = p2DEvents[house - 1].uAnimationID;
-  //v18 = 52 * uHouseID;
-  memset(Dst, 0, 0x18u);
-  //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1);
-  //uExitPic = p2DEvents[uHouseID - 1].uExitPicID;
+  memset(npc_id_arr, 0, sizeof(npc_id_arr));
   uNumDialogueNPCPortraits = 0;
   uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
   if ( uHouse_ExitPic )
   {
-    //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1);
     uExitMapID = p2DEvents[house - 1]._quest_related;
     if ( uExitMapID > 0 )
     {
-      //v17 = (unsigned int *)(uExitMapID - 1);
 	  if(_449B57_test_bit(pParty->_quest_bits,uExitMapID))
-     // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) )
       {
-        //uExitPic = 0;
         uHouse_ExitPic = 0;
       }
     }
   }
 
-  dword_591080 = pAnimatedRooms[uAnimationID].field_8;
-  //result = dword_591080;
-
-  //v2 = 0;
+  dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id;
+  HouseNPCData[0]=0;
   uNumDialogueNPCPortraits = 0;
   if ( dword_591080 )
   {
-    //v2 = 1;
-    Dst[0] = dword_591080;
+
+    npc_id_arr[0] = dword_591080;
     uNumDialogueNPCPortraits = 1;
   }
 
-  //v19 = 1;
-  for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
+  for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i)
   {
-    auto npc = pNPCStats->pNewNPCData + i;
-    //v6 = &pNPCStats->pNewNPCData[1].uFlags;
-    //v17 = &pNPCStats->pNewNPCData[1].uFlags;
-    //do
-    //{
-    if (npc->Location2D == house )
+    if (pNPCStats->pNewNPCData[i].Location2D == house )
     {
-      if (~npc->uFlags & 0x80)
-        //if ( !(*(char *)v6 & 0x80) )
+      if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80))
       {
-        v7 = uNumDialogueNPCPortraits++ - (dword_591080 != 0) ? 1 : 0;
-        HouseNPCData[v7] = npc;
-        //v6 = v17;
-        //*(&v13 + v2) = *(v17 - 1);
-        Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
-          //v1 = v18;
-        if ((npc->uFlags & 3) != 2)
-          ++npc->uFlags;
+        
+        HouseNPCData[uNumDialogueNPCPortraits+1- (dword_591080 != 0) ? 1 : 0] = &pNPCStats->pNewNPCData[i];     
+        npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID;
+         ++uNumDialogueNPCPortraits;
+        if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2)
+          ++pNPCStats->pNewNPCData[i].uFlags;
       }
     }
-      //++v19;
-      //v6 += 19;
-      //v17 = v6;
-    //}
-    //while ( v19 < (signed int)pNPCStats->uNumNewNPCs );
+
   }
-  //uNumDialogueNPCPortraits = v2;
 
-  //v19 = 0;
   for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
-  //if ( v2 > 0 )
   {
-    //do
-    //{
-      //v8 = v19;
+   
     char icon_name[128];
-    sprintfex(icon_name, "npc%03u", Dst[i]);
-    //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    //++v19;
+    sprintfex(icon_name, "npc%03u", npc_id_arr[i]);
     pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
-    //result = v19;
-    //}
-    //while ( v19 < uNumDialogueNPCPortraits );
-    //uExitPic = uHouse_ExitPic;
   }
 
   if (uHouse_ExitPic)
   {
-    //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
-    //v11 = uNumDialogueNPCPortraits++;
-    pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
-    //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1);
-    //result = p2DEvents[house - 1].uExitMapID;
+    pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
+    ++uNumDialogueNPCPortraits;
     uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
   }
-  //return result;
 }
 
 
@@ -492,8 +453,8 @@
 	current_npc_text = 0;
 	dword_F8B1E4 = 0;
 	dword_F8B1F4 = 0;
-	memset(byte_F8B1F0, 0, 4);
-	memset(player_levels, 0, 16);
+	memset(byte_F8B1F0.data(), 0, 4);
+	memset(player_levels.data(), 0, 16);
 	pRenderer->ClearZBuffer(0, 479);
 
 	if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))||
@@ -512,9 +473,9 @@
 			uCloseTime -= 12;
 			am_pm_flag_close = 1;
 			}
-		sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], 
+		sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], 
 			uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s"
-		ShowStatusBarString(pTmpBuf, 2u);
+		ShowStatusBarString(pTmpBuf.data(), 2u);
 		if ( uActiveCharacter )
 			pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0);
 		return 0;
@@ -1762,8 +1723,8 @@
       //v59 = pDialogueWindow;
       v54 = v17;
       strcpy(v48[4], "");
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
-      v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0);
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold
+      v18 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &v53, 0, 0);
       v19 = v16->pNumPresenceButton;
       v20 = v18 + v17 + 146;
       v21 = v16->pStartingPosActiveItem;
@@ -1824,16 +1785,16 @@
           if ( v23 != v2 )
           {
             memcpy(&v32, &pMapStats->pInfos[transport_schedule[v23].uMapInfoID], 0x44u);
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s
                       v66, v32.pName);
-            strcat(a1, pTmpBuf);
+            strcat(a1, pTmpBuf.data());
             v28 = a1;
             a1 += 100;
             ++v62;
             ++s1;
             strcat(v28, "\n \n");
             v24->uY = v63;
-            v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0);
+            v29 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v53, 0, 0);
             v30 = v24->uY;
             v24->uHeight = v29;
             v2 = 255;
@@ -1867,9 +1828,9 @@
         v46 = &v50;
         v45 = (unsigned int)&v49;
         v44 = &v48;
-        v43 = pTmpBuf2;*/
-        sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48[0], v48[1], v48[2], v48[3], v48[4]);
-        v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+        v43 = pTmpBuf2.data();*/
+        sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), v48[0], v48[1], v48[2], v48[3], v48[4]);
+        v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
       }
       else
       {
@@ -1897,10 +1858,10 @@
       v5 = &transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][dialog_menu_id - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]];
       if ( v5->pSchedule[pParty->uDaysPlayed % 7] )
       {
-        if ( _stricmp(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) )
+        if ( _stricmp(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename) )
         {
           SaveGame(1, 0);
-          strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename);
+          strcpy(pCurrentMapName.data(), pMapStats->pInfos[v5->uMapInfoID].pFilename);
 
           dword_6BE364_game_settings_1 |= 1u;
           _5B65B8_npcdata_hiword_house_or_other = 0;
@@ -2038,8 +1999,8 @@
   _this.uFrameZ = 334;
   v28 = TargetColor(0xFFu, 0xFFu, 0xFFu);
   v30 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
-  _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
+  _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf.data(), 3u);
   switch(dialog_menu_id)
   {
 	case HOUSE_DIALOGUE_MAIN:
@@ -2069,7 +2030,7 @@
 		if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
 		{
 			v31 = 2;
-			v19 = pShopOptions;
+			v19 = pShopOptions.data();
 			do
 			{
 				v20 = v14->GetControl((unsigned int)pOutString);
@@ -2100,14 +2061,14 @@
 		v6 = TargetColor(0xFFu, 0xFFu, 0xFFu);
 		v7 = v5->pName;
 		v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-		sprintf(pTmpBuf, "\f%05d%s\f%05d", v8, v7, v6);
-		sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
-		current_npc_text = pTmpBuf2;
+		sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", v8, v7, v6);
+		sprintf(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * v5->uLevel);
+		current_npc_text = pTmpBuf2.data();
 		memcpy(&a1, pDialogueWindow, sizeof(a1));
 		w.uFrameWidth = 458;
 		w.uFrameZ = 457;
 		pOutString = pFontArrus;
-		v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
+		v9 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &w, 13, 0) + 7;
 		if ( 352 - v9 < 8 )
 		{
 			pOutString = pFontCreate;
@@ -2126,8 +2087,8 @@
 		v0 = window_SpeakInHouse;
 		if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
 		{
-			sprintfex(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay"   "How Much?"
-			_this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
+			sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay"   "How Much?"
+			_this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf.data(), 3u);
 			_this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
 			v3 = pFontArrus;
 			v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
@@ -2200,8 +2161,8 @@
   _this.uFrameZ = 334;
   *(int *)v13 = TargetColor(0xFFu, 0xFFu, 0xFFu);
   *(int *)v14 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
-  _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
+  _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf.data(), 3u);
   switch(dialog_menu_id)
   {
 	case HOUSE_DIALOGUE_MAIN:
@@ -2255,8 +2216,8 @@
 		}
 		v11 = pGlobalTXT_LocalizationStrings[112];
 		v10 = pGlobalTXT_LocalizationStrings[60];
-		sprintf(pTmpBuf, "%s\n%s", v10, v11);
-		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
+		sprintf(pTmpBuf.data(), "%s\n%s", v10, v11);
+		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u);
 		_this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
 		v4 = pFontArrus;
 		v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
@@ -2299,8 +2260,8 @@
 		}
 		v11 = pGlobalTXT_LocalizationStrings[112];
 		v10 = pGlobalTXT_LocalizationStrings[244];
-		sprintfex(pTmpBuf, "%s\n%s", v10, v11);
-		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
+		sprintfex(pTmpBuf.data(), "%s\n%s", v10, v11);
+		_this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf.data(), 3u);
 		_this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
 		v4 = pFontArrus;
 		v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
@@ -2449,15 +2410,15 @@
           return;
 
       sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite);
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
-      strcat(pTopic1, pTmpBuf2);
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold
+      strcat(pTopic1, pTmpBuf2.data());
       pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0);
       strcat(pTopic1, "\n \n");
 
       sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? pColorYellow : pColorWhite);
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold
         (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83);
-      strcat(pTopic2, pTmpBuf2);
+      strcat(pTopic2, pTmpBuf2.data());
       pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0);
       strcat(pTopic2, "\n \n");
 
@@ -2518,8 +2479,8 @@
           pNumActiveItem++;
           if ( pNumActiveItem >= pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
           {
-            sprintfex(pTmpBuf, "%s%s%s%s", &pTopic1, &pTopic2, &pTopic3, &pTopic4);
-            dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf, 3);
+            sprintfex(pTmpBuf.data(), "%s%s%s%s", &pTopic1, &pTopic2, &pTopic3, &pTopic4);
+            dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3);
           }
         }
         while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
@@ -2529,33 +2490,33 @@
     case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES:
     {
       pOutString = pFontArrus;
-      strcpy(pTmpBuf, pNPCTopics[354].pText);
+      strcpy(pTmpBuf.data(), pNPCTopics[354].pText);
       dialog_window.uFrameWidth = game_viewport_width;
       dialog_window.uFrameZ = 452;
-      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
+      pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
       if ( 352 - pTextHeight < 8 )
       {
         pOutString = pFontCreate;
-        pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
+        pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
       }
       auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
       pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight);
       pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
-      v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
+      v63 = FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0);
       window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
       break;
     }
     case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS:
     {
-      strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
+      strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
       dialog_window.uFrameWidth = game_viewport_width;
       dialog_window.uFrameZ = 452;
-      v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
+      v61 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0);
       pTextHeight = v61 + 7;
       auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
       pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7));
       pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
-      v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
+      v63 = FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0);
       window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
       break;
     }
@@ -2574,9 +2535,9 @@
       {
         v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
       }
-      strcpy(pTmpBuf, v72);
-      v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
-      dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3);
+      strcpy(pTmpBuf.data(), v72);
+      v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
+      dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf.data(), 3);
       break;
     }
     case HOUSE_DIALOGUE_TAVERN_REST:
@@ -2632,8 +2593,8 @@
         while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton );
         if ( v0 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
-          dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
+          dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
           v91 = (149 - all_text_height) / v0;
           if ( (149 - all_text_height) / v0 > 32 )
             v91 = 32;
@@ -2672,11 +2633,11 @@
           return;
         }
       }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
-      strcat(pTmpBuf, "\n \n");
-      strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-      pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
-      dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+      strcat(pTmpBuf.data(), "\n \n");
+      strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+      pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
+      dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf.data(), 3);
       return;
     }
 
@@ -3206,11 +3167,11 @@
       pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
       if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-        pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
-        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+        pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
         return;
       }
       do
@@ -3226,15 +3187,15 @@
       while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
       if ( !v0 )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-        pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
-        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf, 3);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+        pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
         return;
       }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
-      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
+      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
       v103 = (149 - all_text_height) / v0;
       if ( (149 - all_text_height) / v0 > 32 )
         v103 = 32;
@@ -3775,11 +3736,11 @@
       v114 = 0;
       if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-        v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
-        dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+        v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
         return;
       }
       do
@@ -3795,17 +3756,17 @@
       while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
       if ( !v114 )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-        v40 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0);
-        dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf, 3);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+        v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
+        dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
         return;
       }
       if ( v114 )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum);
-        dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
+        dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
         v18 = (149 - all_text_height) / v114;
         if ( (149 - all_text_height) / v114 > 32 )
           v18 = 32;
@@ -4360,8 +4321,8 @@
         while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
         if ( v153 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton);
-          dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton);
+          dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
           pActiveButton = (149 - v152) / v153;
           if ( (149 - v152) / v153 > 32 )
             pActiveButton = 32;
@@ -4405,11 +4366,11 @@
           return;
         }
       }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
-      strcat(pTmpBuf, "\n \n");
-      strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
-      v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
-      dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf, 3);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
+      strcat(pTmpBuf.data(), "\n \n");
+      strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+      v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
+      dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3);
       return;
     }
     break;
@@ -4503,8 +4464,8 @@
       {
         if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
-          ShowStatusBarString(pTmpBuf, 2);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
+          ShowStatusBarString(pTmpBuf.data(), 2);
           pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
         }
         else
@@ -4612,11 +4573,11 @@
   pItemNum = 0;
   if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
-    strcat(pTmpBuf, "\n \n");
-    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
-    v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3);
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
+    strcat(pTmpBuf.data(), "\n \n");
+    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+    v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
+    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
     return;
   }
   all_text_height = 0;
@@ -4643,17 +4604,17 @@
   while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
   if ( !v61 )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
-    strcat(pTmpBuf, "\n \n");
-    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
-    v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0);
-    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf, 3);
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"	
+    strcat(pTmpBuf.data(), "\n \n");
+    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
+    v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
+    working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
     return;
   }
   if ( pSkillFlag )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
-    working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3);
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
+    working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
   }
   v58 = (149 - all_text_height) / v61;
   if ( v58 > 32 )
@@ -4834,8 +4795,8 @@
               while ( (signed int)v62 < v4->pNumPresenceButton + v11 );
               if ( v65 )
               {
-                sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64);
-                v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+                sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v64);
+                v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
                 v64 = (149 - (signed int)v66) / (signed int)v65;
                 if ( v64 > 32 )
                   v64 = 32;
@@ -4886,12 +4847,12 @@
               else
               {
 LABEL_78:
-                sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
-                strcat(pTmpBuf, "\n \n");
-                strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
+                sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
+                strcat(pTmpBuf.data(), "\n \n");
+                strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
                 v22 = WORD2(v59);
-                v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0);
-                v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
+                v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v57, 0, 0);
+                v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
               }
             }
           }
@@ -5245,8 +5206,8 @@
             while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem );
             if ( v72 )
             {
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
-              v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+              sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu"
+              v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
               v73 = (signed int)(149 - _v0) / v72;
               if ( v73 > 32 )
                 v73 = 32;
@@ -5293,13 +5254,13 @@
             else
             {
 LABEL_76:
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
+              sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
                                                 // "Seek knowledge elsewhere %s the %s"
-              strcat(pTmpBuf, "\n \n");
-              strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
+              strcat(pTmpBuf.data(), "\n \n");
+              strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
               v29 = color2;
-              v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0);
-              v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u);
+              v30 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0);
+              v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf.data(), 3u);
             }
           }
         }
@@ -5350,9 +5311,9 @@
                 pOutdoor->SetFog();
             }
             pPlayers[uActiveCharacter]->PlaySound(SPEECH_87, 0);
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// 
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[430], pPlayers[uActiveCharacter]->pName, pPlayers[uActiveCharacter]->uLevel, pPlayers[uActiveCharacter]->uLevel / 10 + 5);// 
                                                 // "%s is now Level %lu and has earned %lu Skill Points!"
-            ShowStatusBarString(pTmpBuf, 2);
+            ShowStatusBarString(pTmpBuf.data(), 2);
             pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
             return;
           }
@@ -5374,24 +5335,24 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
           return;
         }
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// 
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// 
                                                 // "You need %d more experience to train to level %d"
         v35 = 0;
         v62 = 3;
-        v60 = pTmpBuf;
+        v60 = pTmpBuf.data();
         v58 = color2;
-        v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88;
+        v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 88;
       }
       else
       {
-        sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// 
+        sprintf(pTmpBuf.data(), "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// 
                                                 // ""With your skills, you should be working here as a teacher.""
                                                 // ""Sorry, but we are unable to train you.""
         v35 = 0;
         v62 = 3;
-        v60 = pTmpBuf;
+        v60 = pTmpBuf.data();
         v58 = color2;
-        v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101;
+        v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &v65, 0, 0)) / 2 + 101;
       }
       v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62);
       v63 = 3;
@@ -5402,13 +5363,13 @@
     {
       v43 = pDialogueWindow;
       v72 = 0;
-      pShopOptions[0] = pTmpBuf;
+      pShopOptions[0] = pTmpBuf.data();
       pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills"
       v44 = pDialogueWindow->pNumPresenceButton;
       v73 = pDialogueWindow->pStartingPosActiveItem;
       if ( v73 < v73 + v44 )
       {
-        v45 = pShopOptions;
+        v45 = pShopOptions.data();
         do
         {
           if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
@@ -5441,7 +5402,7 @@
       if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton)
       {
         int _v3 = 2;
-        v51 = pShopOptions;
+        v51 = pShopOptions.data();
         do
         {
           v52 = v43->GetControl(v73);
@@ -6019,12 +5980,12 @@
       v122 = 0;
       if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
                                             // "Seek knowledge elsewhere %s the %s"
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
-        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf, 3);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
+        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
+        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
         return;
       }
       do
@@ -6040,16 +6001,16 @@
       while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
       if ( !v122 )
       {
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// 
                                             // "Seek knowledge elsewhere %s the %s"
-        strcat(pTmpBuf, "\n \n");
-        strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
-        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
-        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf, 3);
+        strcat(pTmpBuf.data(), "\n \n");
+        strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
+        v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
+        dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
         return;
       }
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
-      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
+      dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
       v119 = (const char **)((149 - all_text_height) / v122);
       if ( (149 - all_text_height) / v122 > 32 )
         v119 = (const char **)32;
@@ -6090,3 +6051,212 @@
   }
   return;
 }
+
+
+//----- (004B6478) --------------------------------------------------------
+void sub_4B6478()
+    {
+  GUIWindow *v0; // ebx@1
+  Player *v1; // edi@1
+  unsigned int v2; // eax@1
+  signed int v3; // esi@1
+  int v4; // ebx@1
+  unsigned int v5; // esi@5
+  int v6; // edi@6
+  int result; // eax@13
+  GUIWindow *v8; // ebx@17
+  int v9; // eax@17
+  int v10; // ecx@17
+  unsigned int v11; // ecx@18
+  int v12; // eax@20
+  int v13; // eax@21
+  GUIButton *v14; // esi@27
+  int v15; // ecx@27
+  unsigned int v16; // eax@28
+  const char *v17; // ebx@29
+  int v18; // eax@29
+  unsigned int v19; // ecx@29
+  int v20; // eax@29
+  unsigned __int16 v21; // ax@29
+  unsigned __int16 v22; // ST14_2@36
+  int v23; // eax@36
+  const char *v24; // ST18_4@37
+  unsigned __int16 v25; // ST14_2@37
+  int v26; // eax@37
+  int v27; // [sp-4h] [bp-80h]@8
+  GUIWindow v28; // [sp+Ch] [bp-70h]@1
+  GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
+  unsigned int v30; // [sp+64h] [bp-18h]@1
+  int v31; // [sp+68h] [bp-14h]@1
+  int v32; // [sp+6Ch] [bp-10h]@1
+  int v33; // [sp+70h] [bp-Ch]@17
+  int v34; // [sp+74h] [bp-8h]@17
+  int v35; // [sp+78h] [bp-4h]@17
+
+  v0 = window_SpeakInHouse;
+  memcpy(&v28, window_SpeakInHouse, sizeof(v28));
+  v1 = pPlayers[uActiveCharacter];
+  v28.uFrameX = 483;
+  v28.uFrameWidth = 148;
+  v28.uFrameZ = 334;
+  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+  v2 = 52 * (unsigned int)v0->ptr_1C;
+  //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
+  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
+  //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
+  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
+  v4 = v3 * (100 - v1->GetMerchant()) / 100;
+  v32 = v4;
+  if ( v4 < v3 / 3 )
+  {
+    v4 = v3 / 3;
+    v32 = v3 / 3;
+  }
+  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
+  {
+    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    {
+      v5 = 0;
+
+      __debugbreak();
+      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
+      // or
+      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
+      // or
+      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
+      __debugbreak(); // whacky condition - fix
+      if (false
+      //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
+        || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
+      {
+        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+      }
+      else
+      {
+        if ( pParty->uNumGold < v4 )
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
+          v27 = 4;
+        }
+        else
+        {
+          Party::TakeGold(v4);
+          *(short *)v6 = 1;
+          v27 = 2;
+        }
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
+      }
+    }
+    else
+    {
+      v5 = 0;
+    }
+    /*result = pMessageQueue_50CBD0->uNumMessages;
+    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+    {
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
+      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
+      *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
+      ++pMessageQueue_50CBD0->uNumMessages;
+    }*/
+    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
+    return; // void func
+  }
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+  {
+    v24 = pNPCTopics[171].pText;
+    v25 = v31;
+    v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
+    v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
+    pDialogueWindow->pNumPresenceButton = 0;
+    return ;
+  }
+
+  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    return;
+  v8 = pDialogueWindow;
+  v33 = 0;
+  v34 = 0;
+  v29 = pDialogueWindow;
+  v9 = pDialogueWindow->pStartingPosActiveItem;
+  v10 = v9 + pDialogueWindow->pNumPresenceButton;
+  v35 = pDialogueWindow->pStartingPosActiveItem;
+  if ( v9 >= v10 )
+    goto LABEL_40;
+  do
+  {
+    v11 = v8->GetControl(v35)->msg_param - 36;
+    if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
+    {
+      v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
+      v33 += v12;
+      ++v34;
+    }
+    v13 = v8->pStartingPosActiveItem;
+    ++v35;
+  }
+  while ( v35 < v8->pNumPresenceButton + v13 );
+  if ( !v34 )
+  {
+LABEL_40:
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
+    strcat(pTmpBuf.data(), "\n \n");
+    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+    v22 = v31;
+    v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
+    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
+    return; 
+  }
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
+  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
+  v32 = (149 - v33) / v34;
+  if ( (149 - v33) / v34 > 32 )
+    v32 = 32;
+
+  v35 = v8->pStartingPosActiveItem;
+  v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
+  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
+  {
+    v33 = 2;
+    do
+    {
+      v14 = v8->GetControl(v35);
+      v15 = v14->msg_param - 36;
+      if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
+      {
+        v16 = 0;
+        if ( !v1->pActiveSkills[v15] )
+        {
+          v17 = pSkillNames[v15];
+          v14->uY = v32 + v34;
+          v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
+          v19 = v14->uY;
+          v14->uHeight = v18;
+          v20 = v19 + v18 - 1;
+          v14->uW = v20;
+          v34 = v20;
+          v21 = v31;
+          if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
+            v21 = v30;
+          v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
+          goto LABEL_34;
+        }
+      }
+      else
+      {
+        v16 = 0;
+      }
+      v14->uW = v16;
+      v14->uHeight = v16;
+      v14->uY = v16;
+LABEL_34:
+      v8 = v29;
+      ++v35;
+      ++v33;
+    }
+    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
+  }
+  return;
+}
\ No newline at end of file
--- a/UIMainMenu.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIMainMenu.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -86,7 +86,7 @@
     pWindowList[i].eWindowType = WINDOW_null;
 
   uNumVisibleWindows = -1;
-  memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs));
+  memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs));
 }
 
 //----- (004415C5) --------------------------------------------------------
--- a/UIOptions.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIOptions.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -56,7 +56,7 @@
 OptionsMenuSkin options_menu_skin; // 507C60
 
 
-bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C
+std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C
 //----- (00414D24) --------------------------------------------------------
 static unsigned int GameMenuUI_GetKeyBindingColor(int key_index)
 {
@@ -92,7 +92,7 @@
     if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
         {
         pPrevVirtualCidesMapping[uGameMenuUI_CurentlySelectedKeyIdx] = pKeyActionMap->pPressedKeysBuffer[0];
-        memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
+        memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
         v4 = 0;
         do
             {
--- a/UIPartyCreation.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIPartyCreation.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -111,8 +111,8 @@
     for (uint i = 0; i < 4; ++i)
         for (uint j = 0; j < 56; ++j)
             {
-            sprintf(pTmpBuf, "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1);
-            pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+            sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1);
+            pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
             }
 
         pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE);
@@ -137,12 +137,12 @@
 
     result = 0;
     v3 = &pPlayerPortraitsNames[a2];
-    v4 = pTextures_PlayerFaces[a1];
+    v4 = pTextures_PlayerFaces[a1].data();
     do
         {
         v5 = result + 1;
-        sprintf(pTmpBuf, "%s%02d", *v3, result + 1);
-        pIcons_LOD->ReloadTexture(*v4, pTmpBuf, 2);
+        sprintf(pTmpBuf.data(), "%s%02d", *v3, result + 1);
+        pIcons_LOD->ReloadTexture(*v4, pTmpBuf.data(), 2);
         result = v5;
         ++v4;
         }
@@ -309,73 +309,73 @@
       case 2:  uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin"
       case 3:  uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf"
     }; 
-    strcpy(pTmpBuf, uRaceName);
-    pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX + 72, pIntervalY + 12, 0, pTmpBuf, 130, 0);//Race Name
+    strcpy(pTmpBuf.data(), uRaceName);
+    pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX + 72, pIntervalY + 12, 0, pTmpBuf.data(), 130, 0);//Race Name
 
     pTextCenter = pFontCreate->AlignText_Center(150, pText);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, uColor1, pText, 0, 0, 0); // Skills
 
     uStatLevel = player->GetActualMight();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], pX_Numbers, uStatLevel);// "Might"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], pX_Numbers, uStatLevel);// "Might"
     pStatColor = player->GetStatColor(0);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualIntelligence();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], pX_Numbers, uStatLevel);// "Intellect"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], pX_Numbers, uStatLevel);// "Intellect"
     pStatColor = player->GetStatColor(1);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualWillpower();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], pX_Numbers, uStatLevel);// "Personality"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], pX_Numbers, uStatLevel);// "Personality"
     pStatColor = player->GetStatColor(2);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualEndurance();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], pX_Numbers, uStatLevel);// "Endurance"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], pX_Numbers, uStatLevel);// "Endurance"
     pStatColor = player->GetStatColor(3);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 3 * pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 3 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualAccuracy();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], pX_Numbers, uStatLevel);// "Accuracy"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], pX_Numbers, uStatLevel);// "Accuracy"
     pStatColor = player->GetStatColor(4);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualSpeed();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], pX_Numbers, uStatLevel);// "Speed"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], pX_Numbers, uStatLevel);// "Speed"
     pStatColor = player->GetStatColor(5);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 5 * pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 5 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
     uStatLevel = player->GetActualLuck();
-    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], pX_Numbers, uStatLevel);// "Luck"
+    sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], pX_Numbers, uStatLevel);// "Luck"
     pStatColor = player->GetStatColor(6);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 6 * pIntervalY + 169, pStatColor, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 6 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
 
 
     pSkillsType = player->GetSkillIdxByOrder(0);
     pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
-    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf.data(), 0, 0, 0);
 
     pSkillsType = player->GetSkillIdxByOrder(1);
     pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
-    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, pIntervalY + 311, uColorWhite, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, pIntervalY + 311, uColorWhite, pTmpBuf.data(), 0, 0, 0);
 
     pSkillsType = player->GetSkillIdxByOrder(2);
     pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
-    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
+    sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
     pColorText = uColorGreen;
     if ( (signed int)pSkillsType >= 37 )
       pColorText = uColorTeal;
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * pIntervalY + 311, pColorText, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0);
 
     pSkillsType = player->GetSkillIdxByOrder(3);
     pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
-    sprintf(pTmpBuf, "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
+    sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
     pColorText = uColorGreen;
     if ( (signed int)pSkillsType >= 37 )
       pColorText = uColorTeal;
-    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 3 * pIntervalY + 311, pColorText, pTmpBuf, 0, 0, 0);
+    pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 3 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0);
 
     //v124 = (char *)v124 + 1;
     pIntervalX += 159;
@@ -494,9 +494,9 @@
   pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus"
   pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0);
   pBonusNum = PlayerCreation_ComputeAttributeBonus();
-  sprintf(pTmpBuf, "%d", pBonusNum);
-  pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf);
-  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), "%d", pBonusNum);
+  pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf.data());
+  pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf.data(), 0, 0, 0);
   if ( GameUI_Footer_TimeLeft > GetTickCount() )
   {
     pWindow.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
@@ -556,8 +556,8 @@
   pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE);
   for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture
   {
-    sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]);
-    v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "%s01", pPlayerPortraitsNames[uX]);
+    v1 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
     pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1];
 
   }
@@ -569,11 +569,11 @@
   uControlParam = 1;
   do
   {
-    sprintf(pTmpBuf, "arrowl%d", uControlParam);
-    pTextures_arrowl[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "arrowl%d", uControlParam);
+    pTextures_arrowl[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
 
-    sprintf(pTmpBuf, "arrowr%d", uControlParam);
-    pTextures_arrowr[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf.data(), "arrowr%d", uControlParam);
+    pTextures_arrowr[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
   }
   while ( ++uControlParam < 20 );
   pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
--- a/UIPopup.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIPopup.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -529,12 +529,12 @@
             wHintWindow.uFrameX -= 12;
             if ( v77 )
                 {
-                sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
+                sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
                 v40 = pFontComic;
                 v61 = 0;
                 v56 = 0;
                 v51 = 0;
-                v47 = pTmpBuf;
+                v47 = pTmpBuf.data();
                 v44 = 0;
                 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
                 v41 = 100;
@@ -544,31 +544,31 @@
                 if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
                     {
                     sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
-                    strcpy(pTmpBuf, "Duration:");
+                    strcpy(pTmpBuf.data(), "Duration:");
                     Str = (char *)(v67.field_18_expire_year - game_starting_year);
                     if (v67.field_18_expire_year != 1168 )
                         {
                         sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year);
-                        strcat(pTmpBuf, v65);
+                        strcat(pTmpBuf.data(), v65);
                         }
                     if ( (((v67.field_14_exprie_month || Str) && 
-                        ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str) 
+                        ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str) 
                         || v67.field_C_expire_day)
-                        && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || 
+                        && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || 
                         v67.field_C_expire_day)
                         || v67.field_8_expire_hour)
-                        && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str || 
+                        && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str || 
                         v67.field_C_expire_day || v67.field_8_expire_hour)
                         || v67.field_4_expire_minute )
                         {
                         sprintf(v65, " %d:mn", v67.field_4_expire_minute);
-                        strcat(pTmpBuf, v65);
+                        strcat(pTmpBuf.data(), v65);
                         }
-                    wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0);
+                    wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
                     }
                 v37 = inspect_item->GetValue();
-                sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37);
-                wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0);
+                sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37);
+                wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
                 v38 = inspect_item->uAttributes;
                 if ( BYTE1(v38) & 1 )
                     {
@@ -597,7 +597,7 @@
                 LOWORD(v38) = LOWORD(pRenderer->uTargetRMask);
                 v44 = v38;
                 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
-                v39 = pFontComic->GetLineWidth(pTmpBuf);
+                v39 = pFontComic->GetLineWidth(pTmpBuf.data());
                 v40 = pFontComic;
                 v41 = v39 + 132;
                 }
@@ -943,7 +943,7 @@
     //v37 = v6->uProfession;
     if (v6->uProfession)
     {
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s"   /   ^Pi[%s] %s
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s"   /   ^Pi[%s] %s
     }
 	else
 	{
@@ -961,9 +961,9 @@
       v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName;
   }
   if(!v121->sNPC_ID || (v121->sNPC_ID && !v6->uProfession))
-    strncpy(pTmpBuf, v72, v77);
+    strncpy(pTmpBuf.data(), v72, v77);
   v39 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u);
+  a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf.data(), 3u);
   Actor::DrawHealthBar(v121, a1);
   v119 = 0;
   pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed;
@@ -1230,8 +1230,8 @@
   a4 = v106.uViewportY;
   if ( v119 )
   {
-    sprintf(pTmpBuf, "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP);
+    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
     a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
     v79 = v121->pMonsterInfo.uAC;
     v75 = 0;
@@ -1240,16 +1240,16 @@
   }
   else
   {
-    sprintf(pTmpBuf, "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);
+    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
     v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630];
     v75 = 0;
     v70 = pGlobalTXT_LocalizationStrings[12];
     a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
     v67 = "%s\f%05u\t100%s\n";
   }
-  sprintf(pTmpBuf, v67, v70, v75, v79);
-  a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), v67, v70, v75, v79);
+  a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
   a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight);
   v95[0] = pGlobalTXT_LocalizationStrings[87];
   v95[1] = pGlobalTXT_LocalizationStrings[6];
@@ -1264,25 +1264,25 @@
   v95[10] = pGlobalTXT_LocalizationStrings[54];
   if ( v116 )
   {
-    sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]);
+    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
     a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
     v57 = v121->pMonsterInfo.uAttack1DamageBonus;
     if ( v57 )
-      sprintf(pTmpBuf, "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
+      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
         0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57);
     else
-      sprintf(pTmpBuf, "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
+      sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
         0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides);
   }
   else
   {
-    sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
+    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
     a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
-    sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]);
+    sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]);
   }
-  a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0);
+  a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
   v58 = LOBYTE(v56->uFontHeight);
   a4 = a4 + v58 - 6 + v58;
   if ( !i )
@@ -1291,8 +1291,8 @@
     v76 = 0;
     v71 = pGlobalTXT_LocalizationStrings[628];
     v68 = "%s\f%05u\t080%s\n";
-    sprintf(pTmpBuf, v68, v71, v76, v80);
-    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+    sprintf(pTmpBuf.data(), v68, v71, v76, v80);
+    a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
     v58 = LOBYTE(v56->uFontHeight);
     a4 = a4 + v58 - 3;
   }
@@ -1305,8 +1305,8 @@
 		v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
 	  if ( v114 )
 	  {
-		sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
-		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		sprintf(pTmpBuf.data(), "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
 		v58 = LOBYTE(v56->uFontHeight);
 		a4 = a4 + v58 - 3;
 		v59 = v121;
@@ -1314,8 +1314,8 @@
 	  v60 = v59->pMonsterInfo.uSpell2ID;
 	  if ( v60 )
 	  {
-		sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
-		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		sprintf(pTmpBuf.data(), "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
 		v58 = LOBYTE(v56->uFontHeight);
 		a4 = a4 + v58 - 3;
 		v59 = v121;
@@ -1326,8 +1326,8 @@
 		v76 = 0;
 		v71 = pGlobalTXT_LocalizationStrings[628];
 		v68 = "%s\f%05u\t060%s\n";
-		sprintf(pTmpBuf, v68, v71, v76, v80);
-		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
+		sprintf(pTmpBuf.data(), v68, v71, v76, v80);
+		a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
 		v58 = LOBYTE(v56->uFontHeight);
 		a4 = a4 + v58 - 3;
 	  }
@@ -1372,8 +1372,8 @@
         else
           v81 = pGlobalTXT_LocalizationStrings[153];
       }
-      sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[v124], 0, v81);
-      a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0);
+      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[v124], 0, v81);
+      a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
       v63 = LOBYTE(v56->uFontHeight);
       v124 += 4;
       a4 = a4 + v63 - 3;
@@ -1385,8 +1385,8 @@
     i = 0;
     do
     {
-      sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?"
-      a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0);
+      sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?"
+      a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
       v65 = LOBYTE(v56->uFontHeight);
       ++i;
       a4 = a4 + v65 - 3;
@@ -1395,9 +1395,9 @@
   }
   if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 )
   {
-    sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
-    pFontSmallnum->GetLineWidth(pTmpBuf);
-    a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3);
+    sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
+    pFontSmallnum->GetLineWidth(pTmpBuf.data());
+    a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3);
   }
 }
 
@@ -1518,11 +1518,11 @@
         v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4);
         v34 = (int)((char *)v35 + 3);
         v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
-        v18 = *(int *)((char *)pGrandSkillDesc + v15);
-        v19 = *(int *)((char *)pMasterSkillDesc + v15);
-        v20 = *(int *)((char *)pExpertSkillDesc + v15);
-        v21 = *(int *)((char *)pNormalSkillDesc + v15);
-        v22 = *(int *)((char *)pSkillDesc + v15);
+        v18 = *(int *)(pGrandSkillDesc[v15]);
+        v19 = *(int *)(pMasterSkillDesc[v15]);
+        v20 = *(int *)(pExpertSkillDesc[v15]);
+        v21 = *(int *)(pNormalSkillDesc[v15]);
+        v22 = *(int *)(pSkillDesc[v15]);
         v23 = static_sub_417BB5_out_string;
         sprintf(
             static_sub_417BB5_out_string,
@@ -1637,33 +1637,33 @@
         sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
       break;
     case 10:// Player Condition
-      strcpy(pTmpBuf2, pPlayerConditionAttributeDescription);
-      strcat(pTmpBuf2, "\n");
-      extern unsigned int pConditionImportancyTable[18];
+      strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription);
+      strcat(pTmpBuf2.data(), "\n");
+      extern std::array<unsigned int, 18> pConditionImportancyTable;
       for ( uint i = 0; i < 18; ++i )
       {
         if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] )
         {
-          strcat(pTmpBuf2, " \n");
+          strcat(pTmpBuf2.data(), " \n");
           pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]];
           pHour = (unsigned int)((pHour * 0.234375) / 60 / 60);
           pDay = (unsigned int)pHour / 24;
           pHour %= 24i64;
           pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]);
-          sprintfex(pTmpBuf, format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]);
-          strcat(pTmpBuf2, pTmpBuf);
+          sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]);
+          strcat(pTmpBuf2.data(), pTmpBuf.data());
           if ( pHour && pHour <= 1 )
             pHourWord = pGlobalTXT_LocalizationStrings[109];
           else
             pHourWord = pGlobalTXT_LocalizationStrings[110];
           if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) )
             pDayWord = pGlobalTXT_LocalizationStrings[57];
-          sprintfex(pTmpBuf, "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord);
-          strcat(pTmpBuf2, pTmpBuf);
+          sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord);
+          strcat(pTmpBuf2.data(), pTmpBuf.data());
         }
       }
-      if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2 )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2);
+      if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() )
+        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
       break;
     case 11:// Fast Spell
       if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
@@ -1689,14 +1689,14 @@
       pTmpBuf[0] = 0;
       pTmpBuf2[0] = 0;
       if ( v15 > pPlayers[uActiveCharacter]->uLevel )
-        sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15);
+        sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15);
       v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience);
-      sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
-      strcat(pTmpBuf, "\n");
-      strcat(pTmpBuf, pTmpBuf2);
-      sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf);
-      if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2 )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2);
+      sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
+      strcat(pTmpBuf.data(), "\n");
+      strcat(pTmpBuf.data(), pTmpBuf2.data());
+      sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
+      if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
+        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
       break;
     case 15:// Attack Bonus
       if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
@@ -1797,7 +1797,7 @@
             v5 = v12;
         if ( v4 > v5 )
             v5 = v4;
-        sprintf(  pTmpBuf2,
+        sprintf(  pTmpBuf2.data(),
             "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
             v2->pDescription,
             pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL],
@@ -1812,7 +1812,7 @@
             pGlobalTXT_LocalizationStrings[LOCSTR_GRAND],
             v5 + 3,  v5 + 10,
             v2->pGrandmasterSkillDesc);
-        v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
+        v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
         a1.uFrameHeight += v6;
         if ( (signed int)a1.uFrameHeight < 150 )
             a1.uFrameHeight = 150;
@@ -1825,16 +1825,16 @@
         a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
         v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
         a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
-        a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
+        a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
         a1.uFrameWidth = 108;
         a1.uFrameZ = a1.uFrameX + 107;
         a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
-        sprintf( pTmpBuf,  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
+        sprintf( pTmpBuf.data(),  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
             pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
         //  *(&[0].field_12 //temp_fix field_14
         // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
         // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
-        a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u);
+        a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3u);
         dword_507B00_spell_info_to_draw_in_popup = 0;
         }
     // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup;
@@ -1932,9 +1932,9 @@
             {
             if ( !pPlayers[uActiveCharacter]->CanAct() )
                 {
-                sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427],//%s    %s
+                sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427],//%s    %s
                     pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);// 
-                pWindow.Hint = pTmpBuf;
+                pWindow.Hint = pTmpBuf.data();
                 pWindow.uFrameWidth = 384;
                 pWindow.uFrameHeight = 180;
                 pWindow.uFrameY = 40;
@@ -2175,8 +2175,8 @@
                         if ( (signed int)pSkillId < 37 )
                             {
                             pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId);
-                            strcpy(pTmpBuf2, pSkillInfo);
-                            pWindow.Hint = pTmpBuf2;
+                            strcpy(pTmpBuf2.data(), pSkillInfo);
+                            pWindow.Hint = pTmpBuf2.data();
                             pStr = pSkillNames[pSkillId];
                             }
                         }
@@ -2201,8 +2201,8 @@
                 pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1;
                 pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1;
                 pColor = TargetColor(0xFF, 0xFF, 0x9B);
-                sprintf(pTmpBuf, format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n"
-                pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3);
+                sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n"
+                pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
                 pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0);
                 }
             break;
--- a/UIRest.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UIRest.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -91,7 +91,7 @@
         --uRestUI_FoodRequiredToRest;
     if ( uRestUI_FoodRequiredToRest < 1 )
         uRestUI_FoodRequiredToRest = 1;
-    if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )
+    if ( !_stricmp(pCurrentMapName.data(), "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )
         uRestUI_FoodRequiredToRest = 0;
 
     ++pIcons_LOD->uTexturePacksCount;
@@ -175,8 +175,8 @@
         if (hourglass_icon_idx >= 120 )
             hourglass_icon_idx = 1;
 
-        sprintf(pTmpBuf, "hglas%03d", hourglass_icon_idx);
-        pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+        sprintf(pTmpBuf.data(), "hglas%03d", hourglass_icon_idx);
+        pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
         pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame);
         memset(&tmp_button, 0, sizeof(GUIButton));
         tmp_button.uX = 24;
@@ -191,8 +191,8 @@
         tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent;
         tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, text_color, shadow_color);
         tmp_button.pParent = 0;
-        sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest);
-        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, text_color, pTmpBuf, 0, 0, shadow_color);
+        sprintf(pTmpBuf.data(), "\r408%d", uRestUI_FoodRequiredToRest);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, text_color, pTmpBuf.data(), 0, 0, shadow_color);
         pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, text_color, shadow_color);
         pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, text_color, shadow_color);
         pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, text_color, shadow_color);
@@ -211,14 +211,14 @@
         tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, text_color, shadow_color);
         tmp_button.pParent = 0;
         v5 = (pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0;
-        sprintf(pTmpBuf, "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[v5]);
-        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, text_color, pTmpBuf, 0, 0, shadow_color);
-        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);
-        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, text_color, pTmpBuf, 0, 0, shadow_color);
-        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);
-        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, text_color, pTmpBuf, 0, 0, shadow_color);
-        sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);
-        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, text_color, pTmpBuf, 0, 0, shadow_color);
+        sprintf(pTmpBuf.data(), "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[v5]);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, text_color, pTmpBuf.data(), 0, 0, shadow_color);
+        sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, text_color, pTmpBuf.data(), 0, 0, shadow_color);
+        sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, text_color, pTmpBuf.data(), 0, 0, shadow_color);
+        sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);
+        pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, text_color, pTmpBuf.data(), 0, 0, shadow_color);
         if ( dword_506F14 )
             Sleep6Hours();
         }
--- a/UISaveLoad.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UISaveLoad.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -131,7 +131,7 @@
     v6 = uLoadGameUI_SelectedSlot;
     if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
     {
-      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
+      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]);
       v6 = uLoadGameUI_SelectedSlot;
     }
     pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
@@ -179,9 +179,9 @@
     auto day = aDayNames[HIDWORD(pOurHour) % 7];
     auto ampm = aAMPMNames[HIDWORD(pAMPM2)];
     auto month = aMonthNames[pMonthNum];
-    //sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
-    sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
-    pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u);
+    //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
+    sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
+    pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u);
     v1 = 255;
   }
   if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
@@ -200,8 +200,8 @@
     //v18 = pGlobalTXT_LocalizationStrings[135];
     v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//""
     pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);
-    v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
-    v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
+    v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]);
+    v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot);
     pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0);
     //v22 = pGlobalTXT_LocalizationStrings[165];
     v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//", "
@@ -278,8 +278,8 @@
     dword_6BE138 = -1;
     pIcons_LOD->_inlined_sub2();
 
-    memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
-    memset(pSavegameThumbnails, 0, 45 * sizeof(RGBTexture));
+    memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots));
+    memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture));
     uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
     uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
     uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
@@ -323,14 +323,14 @@
     for (uint i = 0; i < uNumSavegameFiles; ++i)
         {
 
-        sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName);
-        if (_access(pTmpBuf, 6))
+        sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName);
+        if (_access(pTmpBuf.data(), 6))
             {
             pSavegameUsedSlots[i] = 0;
             strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
             continue;
             }
-        pLODFile.LoadFile(pTmpBuf, 1);
+        pLODFile.LoadFile(pTmpBuf.data(), 1);
         v4 = pLODFile.FindContainer("header.bin", true);
         if ( v4 )
             fread(&pSavegameHeader[i], 0x64, 1, v4);
@@ -390,7 +390,7 @@
     ++pIcons_LOD->uTexturePacksCount;
     if ( !pIcons_LOD->uNumPrevLoadedFiles )
         pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-    memset(pSavegameUsedSlots, 0, 0xB4u);
+    memset(pSavegameUsedSlots.data(), 0, 0xB4u);
     memset(&pSavegameThumbnails, 0, 0x708u);
     uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
     uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
@@ -425,15 +425,15 @@
         v3 = pSavegameList->pFileList[i].pSaveFileName;
         if ( !*pSavegameList->pFileList[i].pSaveFileName )
             v3 = "1.mm7";
-        sprintf(pTmpBuf, "saves\\%s", v3);
-        if ( _access(pTmpBuf, 0) || _access(pTmpBuf, 6) )
+        sprintf(pTmpBuf.data(), "saves\\%s", v3);
+        if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) )
             {
             pSavegameUsedSlots[i] = 0;
             strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]);
             }
         else
             {
-            v11.LoadFile(pTmpBuf, 1);
+            v11.LoadFile(pTmpBuf.data(), 1);
             v4 = v11.FindContainer("header.bin", 1);
             fread(&pSavegameHeader[i], 100, 1u, v4);
             v5 = v11.FindContainer("image.pcx", 1);
--- a/UITransition.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UITransition.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -108,10 +108,10 @@
   }
   else if ( !v23 )
   {
-      v14 = pMapStats->GetMapInfo(pCurrentMapName);
+      v14 = pMapStats->GetMapInfo(pCurrentMapName.data());
       if ( v14 )
       {
-        sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s"
+        sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s"
         goto LABEL_20;
       }
       v21 = pGlobalTXT_LocalizationStrings[79];
@@ -119,18 +119,18 @@
   }
   v15 = pLocationName;
   if ( *pLocationName == 48 )
-    v15 = pCurrentMapName;
+    v15 = pCurrentMapName.data();
   v16 = pMapStats->GetMapInfo(v15);
   if ( v16 )
   {
-    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
     goto LABEL_20;
   }
   v21 = pGlobalTXT_LocalizationStrings[73];
 LABEL_19:
-  strcpy(sHouseName, v21);
+  strcpy(sHouseName.data(), v21);
 LABEL_20:
-  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName);
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName.data());
   //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
   if ( pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].uRoomSoundId )
     PlayHouseSound(anim_id, HouseSound_Greeting);
@@ -164,12 +164,12 @@
 
   pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
   pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE);
-  v1 = pMapStats->GetMapInfo(pCurrentMapName);
+  v1 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( v1 )
-    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
   else
-    strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit"
-  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName);
+    strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit"
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName.data());
 }
 
 
@@ -188,7 +188,7 @@
   unsigned int v9; // [sp+80h] [bp-4h]@1
 
   memcpy(&v7, pPrimaryWindow, sizeof(v7));
-  v9 = pMapStats->GetMapInfo(pCurrentMapName);
+  v9 = pMapStats->GetMapInfo(pCurrentMapName.data());
   pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
   v0 = pMapStats->GetMapInfo(pDestinationMapName);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
@@ -217,12 +217,12 @@
       v6 = v3;
       v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s."
     }
-    sprintfex(pTmpBuf, v5, v6, v1->pName);
-    strcat(pTmpBuf, "\n \n");
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
-    strcat(pTmpBuf, pTmpBuf2);
-    v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0);
-    v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3);
+    sprintfex(pTmpBuf.data(), v5, v6, v1->pName);
+    strcat(pTmpBuf.data(), "\n \n");
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
+    v4 = pFontCreate->CalcTextHeight(pTmpBuf.data(), &v7, 0, 0);
+    v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf.data(), 3);
     _unused_5B5924_is_travel_ui_drawn = 1;
   }
 }
@@ -245,7 +245,7 @@
   int a3; // [sp+6Bh] [bp-1h]@11
 
   memcpy(&v8, pPrimaryWindow, sizeof(v8));
-  v10 = pMapStats->GetMapInfo(pCurrentMapName);
+  v10 = pMapStats->GetMapInfo(pCurrentMapName.data());
   v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
@@ -274,9 +274,9 @@
   }
   else if ( v10 )
   {
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
-    v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101;
-    v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
+    v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &v8, 0, 0)) / 2 + 101;
+    v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3);
   }
   else assert(false);
 
--- a/UiGame.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/UiGame.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -294,8 +294,8 @@
         a1.uFrameWidth = 400;
         a1.uFrameZ = a1.uFrameX + 399;
         a1.DrawMessageBox(0);
-        sprintfex(pTmpBuf2, "NPC%03d", v6->uPortraitID);
-        v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE);
+        sprintfex(pTmpBuf2.data(), "NPC%03d", v6->uPortraitID);
+        v8 = pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE);
         pRenderer->DrawTextureIndexed(
           a1.uFrameX + 22,
           a1.uFrameY + 36,
@@ -304,14 +304,14 @@
         if ( v9 )
         {
           v10 = v6->pName;
-          v11 = pTmpBuf;
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
+          v11 = pTmpBuf.data();
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
         }
         else
         {
           v12 = v6->pName;
-          v11 = pTmpBuf;
-          strcpy(pTmpBuf, v12);
+          v11 = pTmpBuf.data();
+          strcpy(pTmpBuf.data(), v12);
         }
         v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
         a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
@@ -498,13 +498,13 @@
 
   if (pNPC->uProfession)
   {
-    assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames)); // sometimes buffer overflows; errors emerge both here and in dialogue text
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s
+    assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s
   }
   else
-    strcpy(pTmpBuf, pNPC->pName);
+    strcpy(pTmpBuf.data(), pNPC->pName);
 
-  v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3);
+  v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf.data(), 3);
   pParty->GetPartyFame();
 
   pInString = nullptr;
@@ -537,8 +537,8 @@
     break;
 
     case DIALOGUE_ARENA_REWARD:
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold."
-      pInString = pTmpBuf;
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold."
+      pInString = pTmpBuf.data();
     break;
 
     case DIALOGUE_ARENA_ALREADY_WON:
@@ -798,20 +798,20 @@
 
   pFont = pFontArrus;
   if ( current_npc_text && !byte_5B0938[0] )
-    strcpy(byte_5B0938, current_npc_text);
+    strcpy(byte_5B0938.data(), current_npc_text);
   v5.uFrameWidth = game_viewport_width;
   v5.uFrameZ = 452;
-  v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7;
+  v1 = pFontArrus->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7;
   if ( 352 - v1 < 8 )
   {
     pFont = pFontCreate;
-    v1 = pFontCreate->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7;
+    v1 = pFontCreate->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7;
   }
   pRenderer->_4A6A68(8, 352 - v1,
     pIcons_LOD->GetTexture(uTextureID_Leather),
     pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1);
   pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428);
-  v2 = FitTextInAWindow(byte_5B0938, pFont, &v5, 0xCu, 0);
+  v2 = FitTextInAWindow(byte_5B0938.data(), pFont, &v5, 0xCu, 0);
   pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0);
   pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
   if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
@@ -819,7 +819,7 @@
     if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
     {
       pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
-      strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer);
+      strcpy(GameUI_Footer_TimedString.data(), (const char *)pKeyActionMap->pPressedKeysBuffer);
 LABEL_16:
       sub_4452BB();
       return;
@@ -828,7 +828,7 @@
       return;
     pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
 LABEL_15:
-    memset(GameUI_Footer_TimedString, 0, 0xC8u);
+    memset(GameUI_Footer_TimedString.data(), 0, 0xC8u);
     goto LABEL_16;
   }
   if ( pGUIWindow2->ptr_1C == (void *)26 )
@@ -892,7 +892,7 @@
   if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) )
   {
 LABEL_14:
-    v17 = pMapStats->GetMapInfo(pCurrentMapName);
+    v17 = pMapStats->GetMapInfo(pCurrentMapName.data());
     if ( v17 == v2 )
       result = "No Maze Info for this maze on file!";
     else
@@ -1022,38 +1022,38 @@
 
   pRenderer->DrawTextureTransparent(window->uFrameX + 24, window->uFrameY + 24, v13);
 
-  sprintfex(pTmpBuf, "\f%05d", ui_character_header_text_color);
-  sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s"
-  strcat(pTmpBuf, pTmpBuf2);
-  strcat(pTmpBuf, "\f00000\n");
+  sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color);
+  sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s"
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
+  strcat(pTmpBuf.data(), "\f00000\n");
 
   v20 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth());
-  sprintf(pTmpBuf2, "%s : \f%05u%d\f00000 / %d\n",
+  sprintf(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n",
           pGlobalTXT_LocalizationStrings[108], // "Hit Points"
           v20, player->sHealth, player->GetMaxHealth());
-  strcat(pTmpBuf, pTmpBuf2);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
 
   v24 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana());
-  sprintf(pTmpBuf2, "%s : \f%05u%d\f00000 / %d\n",
+  sprintf(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n",
           pGlobalTXT_LocalizationStrings[212], // "Spell Points"
           v24, player->sMana, player->GetMaxMana());
-  strcat(pTmpBuf, pTmpBuf2);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
 
   v25 = player->GetMajorConditionIdx();
-  sprintf(pTmpBuf2, "%s: \f%05d%s\f00000\n",
+  sprintf(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n",
           pGlobalTXT_LocalizationStrings[47], // "Condition
           GetConditionDrawColor(v25), aCharacterConditionNames[v25]);
-  strcat(pTmpBuf, pTmpBuf2);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
 
   v28 = player->uQuickSpell;
   if ( v28 )
     v29 = pSpellStats->pInfos[v28].pShortName;
   else
     v29 = pGlobalTXT_LocalizationStrings[153];
-  sprintfex(pTmpBuf2, "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell"
-  strcat(pTmpBuf, pTmpBuf2);
+  sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell"
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
 
-  window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf, 0, 0, 0);
+  window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0);
 
   uFramesetIDa = 0;
   for (uint i = 0; i < 24; ++i)
@@ -1072,8 +1072,8 @@
   v39 = "";
   if ( uFramesetIDa == 0 )
     v39 = pGlobalTXT_LocalizationStrings[153]; // "None"
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s"
-  window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf, 0, 0, 0);
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s"
+  window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
 
@@ -1148,12 +1148,12 @@
             pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_character_header_text_color, player->pName, 84, 0);
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //.
-            sprintf(pTmpBuf, "%lu", player->GetActualLevel());
+            sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel());
             if ( player->GetActualLevel() <= player->GetBaseLevel())
                 v5 = player->GetExperienceDisplayColor();
             else
               v5 = ui_character_bonus_text_color;
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf.data(), 84, 0);
             v6 = v45 + 47;
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//
@@ -1161,26 +1161,26 @@
             v7 = v45 + v6;
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//.
-            sprintf(pTmpBuf, "%d", player->sHealth);
+            sprintf(pTmpBuf.data(), "%d", player->sHealth);
             v9 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth());
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf.data(), 84, 0);
             v10 = v45 + v7;
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//
-            sprintf(pTmpBuf, "%d", player->sMana);
+            sprintf(pTmpBuf.data(), "%d", player->sMana);
             v12 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana());
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf.data(), 84, 0);
             v13 = v45 + v10;
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);// 
-            sprintf(pTmpBuf, "%d", player->GetActualAC());
+            sprintf(pTmpBuf.data(), "%d", player->GetActualAC());
             v18 = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC());
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf.data(), 84, 0);
             v19 = v45 + v13;
             if ( !v43 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//
-            sprintf(pTmpBuf, "%+d", player->GetActualAttack(0));
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
+            sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(0));
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf.data(), 84, 0);
             v21 = v45 + v19;
             if ( !v43 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
@@ -1189,8 +1189,8 @@
             v23 = v45 + v21;
             if ( !v43 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// 
-            sprintf(pTmpBuf, "%+d", player->GetRangedAttack());
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
+            sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack());
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf.data(), 84, 0);
             v25 = v45 + v23;
             if ( !v43 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//.
@@ -1210,13 +1210,13 @@
                 --v30;
                 }
                 while ( v30 );
-                sprintf(pTmpBuf, "%lu", v28);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
+                sprintf(pTmpBuf.data(), "%lu", v28);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf.data(), 84, 0);
                 v31 = v45 + v27;
                 if ( !v43 )
                     pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//
-                sprintf(pTmpBuf, "%lu", player->uSkillPoints);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf, 84, 0);
+                sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0);
                 v32 = v45 + v31;
                 v48 = player->GetMajorConditionIdx();
                 if ( !v43 )
@@ -1247,11 +1247,11 @@
             else
               v39 = ui_character_bonus_text_color;
 
-            sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
+            sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0);
 
-            sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame 
-            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
+            sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame 
+            pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
 
@@ -1290,10 +1290,10 @@
   if ( uGameState != GAME_STATE_FINAL_WINDOW )
   {
     v2 = sub_44100D() != 0 ? 381 : 322;
-    sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations);
-    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow);
-    sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold);
-    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow);
+    sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations);
+    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
+    sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold);
+    pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
   }
 }
 
@@ -1392,12 +1392,12 @@
 
   pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
   if (GameUI_Footer_TimeLeft)
-    v1 = GameUI_Footer_TimedString;
+    v1 = GameUI_Footer_TimedString.data();
   else
   {
     if (!pFooterString[0])
       return;
-    v1 = pFooterString;
+    v1 = pFooterString.data();
   }
 
   v5 = pFontLucida->AlignText_Center(450, v1);
@@ -1416,18 +1416,18 @@
         {
         if ( GameUI_Footer_TimeLeft )
             {
-            for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString);
+            for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
                 i > 450;
-                i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString) )
-                byte_5C3427[strlen(GameUI_Footer_TimedString)] = 0;
+                i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
+                byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
             }
         else
             {
-            strcpy(pFooterString, v1);
-            for ( j = pFontLucida->GetLineWidth(pFooterString);
+            strcpy(pFooterString.data(), v1);
+            for ( j = pFontLucida->GetLineWidth(pFooterString.data());
                 j > 450;
-                j = pFontLucida->GetLineWidth(pFooterString) )
-                GameUI_Footer_TimedString[strlen(pFooterString) + 199] = 0;
+                j = pFontLucida->GetLineWidth(pFooterString.data()) )
+                GameUI_Footer_TimedString[strlen(pFooterString.data()) + 199] = 0;
             }
         }
     }
@@ -1453,28 +1453,28 @@
         pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar);
         if ( GameUI_Footer_TimeLeft )
             {
-            v1 = GameUI_Footer_TimedString;
-            v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString);
+            v1 = GameUI_Footer_TimedString.data();
+            v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
             v3 = 450;
             while ( v2 > 450 )
                 {
-                v4 = strlen(GameUI_Footer_TimedString);
+                v4 = strlen(GameUI_Footer_TimedString.data());
                 v5 = pFontLucida;
                 byte_5C3427[v4] = 0;
-                v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString);
+                v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
                 }
             }
         else
             {
-            v1 = pFooterString;
-            v6 = pFontLucida->GetLineWidth(pFooterString);
+            v1 = pFooterString.data();
+            v6 = pFontLucida->GetLineWidth(pFooterString.data());
             v3 = 450;
             while ( v6 > 450 )
                 {
-                v7 = strlen(pFooterString);
+                v7 = strlen(pFooterString.data());
                 v8 = pFontLucida;
                 GameUI_Footer_TimedString[v7 + 199] = 0;
-                v6 = pFontLucida->GetLineWidth(pFooterString);
+                v6 = pFontLucida->GetLineWidth(pFooterString.data());
                 }
             }
         v9 = *v1 == 0;
@@ -1618,8 +1618,8 @@
         return;
       }
       v31 = pSpriteObjects[v30].stru_24.GetDisplayName();
-      v28 = pTmpBuf;
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
+      v28 = pTmpBuf.data();
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
     }
     else
     {
@@ -1803,13 +1803,13 @@
         return;
       }
       pActor = &pActors[v19];
-      v28 = pTmpBuf;
+      v28 = pTmpBuf.data();
       v29 = pActor->dword_000334_unique_name;
       if ( v29 )
         v40 = pMonsterStats->pPlaceStrings[v29];
       else
         v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName;
-      strncpy(pTmpBuf, v40, 0x7D0u);
+      strncpy(pTmpBuf.data(), v40, 0x7D0u);
     }
     v26 = v28;
 //LABEL_87:
@@ -2638,7 +2638,7 @@
       for (uint i = 0; i < uNumSpriteObjects; ++i)
     //if (uNumSpriteObjects > 0)
       {
-        auto object = pSpriteObjects + i;
+        auto object = &pSpriteObjects[i];
 
       //a2c = (char *)&pSpriteObjects[0].uObjectDescID;
       //while ( 1 )
@@ -2694,7 +2694,7 @@
     uZf = 0;
     if ( (signed int)uNumActors > 0 )
     {
-      flagsc = pActors;//[0].uAIState;
+      flagsc = pActors.data();//[0].uAIState;
       do
       {
 		v39 = flagsc->uAIState;
--- a/VectorTypes.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/VectorTypes.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 typedef unsigned __int32 uint;
 
--- a/VideoPlayer.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/VideoPlayer.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -481,30 +481,30 @@
   GetDllVersion(L"BINKW32.DLL", &uBinkVersionMajor, &uBinkVersionMinor);
   uBinkVersion = (unsigned __int64)uBinkVersionMajor << 32 | uBinkVersionMinor;
 
-  strcpy(pTmpBuf, "anims\\might7.vid");
+  strcpy(pTmpBuf.data(), "anims\\might7.vid");
   hMightVid = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
   if ( hMightVid == INVALID_HANDLE_VALUE )
   {
-    sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf);
-    MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
+    sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
+    MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
     return;
   }
-  strcpy(pTmpBuf, "anims\\magic7.vid");
+  strcpy(pTmpBuf.data(), "anims\\magic7.vid");
   hMagicVid = CreateFileW(L"anims\\magic7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
   if ( hMagicVid == INVALID_HANDLE_VALUE )
   {
     if ( !bCanLoadFromCD )
       {
-       sprintf(pTmpBuf2, "Can't open file - anims\\%s.smk", pTmpBuf);
-       MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
+       sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
+       MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
        return;
 	  }
-    sprintf(pTmpBuf2, "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf);
-    hMagicVid = CreateFileA(pTmpBuf2, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
+    sprintf(pTmpBuf2.data(), "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf.data());
+    hMagicVid = CreateFileA(pTmpBuf2.data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
     if ( hMagicVid == (HANDLE)INVALID_HANDLE_VALUE )
     {
-	  sprintf(pTmpBuf2, "Can't open file - %s", pTmpBuf);
-      MessageBoxA(0, pTmpBuf2, "Video File Error", 0);
+	  sprintf(pTmpBuf2.data(), "Can't open file - %s", pTmpBuf.data());
+      MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
       return;
     }
   }
@@ -975,9 +975,9 @@
     if ( !v5 )
     {
       v3->Unload();
-      sprintf(pTmpBuf, "Can't load %s", &Str2);
+      sprintf(pTmpBuf.data(), "Can't load %s", &Str2);
       v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937";
-      MessageBoxA(nullptr, pTmpBuf, v15, 0);
+      MessageBoxA(nullptr, pTmpBuf.data(), v15, 0);
       return;
     }
     v16 = (int)pMovieName;
--- a/Viewport.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Viewport.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -180,61 +180,59 @@
 
 //----- (00443365) --------------------------------------------------------
 void ViewingParams::_443365()
-    {
-  
-    Vec3_short_ *v3; // eax@4
-    Vec3_short_ *v6; // eax@12
-    int minimum_y; // [sp+10h] [bp-10h]@2
-    int maximum_y; // [sp+14h] [bp-Ch]@2
-    int minimum_x; // [sp+18h] [bp-8h]@2
-     int maximum_x; // [sp+1Ch] [bp-4h]@2
+{
+  Vec3_short_ *v3; // eax@4
+  Vec3_short_ *v6; // eax@12
+  int minimum_y; // [sp+10h] [bp-10h]@2
+  int maximum_y; // [sp+14h] [bp-Ch]@2
+  int minimum_x; // [sp+18h] [bp-8h]@2
+  int maximum_x; // [sp+1Ch] [bp-4h]@2
 
- 
-    InitGrayPalette();
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-        {
-        minimum_x = 0x40000000;
-        minimum_y = 0x40000000;
+  InitGrayPalette();
+  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+  {
+    minimum_x = 0x40000000;
+    minimum_y = 0x40000000;
 
-        maximum_x = -0x40000000;
-        maximum_y = -0x40000000;
-        for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i)
-            {
-            v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID];
+    maximum_x = -0x40000000;
+    maximum_y = -0x40000000;
+    for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i)
+    {
+      v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID];
 
-            if ( v3->x < minimum_x )
-                minimum_x = v3->x;
-            if ( v3->x > maximum_x )
-                maximum_x = v3->x;
-            if ( v3->y < minimum_y )
-                minimum_y = v3->x;
-            if ( v3->y > maximum_y )
-                maximum_y = v3->x;
+      if ( v3->x < minimum_x )
+        minimum_x = v3->x;
+      if ( v3->x > maximum_x )
+        maximum_x = v3->x;
+      if ( v3->y < minimum_y )
+        minimum_y = v3->x;
+      if ( v3->y > maximum_y )
+        maximum_y = v3->x;
 
-            v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID];
+      v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID];
+
+      if ( v6->x < minimum_x )
+        minimum_x = v3->x;
+      if ( v6->x > maximum_x )
+        maximum_x = v3->x;
 
-            if ( v6->x < minimum_x )
-                minimum_x = v3->x;
-            if ( v6->x > maximum_x )
-                maximum_x = v3->x;
- 
-            if ( v6->y < minimum_y )
-                minimum_y = v3->y;
-            if ( v6->y > maximum_y )
-                maximum_y = v3->y;
-            }
+      if ( v6->y < minimum_y )
+        minimum_y = v3->y;
+      if ( v6->y > maximum_y )
+        maximum_y = v3->y;
+    }
 
-        uMinimapZoom = 1024;
-        indoor_center_x = (signed int)(minimum_x + maximum_x) / 2;
-        field_28 = 10;
-        indoor_center_y = (signed int)(minimum_y + maximum_y) / 2;
-        }
-    else
-        {
-        indoor_center_x = 0;
-        indoor_center_y = 0;
-        uMinimapZoom = _576E2C_current_minimap_zoom;
-        field_28 = dword_576E28;
-        }
-    field_2C = 384;
-    }
\ No newline at end of file
+    uMinimapZoom = 1024;
+    indoor_center_x = (signed int)(minimum_x + maximum_x) / 2;
+    field_28 = 10;
+    indoor_center_y = (signed int)(minimum_y + maximum_y) / 2;
+  }
+  else
+  {
+    indoor_center_x = 0;
+    indoor_center_y = 0;
+    uMinimapZoom = _576E2C_current_minimap_zoom;
+    field_28 = dword_576E28;
+  }
+  field_2C = 384;
+}
\ No newline at end of file
--- a/Vis.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/Vis.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -619,10 +619,10 @@
     return false;
 
   if (uModelID != -1)
-    ODM_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a, intersect_face_vertex_coords_list_b,
+    ODM_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a.data(), intersect_face_vertex_coords_list_b.data(),
                                 &IntersectPoint, pFace, uModelID);
   else
-    BLV_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a, intersect_face_vertex_coords_list_b,
+    BLV_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a.data(), intersect_face_vertex_coords_list_b.data(),
                                   &IntersectPoint, pFace);
   v5 = 2 * pFace->uNumVertices;
   v16 = 0;
--- a/mm7_1.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_1.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -383,14 +383,14 @@
   v18 = (signed __int64)__PAIR__(v4, v5) % 60;
   v17 = (signed __int64)__PAIR__(v6, v7) % 60;
   v9 = v8 % 24;
-  strcpy(pTmpBuf, "\r020");
+  strcpy(pTmpBuf.data(), "\r020");
   if ( (unsigned int)v8 / 0x18 )
   {
     v10 = pGlobalTXT_LocalizationStrings[57];   // Days
     if ( v19 <= 1 )
       v10 = pGlobalTXT_LocalizationStrings[56]; // Day
-    sprintfex(pTmpBuf2, "%d %s ", (int)v19, v10);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v19, v10);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v9 )
   {
@@ -398,8 +398,8 @@
       v11 = pGlobalTXT_LocalizationStrings[109];// Hour
     else
       v11 = pGlobalTXT_LocalizationStrings[110];// Hours
-    sprintfex(pTmpBuf2, "%d %s ", (int)v9, v11);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v9, v11);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v17 && !v19 )
   {
@@ -407,8 +407,8 @@
       v12 = pGlobalTXT_LocalizationStrings[437];// Minute
     else
       v12 = pGlobalTXT_LocalizationStrings[436];// Minutes
-    sprintfex(pTmpBuf2, "%d %s ", (int)v17, v12);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v17, v12);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
   if ( v18 && !v9 )
   {
@@ -416,10 +416,10 @@
       v13 = pGlobalTXT_LocalizationStrings[439];// Second
     else
       v13 = pGlobalTXT_LocalizationStrings[438];// Seconds
-    sprintfex(pTmpBuf2, "%d %s ", (int)v18, v13);
-    strcat(pTmpBuf, pTmpBuf2);
+    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v18, v13);
+    strcat(pTmpBuf.data(), pTmpBuf2.data());
   }
-  a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0);
+  a1->DrawText(a2, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
 }
 
 //----- (0041F54A) --------------------------------------------------------
@@ -430,8 +430,8 @@
   if ( pTexture_RestUI_CurrentHourglassFrame )
     pTexture_RestUI_CurrentHourglassFrame->Release();
   pIcons_LOD->SyncLoadedFilesCount();
-  sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour);
-  pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+  sprintf(pTmpBuf.data(), "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour);
+  pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
 }
 
 //----- (0041F5BE) --------------------------------------------------------
@@ -532,7 +532,7 @@
   {
     if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 )
     {
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold!
+      sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold!
     }
     else
     {
@@ -601,11 +601,11 @@
       v3 = (signed int)(v4 * v3 / 100) / 100;
       if ( v3 < 1 )
         v3 = 1;
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)!
+      sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)!
     }
     else
     {
-      sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold!
+      sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold!
     }
     v2 = 0;
   }
@@ -613,7 +613,7 @@
   pUIAnim_Gold->uAnimTime = v2;
   pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
   if ( pTmpBuf2[0] )
-    ShowStatusBarString(pTmpBuf2, 2u);
+    ShowStatusBarString(pTmpBuf2.data(), 2u);
   pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2);
 }
 
@@ -923,8 +923,8 @@
       }
       else
       {
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
-        ShowStatusBarString(pTmpBuf2, 2u);
+        sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
+        ShowStatusBarString(pTmpBuf2.data(), 2u);
         if ( v22->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
         if ( v22->uItemID == 455 )
@@ -1084,7 +1084,7 @@
           if ( v20 )
           {
             pParty->uFlags |= 2u;
-            strcpy(byte_5B0938, v20);
+            strcpy(byte_5B0938.data(), v20);
             sub_4451A8_press_any_key(0, 0, 0);
           }
         }
@@ -1487,7 +1487,7 @@
 //----- (00423B5D) --------------------------------------------------------
 int __fastcall sub_423B5D(unsigned int uFaceID)
 {
-  BLVFace *v1; // ebx@1
+  BLVFace *pFace; // ebx@1
   Vec3_short_ *v2; // esi@1
   //int v3; // ST28_4@1
   __int16 v4; // ST2C_2@1
@@ -1577,45 +1577,39 @@
   signed int id; // [sp+24h] [bp-4h]@51
   signed int ie; // [sp+24h] [bp-4h]@61
 
-  v1 = &pIndoor->pFaces[uFaceID];
+  pFace = &pIndoor->pFaces[uFaceID];
   //this = pGame->pIndoorCameraD3D;
-  v2 = &pIndoor->pVertices[v1->pVertexIDs[0]];
+  v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]];
   //v3 = *(_DWORD *)&v2->x;
   v4 = v2->z;
   //v5 = 0;
-  if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x)
-     + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y)
-     + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 )
+  if ( pFace->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x)
+     + pFace->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y)
+     + pFace->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 )
   {
     stru_50B700.field_0 = 1;
   }
   else
   {
     stru_50B700.field_0 = 0;
-    if ( !v1->Portal() )
+    if ( !pFace->Portal() )
       return 0;
   }
   //v66 = v1->uNumVertices;
-  for (uint i = 0; i < v1->uNumVertices; ++i)
+  for (uint i = 0; i < pFace->uNumVertices; ++i)
   {
-      auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]];
-      pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(
-        v6->x,
-        v6->y,
-        v6->z,
-        &stru_50B700._view_transformed_xs[i],
-        &stru_50B700._view_transformed_zs[i],
-        &stru_50B700._view_transformed_ys[i],
-        0);
+      auto v6 = &pIndoor->pVertices[pFace->pVertexIDs[i]];
+      pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(v6->x, v6->y, v6->z,
+        &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0);
   }
 
   //v7 = v1->uNumVertices;
   //v8 = 0;
-  if (v1->uNumVertices <= 0)
+  if (pFace->uNumVertices <= 0)
     return 0;
 
   bool bFound = false;
-  for (uint i = 0; i < v1->uNumVertices; ++i)
+  for (uint i = 0; i < pFace->uNumVertices; ++i)
     if (stru_50B700._view_transformed_xs[i] >= 0x80000u)
     {
       bFound = true;
@@ -1625,12 +1619,12 @@
     return 0;
 
   v79 = 0;
-  stru_50B700._view_transformed_xs[v1->uNumVertices] = stru_50B700._view_transformed_xs[0];
-  stru_50B700._view_transformed_zs[v1->uNumVertices] = stru_50B700._view_transformed_zs[0];
-  stru_50B700._view_transformed_ys[v1->uNumVertices] = stru_50B700._view_transformed_ys[0];
+  stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0];
+  stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0];
+  stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0];
   thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;
   //int i = 1;
-  for (uint i = 1; i <= v1->uNumVertices; ++i)
+  for (uint i = 1; i <= pFace->uNumVertices; ++i)
   {
       v10 = stru_50B700._view_transformed_xs[i];
       v81 = v10 >= (signed int)0x80000u;
@@ -2234,8 +2228,8 @@
   //int v4; // edi@1
   //BspRenderer_stru2 *v5; // ebx@1
   int v6; // eax@3
-  int v7; // esi@5
-  int v8; // edx@5
+  int min_y; // esi@5
+  int max_y; // edx@5
   //int v9; // ecx@6
   int v10; // eax@12
   //int v11; // edi@13
@@ -2308,9 +2302,9 @@
   //return true;
   if ( pNumVertices <= 1 )
     return false;
-  v7 = stru_50B700._screen_space_y[0];
+  min_y = stru_50B700._screen_space_y[0];
   v65 = 0;
-  v8 = stru_50B700._screen_space_y[0];
+  max_y = stru_50B700._screen_space_y[0];
   if ( !stru_50B700.field_0 )
   {
     v63 = 1;
@@ -2324,23 +2318,23 @@
 
   for ( v6 = 1; v6 < pNumVertices; ++v6 )
   {
-    if ( stru_50B700._screen_space_y[v6] >= v7 )
+    if ( stru_50B700._screen_space_y[v6] >= min_y )
     {
-      if ( stru_50B700._screen_space_y[v6] > v8 )
-        v8 = stru_50B700._screen_space_y[v6];
+      if ( stru_50B700._screen_space_y[v6] > max_y )
+        max_y = stru_50B700._screen_space_y[v6];
     }
-    else
+    if ( stru_50B700._screen_space_y[v6] < min_y )
     {
       v65 = v6;
-      v7 = stru_50B700._screen_space_y[v6];
+      min_y = stru_50B700._screen_space_y[v6];
     }
   }
-  if ( v8 == v7 )
+  if ( max_y == min_y )
     return false;
 
   v10 = v65;
-  a2->_viewport_space_y = v7;
-  a2->_viewport_space_w = v8;
+  a2->_viewport_space_y = min_y;
+  a2->_viewport_space_w = max_y;
   v55 = v65;
 
   for ( v68 = 0; v68 < pNumVertices; ++v68 )
@@ -2358,7 +2352,7 @@
       v55 = v10;
       v65 = v10;
     }
-    if ( stru_50B700._screen_space_y[v10] == v8 )
+    if ( stru_50B700._screen_space_y[v10] == max_y )
       break;
   }
   v13 = v55 + v64;
@@ -2373,7 +2367,7 @@
   {
     v62 = stru_50B700._screen_space_x[v55] << 16;
     v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]);
-    a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]);
+    a2->array_18[min_y] = LOWORD(stru_50B700._screen_space_x[v55]);
   }
   v15 = v65;
   v61 = v65;
@@ -2393,7 +2387,7 @@
       v61 = v15;
       v65 = v15;
     }
-    if ( stru_50B700._screen_space_y[v15] == v8 )
+    if ( stru_50B700._screen_space_y[v15] == max_y )
       break;
   }
   v18 = v63 + v61;
@@ -2410,17 +2404,17 @@
   {
     v61 = stru_50B700._screen_space_x[v20] << 16;
     v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20];
-    a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]);
+    a2->array_3D8[max_y] = LOWORD(stru_50B700._screen_space_x[v20]);
   }
-  v22 = v7;
-  if ( v7 <= v8 )
+  v22 = min_y;
+  if ( min_y <= max_y )
   {
     //v56 = &a2->array_3D8[v7];
     //v23 = &a2->array_18[v7];
-    for ( v70 = v7; v70 <= v8; ++v70 )
+    for ( v70 = min_y; v70 <= max_y; ++v70 )
     {
       v24 = v13;
-      if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != v8 )
+      if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y )
       {
         v13 = v64 + v13;
         if ( v13 < pNumVertices )
@@ -2439,7 +2433,7 @@
         }
       }
       v29 = v18;
-      if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != v8 )
+      if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y )
       {
         v18 += v63;
         if ( v18 < pNumVertices )
@@ -2480,49 +2474,49 @@
       //++v23;
     }
   }
-  if ( v8 < a3->_viewport_space_y )
+  if ( max_y < a3->_viewport_space_y )
     return false;
-  if ( v7 > a3->_viewport_space_w )
+  if ( min_y > a3->_viewport_space_w )
     return false;
-  if ( v7 < a3->_viewport_space_y )
-    v7 = a3->_viewport_space_y;
-  if ( v8 > a3->_viewport_space_w )
-    v8 = a3->_viewport_space_w;
-  if ( v7 <= v8 )
+  if ( min_y < a3->_viewport_space_y )
+    min_y = a3->_viewport_space_y;
+  if ( max_y > a3->_viewport_space_w )
+    max_y = a3->_viewport_space_w;
+  if ( min_y <= max_y )
   {
     //a3a = (char *)a2 - (char *)a3;
     //v42 = &a3->array_3D8[v7];
     //v57 = *(__int16 *)((char *)v42 + a3a);
-    for ( v71 = v7; v71 <= v8; ++v71 )
+    for ( v71 = min_y; v71 <= max_y; ++v71 )
     {
       if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] )
         break;
       //++v57;
-      ++v7;
+      ++min_y;
       //++v42;
     }
   }
-  if ( v8 < v7 )
+  if ( max_y < min_y )
     return false;
   //a3a = (char *)a2 - (char *)a3;
   //v43 = &a3->array_3D8[v8];
   //v58 = *(__int16 *)((char *)v43 + a3a);
-  for ( v72 = v8; v72 >= v7; --v72 )
+  for ( v72 = max_y; v72 >= min_y; --v72 )
   {
     if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] )
       break;
     //--v58;
-    --v8;
+    --max_y;
     //--v43;
     //v8 = v8;
   }
-  if ( v7 >= v8 )
+  if ( min_y >= max_y )
     return false;
   //a3b = (char *)a3 - (char *)a2;
-  v59 = v7;
+  v59 = min_y;
   //v45 = &a2->array_18[v7];
   
-  for ( v46 = v8 - v7 + 1; v46; --v46 )
+  for ( v46 = max_y - min_y + 1; v46; --v46 )
   {
     //v47 = *(__int16 *)((char *)v45 + a3b);
     if ( a2->array_18[v59] < a3->array_18[v59] )
@@ -2532,18 +2526,18 @@
     ++v59;
     //++v45;
   }
-  a2->_viewport_space_y = v7;
-  a2->_viewport_space_w = v8;
-  a2->field_8 = a2->array_18[v7];
+  a2->_viewport_space_y = min_y;
+  a2->_viewport_space_w = max_y;
+  a2->field_8 = a2->array_18[min_y];
   //v48 = a2->array_3D8[v7];
-  a2->field_10 = v7;
-  a2->field_14 = v7;
-  a2->field_C = a2->array_3D8[v7];
-  v49 = v7 + 1;
-  if ( v49 <= v8 )
+  a2->field_10 = min_y;
+  a2->field_14 = min_y;
+  a2->field_C = a2->array_3D8[min_y];
+  v49 = min_y + 1;
+  if ( v49 <= max_y )
   {
     //v50 = &a2->array_3D8[v49];
-    for ( v49; v49 <= v8; ++v49 )
+    for ( v49; v49 <= max_y; ++v49 )
     {
       //v51 = a2->array_18[v49];
       if ( a2->array_18[v49] < a2->field_8 )
--- a/mm7_2.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_2.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -388,7 +388,7 @@
       v0 = 0;
       if ( (signed int)uNumActors > 0 )
 	  {
-		  v1 = pActors;//[0].uAIState;
+      v1 = pActors.data();//[0].uAIState;
 		  v7 = uNumActors;
 		  do
 		  {
@@ -879,8 +879,8 @@
         //v3 = byte_591180;
         do
         {
-          HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2], 0, 0, 0);
+          dword_5913F4[v2] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
+                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2].data(), 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           //v3 += 100;
@@ -1085,8 +1085,8 @@
       uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
       uNumSeconds = 0;
       a3 = 0;
-      if ( pMapStats->GetMapInfo(pCurrentMapName) )
-        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
+      if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
+        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm;
       party_reputation = GetPartyReputation();
       if (pPlayers[uActiveCharacter]->CanSteal())
       {
@@ -1285,13 +1285,13 @@
   {
 	v4 = pClassNames[v3->classType];
     v5 = v3->GetBaseLevel();
-	sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4);
+	sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4);
     pWindow.DrawTitleText(
       pFont,
       1u,
       v20 * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46,
       1u,
-      pTmpBuf,
+      pTmpBuf.data(),
       3u);
 	v23 += i->uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
     ++v20;
@@ -1302,7 +1302,7 @@
   v23 = (signed __int64)v23 / v19;
   v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xCu, 0);
   pWindow.DrawTitleText(pFont, 1u, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1u, v6, 0);
-  strcpy(pTmpBuf, pGlobalTXT_LocalizationStrings[37]);
+  strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);
   v7 = pGlobalTXT_LocalizationStrings[56];
   if ( v17 != 1 )
     v7 = pGlobalTXT_LocalizationStrings[57];
@@ -1312,11 +1312,11 @@
   v9 = pGlobalTXT_LocalizationStrings[245];
   if ( v14 != 1 )
     v9 = pGlobalTXT_LocalizationStrings[132];
-  sprintf(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
-  strcat(pTmpBuf, pTmpBuf2);
-  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u);
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23);
-  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u);
+  sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
+  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u);
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
+  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3u);
   BYTE1(dword_6BE364_game_settings_1) |= 0x40u;
   pRenderer->EndScene();
   pRenderer->Present();
@@ -2728,7 +2728,7 @@
   v20 = uNumActors;
   if ( (signed int)uNumActors > 0 )
   {
-    v4 = pActors;//[0].uAIState;
+    v4 = pActors.data();//[0].uAIState;
     while ( v4->uAIState != Removed )
     {
       ++v3; 
@@ -3059,7 +3059,7 @@
   v2 = 0;
   if ( (signed int)uNumActors <= 0 )
     goto LABEL_8;
-  v3 = pActors;
+  v3 = pActors.data();
   while ( 1 )
   {
     v22 = v3->pMonsterInfo.uID - 1;
@@ -3306,7 +3306,7 @@
   uint decorEventIdx = 0;
   for (uint i = 0; i < uNumLevelDecorations; ++i)
   {
-    auto decor = pLevelDecorations + i;
+    auto decor = &pLevelDecorations[i];
 
     if (!decor->field_16_event_id)
     {
@@ -3769,50 +3769,23 @@
 //----- (00452969) --------------------------------------------------------
 stru193_math::stru193_math()
 {
-  stru193_math *v1; // esi@1
-  char *v2; // edi@1
   double v3; // ST18_8@2
-  signed int v4; // edx@3
-  int v5; // eax@4
-  int v6; // ecx@4
-  signed int v7; // [sp+20h] [bp-4h]@1
-
-  v1 = this;
-  this->uIntegerDoublePi = 2048;
-  this->uIntegerPi = 1024;
-  this->uIntegerHalfPi = 512;
-  this->uDoublePiMask = 2047;
-  this->uPiMask = 1023;
-  this->uHalfPiMask = 511;
+
   this->pTanTable[0] = 0;
   this->pCosTable[0] = 65536;
   this->pInvCosTable[0] = 65536;
-  v7 = 1;
-  v2 = (char *)&this->pInvCosTable[1];
-  do
-  {
-    v3 = (double)v7 * 3.141592653589793 * 0.0009765625;
-    *((int *)v2 - 1040) = (signed __int64)(tan(v3) * (double)v1->pCosTable[0] + 0.5);
-    *((int *)v2 - 520) = (signed __int64)(cos(v3) * (double)v1->pCosTable[0] + 0.5);
-    ++v7;
-    *(int *)v2 = (signed __int64)(1.0 / cos(v3) * (double)v1->pCosTable[0] + 0.5);
-    v2 += 4;
-  }
-  while ( v7 < (signed int)v1->uIntegerHalfPi );
-  v4 = v1->uIntegerHalfPi;
-  if ( v4 < 520 )
-  {
-    v5 = (int)&v1->pCosTable[v4];
-    v6 = 520 - v4;
-    do
-    {
-      *(int *)v5 = 0;
-      *(int *)(v5 + 2080) = 0xEFFFFFFFu;
-      *(int *)(v5 - 2080) = 0xEFFFFFFFu;
-      v5 += 4;
-      --v6;
-    }
-    while ( v6 );
+  for(int i = 1; i < (signed int)this->uIntegerHalfPi; i++)
+  {
+    v3 = (double)i * 3.141592653589793 / (double)uIntegerPi;
+    pTanTable[i] = (signed __int64)(tan(v3) * (double)this->pCosTable[0] + 0.5);
+    pCosTable[i] = (signed __int64)(cos(v3) * (double)this->pCosTable[0] + 0.5);
+    pInvCosTable[i] = (signed __int64)(1.0 / cos(v3) * (double)this->pCosTable[0] + 0.5);
+  }
+  for(int i = this->uIntegerHalfPi; i < 520; i++)
+  {
+    this->pTanTable[i] = 0xEFFFFFFFu;
+    this->pCosTable[i] = 0;
+    this->pInvCosTable[i] = 0xEFFFFFFFu;
   }
 }
 
@@ -5108,7 +5081,7 @@
   char Drive[4]; // [sp+408h] [bp-8h]@1
   int DstBuf; // [sp+40Ch] [bp-4h]@2
 
-  strcpy(a1, pCurrentMapName);
+  strcpy(a1, pCurrentMapName.data());
   _splitpath(a1, Drive, Dir, Filename, Ext);
   sprintf(a1, "levels\\%s%s", Filename, ".lod");
   v0 = fopen(a1, "rb");
@@ -5222,7 +5195,7 @@
   pGameLoadingUI_ProgressBar->Reset(0x1Bu);
   pSoundList->_4A9D79(0);
   uCurrentlyLoadedLevelType = (LEVEL_TYPE)2;
-  ODM_LoadAndInitialize(pCurrentMapName, v3);
+  ODM_LoadAndInitialize(pCurrentMapName.data(), v3);
   if ( !v2 )
     TeleportToStartingPoint(uLevel_StartingPointType);
   viewparams->_443365();
@@ -5264,13 +5237,13 @@
   //v1 = 0;
   dword_5C6DF8 = 1;
   pNPCStats->uNewlNPCBufPos = 0;
-  v19 = pMapStats->GetMapInfo(pCurrentMapName);
+  v19 = pMapStats->GetMapInfo(pCurrentMapName.data());
 
   //v15 = 0;
   for (uint i = 0; i < uNumActors; ++i)
   //if ( (signed int)uNumActors > 0 )
   {
-    auto pActor = pActors + i;
+    auto pActor = &pActors[i];
     //v2 = (char *)&pActors[0].uNPC_ID;
     //do
     //{
@@ -5322,7 +5295,7 @@
 
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto pActor = pActors + i;
+    auto pActor = &pActors[i];
     //v7 = (char *)&pActors[0].pMonsterInfo;
     //do
     //{
@@ -5421,7 +5394,7 @@
   result = 0;
   if ( (signed int)uNumLevelDecorations > 0 )
   {
-    v4 = pLevelDecorations;
+    v4 = pLevelDecorations.data();
     do
     {
       if ( v4->uDecorationDescID == v2 )
@@ -5491,7 +5464,7 @@
   ofn.lCustData = 0;
   ofn.lpfnHook = 0;
   ofn.lpTemplateName = 0;
-  ofn.lpstrFileTitle = pTmpBuf;
+  ofn.lpstrFileTitle = pTmpBuf.data();
 }
 
 //----- (004627B7) --------------------------------------------------------
@@ -6117,7 +6090,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6140,7 +6113,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6163,7 +6136,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6186,7 +6159,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6212,7 +6185,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6235,7 +6208,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6258,7 +6231,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6281,7 +6254,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6304,7 +6277,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6331,7 +6304,7 @@
           //goto LABEL_181;
           if ( wParam == 27 )
           {
-            pArcomageGame->field_F5 = 1;
+            pArcomageGame->GameOver = 1;
             pArcomageGame->field_F4 = 1;
             pArcomageGame->uGameResult = 2;
             pArcomageGame->field_B0 = -2;
@@ -6356,7 +6329,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6379,7 +6352,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6402,7 +6375,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6425,7 +6398,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6451,7 +6424,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6474,7 +6447,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6497,7 +6470,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6520,7 +6493,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6543,7 +6516,7 @@
             //goto LABEL_181;
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6566,7 +6539,7 @@
 //LABEL_181:
             if ( wParam == 27 )
             {
-              pArcomageGame->field_F5 = 1;
+              pArcomageGame->GameOver = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
@@ -6591,7 +6564,7 @@
     //goto LABEL_181;
     if ( wParam == 27 )
     {
-      pArcomageGame->field_F5 = 1;
+      pArcomageGame->GameOver = 1;
       pArcomageGame->field_F4 = 1;
       pArcomageGame->uGameResult = 2;
       pArcomageGame->field_B0 = -2;
@@ -6800,7 +6773,7 @@
   pEventTimer->Pause();
   pMiscTimer->Pause();
   pParty->uFlags = 2;
-  pCastSpellInfo->_427D48(1);
+  pCastSpellInfo.data()->_427D48(1);
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   DoPrepareWorld(0, (v1 == 0) + 1);
   pMiscTimer->Resume();
@@ -6845,7 +6818,7 @@
 //----- (00464839) --------------------------------------------------------
 char __cdecl Is_out15odm_underwater()
 {
-  return _stricmp(pCurrentMapName, "out15.odm") == 0;
+  return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
@@ -6872,12 +6845,12 @@
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   pDecalBuilder->Reset(0);
   pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2);
-  strcpy(Str1, pCurrentMapName);
+  strcpy(Str1, pCurrentMapName.data());
   v3 = strtok(Str1, ".");
   strcpy(Str1, v3);
   Level_LoadEvtAndStr(Str1);
   LoadLevel_InitializeLevelEvt();
-  strcpy(Str1, pCurrentMapName);
+  strcpy(Str1, pCurrentMapName.data());
   _strrev(Str1);
   strtok(Str1, ".");
   _strrev(Str1);
@@ -6885,11 +6858,11 @@
   for (uint i = 0; i < 1000; ++i)
     pSpriteObjects[i].uObjectDescID = 0;
 
-  v5 = pMapStats->GetMapInfo(pCurrentMapName);
+  v5 = pMapStats->GetMapInfo(pCurrentMapName.data());
   bUnderwater = 0;
   uLevelMapStatsID = v5;
   pGame->uFlags2 &= 0xFFFFFFF7u;
-  if ( !_stricmp(pCurrentMapName, "out15.odm") )
+  if ( !_stricmp(pCurrentMapName.data(), "out15.odm") )
   {
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
@@ -6901,7 +6874,7 @@
     PrepareToLoadBLV(v9);
   pAudioPlayer->SetMapEAX();
   sub_461103();
-  if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") )
+  if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") )
   {
     //spawning grounds & good analogue - no loot & exp from monsters
 
@@ -7910,8 +7883,8 @@
   for (uint i = 0; i < 5; ++i)
     for (uint j = 0; j < 6; ++j)
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
-      remove(pTmpBuf);
+      sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
+      remove(pTmpBuf.data());
     }
 
   Initialize_GamesLOD_NewLOD();
@@ -8156,7 +8129,7 @@
           pParty->Reset();
           pOtherOverlayList->Reset();
 
-          strcpy(pCurrentMapName, pStartingMapName);
+          strcpy(pCurrentMapName.data(), pStartingMapName.data());
           pParty->CreateDefaultParty(0);
           PlayerCreationUI_Initialize();
           if ( PlayerCreationUI_Loop() )
@@ -8212,13 +8185,13 @@
             break;
           }
           _chdir("..\\");
-          strcpy(pCurrentMapName, ofn.lpstrFileTitle);
+          strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle);
           pMouse->Activate(1);
         }
 //LABEL_48:
         pGame->Loop();
 LABEL_49:
-        if ( uGameState == GAME_STATE_3 )
+        if ( uGameState == GAME_STATE_LOADING_GAME )
         {
           SetCurrentMenuID(MENU_5);
           uGameState = GAME_STATE_PLAYING;
@@ -8306,17 +8279,17 @@
 
   wchar_t pStartingMapNameW[1024];
   GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
-  sprintf(pStartingMapName, "%S", pStartingMapNameW);
+  sprintf(pStartingMapName.data(), "%S", pStartingMapNameW);
 
   v9 = 0;
-  if ( strlen(pStartingMapName) )
+  if ( strlen(pStartingMapName.data()) )
   {
     do
     {
       if ( pStartingMapName[v9] == 32 )
         pStartingMapName[v9] = 0;
       ++v9;
-      v2 = strlen(pStartingMapName);
+      v2 = strlen(pStartingMapName.data());
     }
     while ( v9 < v2 );
   }
@@ -8355,7 +8328,7 @@
 
   wchar_t pDefaultSkyTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
-  sprintf(pDefaultSkyTexture, "%S", pDefaultSkyTextureW);
+  sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW);
 
   wchar_t pDefaultGroundTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename);
@@ -8371,7 +8344,7 @@
   flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667;
 
   v3 = 0;
-  if ( strlen(pDefaultSkyTexture) )
+  if ( strlen(pDefaultSkyTexture.data()) )
   {
     do
     {
@@ -8379,7 +8352,7 @@
         pDefaultSkyTexture[v3] = 0;
       ++v3;
     }
-    while ( v3 < strlen(pDefaultSkyTexture) );
+    while ( v3 < strlen(pDefaultSkyTexture.data()) );
   }
   v4 = 0;
   if ( strlen(pDefaultGroundTexture) )
@@ -8469,11 +8442,11 @@
   va_start(va, Format);
   if ( !pRenderer->bWindowMode )
     pRenderer->ChangeBetweenWinFullscreenModes();
-  vsprintf(pTmpBuf, Format, va);
+  vsprintf(pTmpBuf.data(), Format, va);
   if ( pMouse )
     pMouse->Activate(0);
   ClipCursor(0);
-  MessageBoxA(0, pTmpBuf, "Error", 0x30u);
+  MessageBoxA(0, pTmpBuf.data(), "Error", 0x30u);
   Game_DeinitializeAndTerminate(1);
 }
 
@@ -8651,8 +8624,8 @@
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
   v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2D80, v2, v1);
-  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), format_4E2D80, v2, v1);
+  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
   a1.DrawText(
            pFontSmallnum,
            1,
@@ -9324,8 +9297,8 @@
         if ( pParty->pPickedItem.uItemID )
           return 1;
         v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
-        ShowStatusBarString(pTmpBuf2, 2u);
+        sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24);
+        ShowStatusBarString(pTmpBuf2.data(), 2u);
         if ( v19->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
         if ( v19->uItemID == 455 )
@@ -9365,7 +9338,7 @@
               if ( v16 )
               {
                 pParty->uFlags |= 2u;
-                strcpy(byte_5B0938, v16);
+                strcpy(byte_5B0938.data(), v16);
                 sub_4451A8_press_any_key(0, 0, 0);
               }
             }
@@ -9610,7 +9583,7 @@
   v19 = 0;
   if ( (signed int)uNumActors > 0 )
   {
-    v4 = pActors;//[0].uAIState;
+    v4 = pActors.data();//[0].uAIState;
     do
     {
 	  v5 = abs(v4->vPosition.x - pParty->vPosition.x);
@@ -9777,7 +9750,7 @@
 LABEL_18:
   if ( !((unsigned __int8)(v11 ^ v12) | v10) )
   {
-    v14 = dword_720020_zvalues;
+    v14 = dword_720020_zvalues.data();
     v15 = 1;
     do
     {
@@ -9922,7 +9895,7 @@
     || pParty->vPosition.y < -22528
     || pParty->vPosition.y > 22528 )
   {
-    strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
+    strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
     v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32);
     if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 )
     {
@@ -9961,7 +9934,7 @@
   v1 = this;
   if ( (signed int)uNumActors > 0 )
   {
-    v2 = pActors;//[0].vPosition.y;
+    v2 = pActors.data();//[0].vPosition.y;
     do
     {
       if ( v2->CanAct() )
--- a/mm7_3.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_3.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -1362,7 +1362,7 @@
   //v20 = 0;
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto item = pSpriteObjects + i;
+    auto item = &pSpriteObjects[i];
     //v2 = (char *)&item->uSpriteFrameID;
     //do
     //{
@@ -5273,7 +5273,7 @@
             }
           }
         }
-        sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638, dword_50B570, v12);
+        sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638.data(), dword_50B570.data(), v12);
       }
 LABEL_72:
       ++v79;
@@ -5434,7 +5434,7 @@
   v1 = (unsigned int)&array_77EC08[pOutdoorCamera->numStru148s];
   v15 = (double)pOutdoor->vSunlight.y / 65536.0;
   v16 = (double)pOutdoor->vSunlight.z / 65536.0;
-  if ( v1 > (unsigned int)array_77EC08 )
+  if ( v1 > (unsigned int)array_77EC08.data() )
   {
     v2 = (char *)&array_77EC08[0].pODMFace;
     while ( 1 )
@@ -6620,7 +6620,7 @@
   GetAlertStatus();
   if ( qword_A750D8 )
     qword_A750D8 = 0i64;
-  v2 = pMapStats->GetMapInfo(pCurrentMapName);
+  v2 = pMapStats->GetMapInfo(pCurrentMapName.data());
   v3 = 0;
   if ( v2 )
   {
@@ -7517,7 +7517,7 @@
       }
       while ( v5 < (signed int)a3->uNumVertices );
     }
-    result = sr_sub_486B4E_push_outdoor_edges(a1, dword_50B638, dword_50B570, a3);
+    result = sr_sub_486B4E_push_outdoor_edges(a1, dword_50B638.data(), dword_50B570.data(), a3);
   }
   return result;
 }
@@ -11018,10 +11018,8 @@
     pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ;
     pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY;
     pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX;
-    pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX,
-                                           pBLVRenderParams->uViewportY,
-                                           pBLVRenderParams->uViewportZ,
-                                           pBLVRenderParams->uViewportW);
+    pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY,
+                                           pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW);
     pBspRenderer->nodes[0].uFaceID = -1;
     pBspRenderer->nodes[0].viewing_portal_id = -1;
     pBspRenderer->num_nodes = 1;
@@ -11258,7 +11256,7 @@
 
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto p = pSpriteObjects + i;
+    auto p = &pSpriteObjects[i];
     if (p->uObjectDescID)
     {
       v1 = &pObjectList->pObjects[p->uObjectDescID];
@@ -11386,85 +11384,75 @@
 //----- (00440639) --------------------------------------------------------
 void AddBspNodeToRenderList(unsigned int node_id)
 {
-  //int v1; // ebx@1
-  signed int v2; // edi@1
-  BLVSector *v3; // esi@1
-
-  //v1 = sector_id;
-  v2 = 0;
-  v3 = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID];
+  BLVSector *pSector; // esi@1
+
+  pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID];
   if ( pRenderer->pRenderD3D )
   {
-    for (uint i = 0; i < v3->uNumNonBSPFaces; ++i)
+    for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i)
       //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]);
-      pBspRenderer->AddFaceToRenderList_d3d(node_id, v3->pFaceIDs[i]);
-  }
-  else
-  {
-    if ( v3->uNumNonBSPFaces > 0 )
-    {
-      do
-        pBspRenderer->AddFaceToRenderList_sw(node_id, v3->pFaceIDs[v2++]);
-      while ( v2 < v3->uNumNonBSPFaces );
-    }
-  }
-  if ( v3->field_0 & 0x10 )
-    sub_4406BC(node_id, v3->uFirstBSPNode);
+      pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]);
+  }
+  else
+  {
+    for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i)
+      pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]);
+  }
+  if ( pSector->field_0 & 0x10 )
+    sub_4406BC(node_id, pSector->uFirstBSPNode);
 }
 
 //----- (004406BC) --------------------------------------------------------
 void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode)
 {
-  BLVSector *v2; // esi@2
-  BSPNode *v3; // edi@2
-  BLVFace *v4; // eax@2
+  BLVSector *pSector; // esi@2
+  BSPNode *pNode; // edi@2
+  BLVFace *pFace; // eax@2
   int v5; // ecx@2
   __int16 v6; // ax@6
   int v7; // ebp@10
   int v8; // ebx@10
   __int16 v9; // di@18
   //int v10; // [sp+10h] [bp-Ch]@1
-  bool v11; // [sp+14h] [bp-8h]@5
-  BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1
+  //bool v11; // [sp+14h] [bp-8h]@5
+  BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1
 
   //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode);
 
   //v10 = a1;
-  v12 = &pBspRenderer->nodes[node_id];
+  node = &pBspRenderer->nodes[node_id];
   while ( 1 )
   {
-    v2 = &pIndoor->pSectors[v12->uSectorID];
-    v3 = &pIndoor->pNodes[uFirstNode];
-    v4 = &pIndoor->pFaces[v2->pFaceIDs[v3->uCoplanarOffset]];
-    v5 = v4->pFacePlane_old.dist
-       + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
-       + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
-       + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z;
-    if (v4->Portal() && v4->uSectorID != v12->uSectorID )
+    pSector = &pIndoor->pSectors[node->uSectorID];
+    pNode = &pIndoor->pNodes[uFirstNode];
+    pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]];
+    v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
+       + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;
+    if (pFace->Portal() && pFace->uSectorID != node->uSectorID )
       v5 = -v5;
-    v11 = v5 > 0;
+    //v11 = v5 > 0;
     if ( v5 <= 0 )
-      v6 = v3->uFront;
+      v6 = pNode->uFront;
     else
-      v6 = v3->uBack;
+      v6 = pNode->uBack;
     if ( v6 != -1 )
       sub_4406BC(node_id, v6);
-    v7 = v3->uCoplanarOffset;
-    v8 = v7 + v3->uCoplanarSize;
+    v7 = pNode->uCoplanarOffset;
+    v8 = v7 + pNode->uCoplanarSize;
 
     //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]);
     
     if ( pRenderer->pRenderD3D )
     {
       while ( v7 < v8 )
-        pBspRenderer->AddFaceToRenderList_d3d(node_id, v2->pFaceIDs[v7++]);
+        pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]);
     }
     else
     {
       while ( v7 < v8 )
-        pBspRenderer->AddFaceToRenderList_sw(node_id, v2->pFaceIDs[v7++]);
-    }
-    v9 = v11 ? v3->uFront : v3->uBack;
+        pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]);
+    }
+    v9 = v5 > 0 ? pNode->uFront : pNode->uBack;
     if ( v9 == -1 )
       break;
     uFirstNode = v9;
@@ -11849,7 +11837,7 @@
 
   if (sizeof(pLevelStrOffsets) != 2000)
     Log::Warning(L"pLevelStrOffsets: deserialization warning");
-  memset(pLevelStrOffsets, 0, 2000);
+  memset(pLevelStrOffsets.data(), 0, 2000);
   
   max_string_length = 0;
   string_num = 1;
@@ -11937,7 +11925,7 @@
 	{
 		auto pEvent = pLevelEVT_Index[i];
 
-		auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
+		auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
 
 		if (_evt->_e_type == EVENT_PlaySound)
 		{
@@ -12067,10 +12055,10 @@
   char pContainerName[120]; // [sp+8h] [bp-98h]@1
 
   sprintf(pContainerName, "%s.evt", pLevelName);
-  uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT, 0x2400u);
+  uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 0x2400u);
 
   sprintf(pContainerName, "%s.str", pLevelName);
-  uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr, 0x2400u);
+  uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 0x2400u);
   if (uLevelStrFileSize)
     LoadLevel_InitializeLevelStr();
 }
@@ -12424,9 +12412,9 @@
   if ( !npc_event_id )
     return 0;
   evt_seq_num = entry_line;
-  pSomeOtherEVT = pGlobalEVT;
+  pSomeOtherEVT = pGlobalEVT.data();
   uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
-  memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400);
+  memcpy(pSomeOtherEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400);
   npc_activity = 1;
   ready_to_exit = false;
   if ( uSomeOtherEVT_NumEvents <= 0 )
@@ -12785,7 +12773,7 @@
     {
       if ( (signed int)uNumActors > Standing )
       {
-        v6 = pActors;//[0].uAttributes;
+        v6 = pActors.data();//[0].uAttributes;
         do
         {
           if ( v6->uGroup == v4 )
@@ -12808,7 +12796,7 @@
       v7 = uNumActors;
       if ( (signed int)uNumActors > Standing )
       {
-        v8 = pActors;//[0].uAIState;
+        v8 = pActors.data();//[0].uAIState;
         do
         {
           if ( v8->uGroup == v4 )
@@ -12937,7 +12925,7 @@
   v16.uRadius = 32;
   v16.uKind = 3;
   v16.uIndex = v8 + 2 * v9 + v9;
-  v10 = pMapStats->GetMapInfo(pCurrentMapName);
+  v10 = pMapStats->GetMapInfo(pCurrentMapName.data());
   if ( v10 )
   {
     v11 = uNumActors;
@@ -13691,11 +13679,11 @@
   v2 = pMapName;
   pAudioPlayer->StopChannels(-1, -1);
   pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
-  if ( _stricmp(pCurrentMapName, v2) )
+  if ( _stricmp(pCurrentMapName.data(), v2) )
     SaveGame(1, 0);
 
   uGameState = GAME_STATE_2;
-  strcpy(pCurrentMapName, v2);
+  strcpy(pCurrentMapName.data(), v2);
   uLevel_StartingPointType = start_point;
 }
 // 6BE35C: using guessed type int uLevel_StartingPointType;
@@ -13731,7 +13719,7 @@
     v5 = 0;
     if ( (signed int)uNumLevelDecorations > 0 )
     {
-      v6 = pLevelDecorations;
+      v6 = pLevelDecorations.data();
       while ( v6->uDecorationDescID != (signed __int16)v4 )
       {
         ++v5;
@@ -13903,12 +13891,12 @@
   int i; // eax@1
 
   v2 = uNumSeconds;
-  strcpy(GameUI_Footer_TimedString, pString);
+  strcpy(GameUI_Footer_TimedString.data(), pString);
   GameUI_Footer_TimeLeft = 1000 * v2 + GetTickCount();
-  for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString);
+  for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
         i > 450;
-        i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString) )
-    byte_5C3427[strlen(GameUI_Footer_TimedString)] = 0;
+        i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
+    byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
 }
 
 //----- (0044C1D0) --------------------------------------------------------
@@ -13929,7 +13917,7 @@
 {
   bool result; // eax@1
 
-  result = _stricmp("nwc.blv", pCurrentMapName);
+  result = _stricmp("nwc.blv", pCurrentMapName.data());
   if ( result )
   {
     _5B65A8_npcdata_uflags_or_other = 0;
@@ -14051,7 +14039,7 @@
   ai_arrays_size = 0;
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto actor = pActors + i;
+    auto actor = &pActors[i];
 
     actor->uAttributes &= 0xFFFFFBFF;
     if (!actor->CanAct())
@@ -14227,7 +14215,7 @@
   v43 = 0;
   if ( (signed int)uNumActors > 0 )
   {
-    v0 = pActors;//[0].uAttributes;
+    v0 = pActors.data();//[0].uAttributes;
     do
     {
       BYTE1(v0->uAttributes) &= 0xFBu;
@@ -14344,7 +14332,7 @@
   ai_arrays_size = v19;
   if ( (signed int)uNumActors > 0 )
   {
-    v24 = pActors;//[0].uAttributes;
+    v24 = pActors.data();//[0].uAttributes;
     do
     {
       if ( v24->CanAct() && v24->uSectorID == v37 )
@@ -14405,8 +14393,8 @@
     v33 = 30;
     ai_arrays_size = 30;
   }
-  memcpy(ai_near_actors_ids, ai_array_4F6638_actor_ids, 4 * v33);
-  memcpy(ai_near_actors_distances, ai_array_4F5E68, 4 * ai_arrays_size);
+  memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * v33);
+  memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size);
   v34 = (unsigned int)ai_arrays_size;
   if ( ai_arrays_size > 0 )
   {
@@ -15389,7 +15377,7 @@
   v40b = v35;
   if ( v40b < v40b + ai_arrays_size )
   {
-    v34 = (int *)ai_near_actors_ids;
+    v34 = (int *)ai_near_actors_ids.data();
     do
     {
       v37 = *v34;
--- a/mm7_4.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_4.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -131,7 +131,7 @@
       v37 = 0;
       if ( (signed int)uNumActors > 0 )
       {
-        v9 = pActors;//[0].vPosition.y;
+        v9 = pActors.data();//[0].vPosition.y;
         do
         {
 		  v10 = abs(v33 - v9->vPosition.x);
@@ -795,7 +795,7 @@
   do
   {
     v24 = dword_720F20[v5 / 4];
-    v25 = *(int *)((char *)dword_720F20 + v23);
+    v25 = *(int *)((char *)dword_720F20.data() + v23);
     if ( v24 == v25 )
       goto LABEL_50;
     if ( v25 > a3 + 15 )
@@ -1442,7 +1442,7 @@
   v0 = 0;
   if ( pOutdoorCamera->numStru148s > 0 )
   {
-    v1 = array_77EC08;
+    v1 = array_77EC08.data();
     do
     {
       result = pGame->pLightmapBuilder->_45D3C7(v1);
@@ -1476,7 +1476,7 @@
   signed int v2; // eax@3
 
   v0 = 0;
-  v1 = ptr_80CA10;
+  v1 = ptr_80CA10.data();
   do
   {
     ++v0;
@@ -2402,7 +2402,7 @@
           v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE);
           if ( pParty->uFlags & 4 )
           {
-            strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]);
+            strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);
             GameUI_Footer_TimeLeft = 128;
           }
           goto LABEL_39;
@@ -2431,7 +2431,7 @@
       v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE);
       if ( pParty->uFlags & 0x200 )
       {
-        strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]);
+        strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]);
         GameUI_Footer_TimeLeft = 128;
       }
       ++v16;
@@ -3367,13 +3367,13 @@
   pPlayer = &pParty->pPlayers[v6];
   v59 = TargetColor(255, 255, 155);
   //v61 = pPlayer;
-  memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
+  memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
 
   NPCData *npc = nullptr;
   if ( dword_5C35D4 )
   {
     //__debugbreak(); // fix  
-    npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+    npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1
   }
   else
     npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
@@ -3537,8 +3537,8 @@
           {
             v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
 _continue_strcat:
-            strcat(pTmpBuf2, v11);
-            dst = strlen(pTmpBuf2);
+            strcat(pTmpBuf2.data(), v11);
+            dst = strlen(pTmpBuf2.data());
             //v64 += 2;
             i += 2;
           }
@@ -3578,7 +3578,7 @@
 
           case 23:
           {
-            v47 = pMapStats->GetMapInfo(pCurrentMapName);
+            v47 = pMapStats->GetMapInfo(pCurrentMapName.data());
             if ( v47 )
               v11 = pMapStats->pInfos[v47].pName;
             else
@@ -3727,7 +3727,7 @@
         }
       }
   }
-  return pTmpBuf2;
+  return pTmpBuf2.data();
 }
 
 //----- (0049B04D) --------------------------------------------------------
@@ -6058,7 +6058,7 @@
   v1 = *_this - 399;
   v2 = (*_this - 400) % 11 + 1;
   v11 = 4 * (*_this - 400) / 11;
-  sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
+  sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
   if ( pMouse->GetCursorPos(&a2)->y <= 320 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -6081,13 +6081,13 @@
     v5 = v13;
   if ( v4 > v5 )
     v5 = v4;
-  sprintf(pTmpBuf2, "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
+  sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
     pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431],        // "Normal"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433],        // "Expert"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432],        // "Master"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96],         // "Grand"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
-  v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
+  v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
   a1.uFrameHeight += v6;
   if ( (signed int)a1.uFrameHeight < 150 )
     a1.uFrameHeight = 150;
@@ -6100,12 +6100,12 @@
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
-  a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
+  a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
   a1.uFrameZ = a1.uFrameX + 107;
   a1.uFrameWidth = 108;
   a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
-  sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
-  a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3);
+  sprintf(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
+  a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
 }
 
 //----- (004B1784) --------------------------------------------------------
@@ -6130,12 +6130,12 @@
     v4.uFrameX = 483;
     v4.uFrameWidth = 148;
     v4.uFrameZ = 334;
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
                                                 // "%s is in no condition to %s"
                                                 // "do anything"
     v2 = TargetColor(255, 255, 0x9Bu);
-    v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0);
-    v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u);
+    v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0);
+    v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf.data(), 3u);
     result = 0;
   }
   return result;
@@ -6359,7 +6359,7 @@
   v11 = 0;
   uDialogueType = 84;
   current_npc_text = (char *)pNPCTopics[667].pText;
-  v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
+  v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
   while ( 1 )
   {
     if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
@@ -6467,7 +6467,7 @@
   //int v25; // [sp-4h] [bp-10h]@49
 
   uDialogueType = uMessageParam + 1;
-  pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+  pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
   if ( uMessageParam <= 24 )
   {
   switch ( uMessageParam )
@@ -6822,8 +6822,8 @@
       {
         if ( v31 == v14 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//    %s  %s     .
-          return pTmpBuf;
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//    %s  %s     .
+          return pTmpBuf.data();
         }
         v25 = pClassNames[v10 + 2];
       }
@@ -6831,14 +6831,14 @@
       {
         if ( v31 != v14 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//        %s.
-          return pTmpBuf;
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//        %s.
+          return pTmpBuf.data();
         }
         v25 = pClassNames[v10 + 3];
       }
     }
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//    %s     .
-    return pTmpBuf;
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//    %s     .
+    return pTmpBuf.data();
   }
   if ( !pPlayers[uActiveCharacter]->CanAct() )
     return (char *)pNPCTopics[122].pText;
@@ -7074,20 +7074,20 @@
   contract_approved = 1;
   if ( v34 == 2 )
   {
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//  ^Pr[%s]   ^Pr[%s]  ^I[%lu] ^L[;;]
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//  ^Pr[%s]   ^Pr[%s]  ^I[%lu] ^L[;;]
               pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//
-    return pTmpBuf2;
+    return pTmpBuf2.data();
   }
   if ( v34 == 3 )
   {
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//
-    return pTmpBuf2;
+    return pTmpBuf2.data();
   }
   if ( v34 == 4 )
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);// 
-  return pTmpBuf2;
+  return pTmpBuf2.data();
 }
 
 //----- (004B29F2) --------------------------------------------------------
@@ -7199,8 +7199,8 @@
     v2 = pTransitionStrings[uHouse_ExitPic];
     if ( !v2 )
     {
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
-      v2 = pTmpBuf;
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0);
+      v2 = pTmpBuf.data();
     }
     v3 = v2;
     v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0);
@@ -7209,16 +7209,16 @@
   }
   a1.uFrameWidth -= 10;
   a1.uFrameZ -= 10;
-  v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+  v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
   v6 = v58;
   v55 = TargetColor(0xE1u, 0xCDu, 0x23u);
   v7 = TargetColor(0x15u, 0x99u, 0xE9u);
   v8 = v6->uProfession;
   if ( v8 )
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
   else
-    strcpy(pTmpBuf, v6->pName);
-  a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u);
+    strcpy(pTmpBuf.data(), v6->pName);
+  a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u);
   if ( !dword_591080 )
   {
     if ( !uDialogueType )
@@ -7292,9 +7292,9 @@
           v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
           v31 = *(int *)v29;
           v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-          sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30);
-          sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
-          current_npc_text = pTmpBuf2;
+          sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30);
+          sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
+          current_npc_text = pTmpBuf2.data();
           v15 = "";
           goto LABEL_45;
         }
@@ -7335,9 +7335,9 @@
             }
             if ( uDialogueType != 84 )
               goto LABEL_49;
-            sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
-            sprintf(pTmpBuf2, current_npc_text, pTmpBuf);
-            current_npc_text = pTmpBuf2;
+            sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
+            sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
+            current_npc_text = pTmpBuf2.data();
             goto LABEL_45;
           }
           v21 = v20 - 1;
@@ -7763,7 +7763,7 @@
   NPCData *v1; // edi@1
 
   v0 = 0;
-  v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
+  v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu,  0xA9u,   0x23u,  1,  0,  UIMSG_Escape,  0,   0,
@@ -7803,15 +7803,15 @@
   {
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel"
-    pBtn_YES        = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF,     1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
-    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName, 0);
-    pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0);
+    pBtn_YES        = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF,     1, 'Y', sHouseName.data(), pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
+    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName.data(), 0);
+    pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName.data(), 0);
   }
   else
   {
-    v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)];
+    v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) )];//+ 1
     if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER )
     {
       pDialogueWindow->Release();
@@ -7819,7 +7819,7 @@
     else
     {
       for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
-        ((GUIButton *)HouseNPCData[i + 7])->Release();
+        dword_5913F4[i]->Release();
     }
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, UIMSG_Escape,  0,  0,
@@ -8240,213 +8240,7 @@
 */
 }
 
-//----- (004B6478) --------------------------------------------------------
-void sub_4B6478()
-    {
-  GUIWindow *v0; // ebx@1
-  Player *v1; // edi@1
-  unsigned int v2; // eax@1
-  signed int v3; // esi@1
-  int v4; // ebx@1
-  unsigned int v5; // esi@5
-  int v6; // edi@6
-  int result; // eax@13
-  GUIWindow *v8; // ebx@17
-  int v9; // eax@17
-  int v10; // ecx@17
-  unsigned int v11; // ecx@18
-  int v12; // eax@20
-  int v13; // eax@21
-  GUIButton *v14; // esi@27
-  int v15; // ecx@27
-  unsigned int v16; // eax@28
-  const char *v17; // ebx@29
-  int v18; // eax@29
-  unsigned int v19; // ecx@29
-  int v20; // eax@29
-  unsigned __int16 v21; // ax@29
-  unsigned __int16 v22; // ST14_2@36
-  int v23; // eax@36
-  const char *v24; // ST18_4@37
-  unsigned __int16 v25; // ST14_2@37
-  int v26; // eax@37
-  int v27; // [sp-4h] [bp-80h]@8
-  GUIWindow v28; // [sp+Ch] [bp-70h]@1
-  GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
-  unsigned int v30; // [sp+64h] [bp-18h]@1
-  int v31; // [sp+68h] [bp-14h]@1
-  int v32; // [sp+6Ch] [bp-10h]@1
-  int v33; // [sp+70h] [bp-Ch]@17
-  int v34; // [sp+74h] [bp-8h]@17
-  int v35; // [sp+78h] [bp-4h]@17
-
-  v0 = window_SpeakInHouse;
-  memcpy(&v28, window_SpeakInHouse, sizeof(v28));
-  v1 = pPlayers[uActiveCharacter];
-  v28.uFrameX = 483;
-  v28.uFrameWidth = 148;
-  v28.uFrameZ = 334;
-  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  v2 = 52 * (unsigned int)v0->ptr_1C;
-  //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
-  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
-  //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
-  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
-  v4 = v3 * (100 - v1->GetMerchant()) / 100;
-  v32 = v4;
-  if ( v4 < v3 / 3 )
-  {
-    v4 = v3 / 3;
-    v32 = v3 / 3;
-  }
-  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
-  {
-    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
-    {
-      v5 = 0;
-
-      __debugbreak();
-      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
-      __debugbreak(); // whacky condition - fix
-      if (false
-      //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
-        || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
-      {
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
-      }
-      else
-      {
-        if ( pParty->uNumGold < v4 )
-        {
-          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-          v27 = 4;
-        }
-        else
-        {
-          Party::TakeGold(v4);
-          *(short *)v6 = 1;
-          v27 = 2;
-        }
-        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
-      }
-    }
-    else
-    {
-      v5 = 0;
-    }
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
-    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
-    return; // void func
-  }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
-  {
-    v24 = pNPCTopics[171].pText;
-    v25 = v31;
-    v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
-    pDialogueWindow->pNumPresenceButton = 0;
-    return ;
-  }
-
-  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
-    return;
-  v8 = pDialogueWindow;
-  v33 = 0;
-  v34 = 0;
-  v29 = pDialogueWindow;
-  v9 = pDialogueWindow->pStartingPosActiveItem;
-  v10 = v9 + pDialogueWindow->pNumPresenceButton;
-  v35 = pDialogueWindow->pStartingPosActiveItem;
-  if ( v9 >= v10 )
-    goto LABEL_40;
-  do
-  {
-    v11 = v8->GetControl(v35)->msg_param - 36;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
-    {
-      v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
-      v33 += v12;
-      ++v34;
-    }
-    v13 = v8->pStartingPosActiveItem;
-    ++v35;
-  }
-  while ( v35 < v8->pNumPresenceButton + v13 );
-  if ( !v34 )
-  {
-LABEL_40:
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
-    strcat(pTmpBuf, "\n \n");
-    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
-    v22 = v31;
-    v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
-    return; 
-  }
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
-  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
-  v32 = (149 - v33) / v34;
-  if ( (149 - v33) / v34 > 32 )
-    v32 = 32;
-
-  v35 = v8->pStartingPosActiveItem;
-  v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
-  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
-  {
-    v33 = 2;
-    do
-    {
-      v14 = v8->GetControl(v35);
-      v15 = v14->msg_param - 36;
-      if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
-      {
-        v16 = 0;
-        if ( !v1->pActiveSkills[v15] )
-        {
-          v17 = pSkillNames[v15];
-          v14->uY = v32 + v34;
-          v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
-          v19 = v14->uY;
-          v14->uHeight = v18;
-          v20 = v19 + v18 - 1;
-          v14->uW = v20;
-          v34 = v20;
-          v21 = v31;
-          if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
-            v21 = v30;
-          v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
-          goto LABEL_34;
-        }
-      }
-      else
-      {
-        v16 = 0;
-      }
-      v14->uW = v16;
-      v14->uHeight = v16;
-      v14->uY = v16;
-LABEL_34:
-      v8 = v29;
-      ++v35;
-      ++v33;
-    }
-    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
-  }
-  return;
-}
+
 
 //----- (00405CFF) --------------------------------------------------------
 void stru262_TurnBased::End(bool bPlaySound)
@@ -8565,7 +8359,7 @@
   if ( (signed int)uNumActors > 0 )
   {
     //v3 = pActors;//[0].pActorBuffs;
-    v16 = pActors;//[0].pActorBuffs;
+    v16 = pActors.data();//[0].pActorBuffs;
 	v3 = v16->pActorBuffs;
     do
     {
@@ -8744,7 +8538,7 @@
 
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto p = pActors + i;
+    auto p = &pActors[i];
 
     if (p->uAIState == Removed ||
         p->uAIState == Disabled)
--- a/mm7_5.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_5.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -486,7 +486,7 @@
           if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
           {
             LoadGame(uLoadGameUI_SelectedSlot);
-            uGameState = GAME_STATE_3;
+            uGameState = GAME_STATE_LOADING_GAME;
           }
           stru_506E40.Release();
           continue;
@@ -613,9 +613,9 @@
           pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
           uGameMenuUI_CurentlySelectedKeyIdx = -1;
           KeyboardPageNum = 1;
-          memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
+          memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
           //*(_WORD *)KeyButtonArray[28] = 0;
-          memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
+          memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
           //v1 = "";
           //v0 = 1;
           continue;
@@ -1365,7 +1365,7 @@
                       viewparams->bRedrawGameUI = true;
                       continue;
                     case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
-                      memset(GameUI_Footer_TimedString, 0, 0xC8u);
+                      memset(GameUI_Footer_TimedString.data(), 0, 0xC8u);
                       sub_4452BB();
                       DialogueEnding();
                       pCurrentScreen = SCREEN_GAME;
@@ -1644,7 +1644,7 @@
           {
             EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
           }
-          if ( !_stricmp(byte_6BE3B0, "d05.blv") )
+          if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") )
             pParty->uTimePlayed += 1474560i64;
           continue;
         case UIMSG_TransitionWindowCloseBtn:
@@ -1664,7 +1664,7 @@
           dword_50CDC8 = 1;
           sub_42FBDD();
           pNPCData4 = (NPCData *)GetTravelTime();
-          strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
+          strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
           if ( bUnderwater != 1 && pParty->bFlying
             || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
           {
@@ -1685,7 +1685,7 @@
           {
             pParty->field_6E4 = 0;
             pParty->field_6E0 = 0;
-            pCastSpellInfo->_427D48(1);
+            pCastSpellInfo.data()->_427D48(1);
             DialogueEnding();
             pEventTimer->Pause();
             pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
@@ -1722,14 +1722,14 @@
             }
             pPaletteManager->ResetNonLocked();
             pSpriteFrameTable->ResetSomeSpriteFlags();
-            strcpy(pCurrentMapName, pOut);
-            strcpy(pLevelName, pCurrentMapName);
+            strcpy(pCurrentMapName.data(), pOut);
+            strcpy(pLevelName, pCurrentMapName.data());
             v41 = strtok(pLevelName, ".");
             strcpy(pLevelName, v41);
             Level_LoadEvtAndStr(pLevelName);
             pDecalBuilder->Reset(0);
             LoadLevel_InitializeLevelEvt();
-            uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName);
+            uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName.data());
             bUnderwater = 0;
             bNoNPCHiring = 0;
             pGame->uFlags2 &= 0xFFFFFFF7u;
@@ -1738,7 +1738,7 @@
               bUnderwater = 1;
               pGame->uFlags2 |= 8u;
             }
-            if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") )
+            if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d47.blv") )
               bNoNPCHiring = 1;
             PrepareToLoadODM(1u, (OutdoorCamera *)1);
             pAudioPlayer->SetMapEAX();
@@ -1911,7 +1911,7 @@
           dword_50CDC8 = 1;
           sub_42FBDD();
           SaveGame(1, 0);
-          strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
+          strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename);
           dword_6BE364_game_settings_1 |= 1;
           uGameState = GAME_STATE_2;
           //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
@@ -1964,27 +1964,27 @@
           uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam];
           if ( bRecallingBeacon )
           {
-            if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) )
+            if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) )
               continue;
             v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName;
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
-            GameUI_SetFooterString(pTmpBuf);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
+            GameUI_SetFooterString(pTmpBuf.data());
             continue;
           }
-          v59 = pMapStats->GetMapInfo(pCurrentMapName);
+          v59 = pMapStats->GetMapInfo(pCurrentMapName.data());
           thise = "Not in Map Stats";
           if ( v59 )
             thise = pMapStats->pInfos[v59].pName;
-          if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 )
-          {
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s"
-            GameUI_SetFooterString(pTmpBuf);
+          if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 )
+          {
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s"
+            GameUI_SetFooterString(pTmpBuf.data());
             continue;
           }
           v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName;
           v158 = (unsigned int)thise;
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
-          GameUI_SetFooterString(pTmpBuf);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_CloseAfterInstallBeacon:
           dword_50CDC8 = 1;
@@ -2017,11 +2017,11 @@
           pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0);
           if ( bRecallingBeacon )
           {
-            if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) )
+            if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) )
             {
               SaveGame(1, 0);
               OnMapLeave();
-              strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]);
+              strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]);
               dword_6BE364_game_settings_1 |= 1;
               uGameState = GAME_STATE_2;
               _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags;
@@ -2073,7 +2073,7 @@
             if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 )
               continue;
             uAction = 0;
-            while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName) )
+            while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName.data()) )
             {
               ++thisg;
               uAction += 32;
@@ -2105,7 +2105,7 @@
                 {
 LABEL_486:
                   SaveGame(1, 0);
-                  v64 = pMapStats->GetMapInfo(pCurrentMapName);
+                  v64 = pMapStats->GetMapInfo(pCurrentMapName.data());
                   v65 = uMessageParam;
                   if ( v64 == TownPortalList[uMessageParam].uMapInfoID )
                   {
@@ -2122,7 +2122,7 @@
                     OnMapLeave();
                     dword_6BE364_game_settings_1 |= 1;
                     uGameState = GAME_STATE_2;
-                    strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
+                    strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
                     dword_5B65C0 = 1;
                     _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x;
                     _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y;
@@ -2198,8 +2198,8 @@
                     default:
                     if ( uMessageParam != 5 )
                     {
-                      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200);
-                      GameUI_SetFooterString(pTmpBuf);
+                      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
+                      GameUI_SetFooterString(pTmpBuf.data());
                       continue;
                     }
                     v69 = pMapStats->pInfos[8].pName;
@@ -2210,8 +2210,8 @@
                 {
                   v69 = pMapStats->pInfos[21].pName;
                 }
-                sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69);
-                GameUI_SetFooterString(pTmpBuf);
+                sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
+                GameUI_SetFooterString(pTmpBuf.data());
                 continue;
               }
               v68 = 210;
@@ -2248,8 +2248,8 @@
                 if ( uMessageParam != 5 )
                   //goto LABEL_519;
                   {
-                    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200);
-                    GameUI_SetFooterString(pTmpBuf);
+                    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
+                    GameUI_SetFooterString(pTmpBuf.data());
                     continue;
                   }
                 v69 = pMapStats->pInfos[8].pName;
@@ -2260,14 +2260,14 @@
           {
             v69 = pMapStats->pInfos[21].pName;
           }
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69);
-          GameUI_SetFooterString(pTmpBuf);
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowFinalWindow:
-          sprintf(pFinalMessage, "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
+          sprintf(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
             pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment."
             pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."   
-          ModalWindow(pFinalMessage, 196);
+          ModalWindow(pFinalMessage.data(), 196);
           uGameState = GAME_STATE_FINAL_WINDOW;
           continue;
         case UIMSG_C4:
@@ -2276,7 +2276,7 @@
           strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
         case UIMSG_DD:
 			__debugbreak();
-          sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer);
+          sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
           memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
           if ( v216.uPropCount == 1 )
           {
@@ -2300,7 +2300,7 @@
               while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
               if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
               {
-                strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
+                strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
                 dword_6BE364_game_settings_1 |= 1u;
                 uGameState = GAME_STATE_2;
                 OnMapLeave();
@@ -2555,7 +2555,7 @@
             pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed;
             pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed;
             pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed;
-            v90 = pMapStats->GetMapInfo(pCurrentMapName);
+            v90 = pMapStats->GetMapInfo(pCurrentMapName.data());
             if ( !v90 )
               v90 = rand() % (signed int)pMapStats->uNumMaps + 1;
             pMapInfo = &pMapStats->pInfos[v90];
@@ -2620,7 +2620,7 @@
           if ( quick_spell_at_page && byte_506550 )
           {
             v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173);
           }
           else
           {
@@ -2628,9 +2628,9 @@
               v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell"
             else
               v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell"
-            strcpy(pTmpBuf, v177);
-          }
-          GameUI_SetFooterString(pTmpBuf);
+            strcpy(pTmpBuf.data(), v177);
+          }
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_SPellbook_ShowHightlightedSpellInfo:
           if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter],
@@ -2649,8 +2649,8 @@
             v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
             v161 = pGlobalTXT_LocalizationStrings[486];
           }
-          sprintfex(pTmpBuf, v161, v178);
-          GameUI_SetFooterString(pTmpBuf);
+          sprintfex(pTmpBuf.data(), v161, v178);
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ClickInstallRemoveQuickSpellBtn:
           GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
@@ -3017,8 +3017,8 @@
         case UIMSG_ShowStatus_Funds:
           v174 = (char *)pParty->uNumGoldInBank;
           v158 = pParty->uNumGold + pParty->uNumGoldInBank;
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank"
-          GameUI_SetFooterString(pTmpBuf);
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank"
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowStatus_DateTime:
           pNPCData4 = (NPCData *)pParty->uCurrentHour;
@@ -3033,30 +3033,30 @@
           }
           if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) )
             uNumSeconds = 0;
-          sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7],
+          sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7],
             7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear);
-          GameUI_SetFooterString(pTmpBuf);
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowStatus_Food:
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food"
-          GameUI_SetFooterString(pTmpBuf);
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food"
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowStatus_Player:
           pPlayer5 = pPlayers[uMessageParam];
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
-          strcat(pTmpBuf, ": ");
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
+          strcat(pTmpBuf.data(), ": ");
           v107 = pPlayer5->GetMajorConditionIdx();
-          strcat(pTmpBuf, aCharacterConditionNames[v107]);
-          GameUI_SetFooterString(pTmpBuf);
+          strcat(pTmpBuf.data(), aCharacterConditionNames[v107]);
+          GameUI_SetFooterString(pTmpBuf.data());
           v108 = 8 * uMessageParam - 8;
           LOBYTE(v108) = v108 | 4;
           pMouse->uPointingObjectID = PID(OBJECT_Player,v108);
           continue;
         case UIMSG_ShowStatus_ManaHP:
-          sprintf(pTmpBuf, "%d / %d %s    %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), 
+          sprintf(pTmpBuf.data(), "%d / %d %s    %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), 
                   pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), 
                   pGlobalTXT_LocalizationStrings[212]);
-          GameUI_SetFooterString(pTmpBuf);
+          GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_CHEST_ClickItem:
           if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
@@ -3252,7 +3252,7 @@
       }
     }
   }
-  pCastSpellInfo->_427E01_cast_spell();
+  pCastSpellInfo.data()->_427E01_cast_spell();
 }
 
 //----- (004356FF) --------------------------------------------------------
@@ -4270,7 +4270,7 @@
         uActorID = 0;
         if ( (signed int)uNumActors > 0 )
         {
-          v28 = pActors;//[0].vPosition.z;
+          v28 = pActors.data();//[0].vPosition.z;
           do
           {
             if ( v28->CanAct() )
@@ -4686,8 +4686,8 @@
         v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points"
       else
         v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage"
-      sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50);
-      ShowStatusBarString(pTmpBuf, 2u);
+      sprintfex(pTmpBuf.data(), v47, pPlayerName, pMonsterName, v50);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
     }
     v41 = 0;
   }
@@ -4735,8 +4735,8 @@
       v50 = (int)pMonster;
       pMonsterName = (char *)uDamageAmount;
       pPlayerName = player->pName;             // "%s inflicts %lu points killing %s"
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
-      ShowStatusBarString(pTmpBuf, 2u);
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
     }
   }
   if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41
@@ -4758,8 +4758,8 @@
     {
       v50 = (int)pMonster;
       pMonsterName = player->pName;            // "%s stuns %s"
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster);
-      ShowStatusBarString(pTmpBuf, 2u);
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[635], player->pName, pMonster);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
     }
   }
   if ( hit_will_paralyze != v41 )
@@ -4778,8 +4778,8 @@
         {
           v50 = (int)pMonster;
           pMonsterName = player->pName;        // "%s paralyzes %s"
-          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster);
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster);
+          ShowStatusBarString(pTmpBuf.data(), 2u);
         }
       }
     }
@@ -5099,8 +5099,8 @@
       v52 = v51;
       if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) )
       {
-		  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[637], v45->pName);
-        ShowStatusBarString(pTmpBuf, 2u);
+		  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName);
+        ShowStatusBarString(pTmpBuf.data(), 2u);
         v45->PlaySound(SPEECH_6, 0);
         return;
       }
@@ -5974,7 +5974,7 @@
 {
   for (uint i = 0; i < uNumBillboardsToDraw; ++i)
   {
-    auto p = pBillboardRenderList + i;
+    auto p = &pBillboardRenderList[i];
 
     if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID)
       p->dimming_level = 0;
@@ -8786,9 +8786,9 @@
   v6 = 0;
   v7 = 0;
   v5 = 0;
-  if ( !_stricmp(pCurrentMapName, "d25.blv") )
+  if ( !_stricmp(pCurrentMapName.data(), "d25.blv") )
     v8 = 1;
-  if ( !_stricmp(pCurrentMapName, "d26.blv") )
+  if ( !_stricmp(pCurrentMapName.data(), "d26.blv") )
     v6 = 1;
   if (_449B57_test_bit(pParty->_quest_bits, 99))
     v7 = 1;
@@ -8798,7 +8798,7 @@
   Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0;  original code behaviour is identical
   for (uint i = 0; i < uNumActors; ++i)
   {
-    auto actor = pActors + i;
+    auto actor = &pActors[i];
 
     if (actor->CanAct() || actor->uAIState == Disabled)
     {
@@ -8830,7 +8830,7 @@
 {
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
-    auto item = pSpriteObjects + i;
+    auto item = &pSpriteObjects[i];
 
     if (item->uType &&
         (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10))
@@ -8881,7 +8881,7 @@
   v8 = v2;
   if ( (signed int)uNumActors > 0 )
   {
-    v5 = pActors;
+    v5 = pActors.data();
     do
     {
       v6 = v5->uAttributes;
@@ -8918,7 +8918,7 @@
   v9 = 0;
   if ( (signed int)uNumActors > 0 )
   {
-    v4 = pActors;//[0].pMonsterInfo.uID;
+    v4 = pActors.data();//[0].pMonsterInfo.uID;
     do
     {
 	  v5 = v4->uAttributes;                // actor::attributes
@@ -8958,7 +8958,7 @@
   v9 = 0;
   if ( (signed int)uNumActors > 0 )
   {
-    v4 = pActors;//[0].uGroup;
+    v4 = pActors.data();//[0].uGroup;
     do
     {
 	  v5 = v4->uAttributes;
@@ -9227,8 +9227,8 @@
   pWindow.uFrameW = game_viewport_w;
   if ( !bRecallingBeacon )
     v1 = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
-  sprintf(pTmpBuf, "%s", v1);
-  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), "%s", v1);
+  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u);
   if ( bRecallingBeacon )
   {
     pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
@@ -9255,7 +9255,7 @@
   v27 = 0;
   if ( uNumMaxBeacons > 0 )
   {
-    v29 = pSavegameThumbnails;
+    v29 = pSavegameThumbnails.data();
     v28 = pPlayer->pInstalledBeacons;
     while ( 1 )
     {
@@ -9302,9 +9302,9 @@
       v13 = pGlobalTXT_LocalizationStrings[57]; // Days
       if ( v11 > 1 )
       {
-        sprintf(pTmpBuf, "%lu %s", v11 + 1, v13);
+        sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
         pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
         goto LABEL_29;
       }
     }
@@ -9316,16 +9316,16 @@
           v12 = pGlobalTXT_LocalizationStrings[109];// Hour
         else
           v12 = pGlobalTXT_LocalizationStrings[110];// Hours
-        sprintf(pTmpBuf, "%lu %s", v10 + 1, v12);
+        sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12);
         pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
         goto LABEL_29;
       }
     }
     v13 = pGlobalTXT_LocalizationStrings[56];   // Day
-    sprintf(pTmpBuf, "%lu %s", v11 + 1, v13);
+    sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
     pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
-    pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
+    pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
     goto LABEL_29;
   }
 LABEL_30:
@@ -9421,8 +9421,8 @@
 {
   GUIWindow v0; // [sp+4h] [bp-54h]@1
 
-  sprintf(pTmpBuf2, "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
-  v0.Hint = pTmpBuf2;
+  sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
+  v0.Hint = pTmpBuf2.data();
   v0.uFrameWidth = 400;
   v0.uFrameHeight = 100;
   v0.uFrameX = 120;
@@ -9985,8 +9985,8 @@
   }
   if ( !v0->CanAct() )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]);
-    v43.Hint = pTmpBuf;
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]);
+    v43.Hint = pTmpBuf.data();
     v43.uFrameWidth = 384;
     v43.uFrameHeight = 180;
     v43.uFrameY = 40;
@@ -10594,8 +10594,8 @@
   Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
   Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
   v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2D80, v4, v3);
-  Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), format_4E2D80, v4, v3);
+  Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
   Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
 }
 
--- a/mm7_6.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_6.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -1279,10 +1279,10 @@
     Dst.uItemID = pActor->uCarriedItemID;
     v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
     if ( v14 )
-      sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
+      sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[490], v14, v9);
     else
-      sprintfex(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], v9);
-    ShowStatusBarString(pTmpBuf2, 2u);
+      sprintfex(pTmpBuf2.data(), (char*)pGlobalTXT_LocalizationStrings[471], v9);
+    ShowStatusBarString(pTmpBuf2.data(), 2u);
     v4 = Dst.uItemID;
     v5 = Dst.uItemID;
     if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 )
@@ -1329,10 +1329,10 @@
       pActor->array_000234[3].Reset();
       v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
       if ( v14 )
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v11);
+        sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
       else
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v11);
-      ShowStatusBarString(pTmpBuf2, 2u);
+        sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v11);
+      ShowStatusBarString(pTmpBuf2.data(), 2u);
       if ( !pParty->AddItem(&Dst) )
         pParty->SetHoldingItem(&Dst);
       v13 = 1;
@@ -1348,10 +1348,10 @@
   pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
   v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
   if ( v14 )
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[490], v14, v10);
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);
   else
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v10);
-  ShowStatusBarString(pTmpBuf2, 2u);
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);
+  ShowStatusBarString(pTmpBuf2.data(), 2u);
   v8 = pParty;
   if ( !pParty->AddItem(&Dst) )
     pParty->SetHoldingItem(&Dst);
@@ -2236,7 +2236,7 @@
 
     if (a5 & 0x3CA)
     {
-      assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10);
+      assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10);
       for (uint i = 0; i < 10; ++i)
         if (pCastSpellInfo[i].field_8 & 0x3CA)
         {
@@ -2245,10 +2245,10 @@
         }
     }
       
-    assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10);
+    assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo.data()) == 10);
     for (uint i = 0; i < 10; ++i)
     {
-      auto spell = pCastSpellInfo + i;
+      auto spell = &pCastSpellInfo[i];
       if (!spell->spellnum)
         continue;
 
@@ -2264,7 +2264,7 @@
       }
     }
 
-    int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6);
+    int result = pCastSpellInfo.data()->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6);
     if ( result != -1 )
     {
       if ( a5 & 2 )
@@ -2930,7 +2930,7 @@
 			int _v733 = 0;
 			for (uint i = 0; i < uNumSpriteObjects; ++i)
 			{
-				auto object = pSpriteObjects + i;
+				auto object = &pSpriteObjects[i];
 				if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID))
 				++_v733;
 				/*v33 = (char *)&pSpriteObjects[0].field_48;
@@ -3793,7 +3793,7 @@
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
 			v700.z = 0;
 			v700.y = 0;
 			v700.x = 0;
@@ -4498,7 +4498,7 @@
 		case SPELL_WATER_LLOYDS_BEACON:
 		{
 			LODWORD(v733) = 604800 * v2;
-			if ( !_stricmp(pCurrentMapName, "d05.blv") )
+			if ( !_stricmp(pCurrentMapName.data(), "d05.blv") )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
 				pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
@@ -4765,7 +4765,7 @@
 				LODWORD(v733) = 300 * v2 + 180;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
 			++pSpellSprite.uType;
 			pSpellSprite.stru_24.Reset();
@@ -5070,13 +5070,13 @@
 				if (v683.uItemID)
 				{
 					v422 = v683.GetDisplayName();
-					sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675);
+					sprintf(pTmpBuf2.data(), "(%s), and %d gold", v422, v675);
 
 				}
 				else
 				{
 					v664 = "%d gold";
-					sprintf(pTmpBuf2, v664, v675);
+					sprintf(pTmpBuf2.data(), v664, v675);
 				}
 			}
 			else
@@ -5085,15 +5085,15 @@
 				{
 					const char *_v675 = v683.GetDisplayName();
 					v664 = "(%s)";
-					sprintf(pTmpBuf2, v664, _v675);
+					sprintf(pTmpBuf2.data(), v664, _v675);
 				}
 				else
 				{
-					strcpy(pTmpBuf2, "nothing");
-					ShowStatusBarString(pTmpBuf2, 2u);
+					strcpy(pTmpBuf2.data(), "nothing");
+					ShowStatusBarString(pTmpBuf2.data(), 2u);
 				}
 			}
-			ShowStatusBarString(pTmpBuf2, 2u);
+			ShowStatusBarString(pTmpBuf2.data(), 2u);
 			pSpellSprite.stru_24.Reset();
 			pSpellSprite.spell_id = pCastSpell->spellnum;
 			pSpellSprite.spell_level = v2;
@@ -5235,7 +5235,7 @@
 				amount = 180 * v2;
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			auto _v726 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
 			++pSpellSprite.uType;
 			pSpellSprite.stru_24.Reset();
@@ -5328,8 +5328,8 @@
 				}
 				else
 				{
-					sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
-					ShowStatusBarString(pTmpBuf2, 2u);
+					sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
+					ShowStatusBarString(pTmpBuf2.data(), 2u);
 					if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
 						pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
 				}
@@ -5629,7 +5629,7 @@
 				break;
 
 			pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
-			v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			v505 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
 			++pSpellSprite.uType;
 			//signed int _v733 = v505;
 			v688.x = 0;
@@ -5689,7 +5689,7 @@
 			signed int _v733 = 0;
 			if ( (signed int)uNumActors > 0 )
 			{
-				v518 = pActors;//[0].uAIState;
+				v518 = pActors.data();//[0].uAIState;
 				auto _v726 = uNumActors;
 				do
 				{
@@ -5749,7 +5749,7 @@
 			}
 			if ( !pPlayer->CanCastSpell(uRequiredMana) )
 				break;
-			v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
+			v531 = sub_46A6AC((int)dword_50BF30.data(), 100, 4096);
 			++pSpellSprite.uType;
 			v694.x = 0;
 			v694.y = 0;
@@ -6286,7 +6286,7 @@
 				break;
 			pGame->GetIndoorCamera();
 			v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
-			signed int _v733 = sub_46A6AC((int)dword_50BF30, 100, v623);
+			signed int _v733 = sub_46A6AC((int)dword_50BF30.data(), 100, v623);
 			v707.x = 0;
 			v707.y = 0;
 			v707.z = 0;
@@ -6655,7 +6655,7 @@
   if (!player->CanAct())
     return;
 
-  pCastSpellInfo->_427D48(uActiveCharacter);
+  pCastSpellInfo.data()->_427D48(uActiveCharacter);
     //v3 = 0;
   if (pParty->Invisible())
     pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
@@ -6929,7 +6929,7 @@
       if ( v4 > 0 )
       {
         v32 = 1;
-        v16 = (int)dword_50BC10;
+        v16 = (int)dword_50BC10.data();
         do
         {
           for ( i = v32; i < v4; ++i )
@@ -6952,7 +6952,7 @@
           v19 = v4;
           do
           {
-            *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10 - (char *)v24].field_0 >> 3) & 0x1FFF;
+            *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
             v18 += 4;
             --v19;
           }
@@ -6992,7 +6992,7 @@
   uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
   uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
   uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
-  v1 = pIconIDs_Turn;
+  v1 = pIconIDs_Turn.data();
   do
   {
     pIconsFrameTable->InitializeAnimation(*v1);
@@ -7034,7 +7034,7 @@
   }
   else
   {
-    v1 = pActors;
+    v1 = pActors.data();
     while ( 1 )
     {
 		v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x);
@@ -7652,7 +7652,7 @@
                 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
                 if ( !pParty->bTurnBasedModeOn )
                   pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
-                pCastSpellInfo->_427D48(uActiveCharacter);
+                pCastSpellInfo.data()->_427D48(uActiveCharacter);
                 pTurnEngine->_40471C();
               }
             }
--- a/mm7_data.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_data.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -37,7 +37,7 @@
 struct stru262_TurnBased *pTurnEngine = new stru262_TurnBased;
 
 #include "CastSpellInfo.h"
-CastSpellInfo pCastSpellInfo[10];
+std::array<CastSpellInfo, 10> pCastSpellInfo;
 CastSpellInfo stru_50CDB4; // idb
 
 #include "Viewport.h"
@@ -53,19 +53,19 @@
 stru298 stru_50FE08; // weak
 
 #include "Autonotes.h"
-Autonote pAutonoteTxt[195]; // weak
+std::array<Autonote, 195> pAutonoteTxt; // weak
 
 #include "Awards.h"
-Award pAwards[105];
-AwardType achieved_awards[1000];
+std::array<Award, 105> pAwards;
+std::array<AwardType, 1000> achieved_awards;
 int num_achieved_awards;
 int num_achieved_awards_2;
 
 #include "stru159.h"
 
 #include "stru160.h"
-stru160 array_4EB8B8[66] =
-{
+std::array<stru160, 66> array_4EB8B8 =
+{{
   stru160( 0.0000000f,  0.0000000f,  1.0000000f),
   stru160( 0.0000000f,  0.3826830f,  0.9238799f),
   stru160( 0.3826830f,  0.0000000f,  0.9238799f),
@@ -132,10 +132,10 @@
   stru160(-0.4082480f,  0.4082480f, -0.8164970f),
   stru160(-0.8164970f,  0.4082480f, -0.4082480f),
   stru160(-0.4082480f,  0.8164970f, -0.4082480f)
-};
-stru160 array_4EBBD0[128];
-__int32 array_4EBBD0_x[128*3] =
-{
+}};
+std::array<stru160, 128> array_4EBBD0;
+std::array<__int32, 128*3> array_4EBBD0_x =
+{{
   0x00000000, 0x00000001, 0x00000002, 0x00000001,
   0x00000003, 0x00000002, 0x00000001, 0x00000004,
   0x00000003, 0x00000003, 0x00000005, 0x00000002,
@@ -232,10 +232,10 @@
   0x00000026, 0x00000028, 0x00000041, 0x00000028,
   0x00000031, 0x00000041, 0x00000028, 0x0000000B,
   0x00000031, 0x00000031, 0x0000002D, 0x00000041
-};
+}};
 
 #include "stru220.h"
-stru220 stru_76E5C8[16384];
+std::array<stru220, 16384> stru_76E5C8;
 
 #include "stru176.h"
 stru176 array_5B5928_timers[100];
@@ -259,7 +259,7 @@
 struct UIAnimation *pUIAnum_Torchlight = &_uianim._pUIAnum_Torchlight;
 struct UIAnimation *pUIAnim_WizardEye = &_uianim._pUIAnim_WizardEye;
 
-struct UIAnimation *pUIAnims[4] =
+std::array<struct UIAnimation *, 4> pUIAnims =
 {
   &_uianim._pUIAnim_Food,
   &_uianim._pUIAnim_Gold,
@@ -275,8 +275,8 @@
 #include "MM7.h"
 
 
-stat_coord stat_string_coord[26] = //4E2940
-{
+std::array<stat_coord, 26> stat_string_coord = //4E2940
+{{
   {0x1A, 0x39, 0xDC, 0x12},
   {0x1A, 0x4A, 0xDC, 0x12},
   {0x1A, 0x5B, 0xDC, 0x12},
@@ -303,6 +303,7 @@
   {0x111, 0x116, 0xBA, 0x12},
   {0x111, 0x129, 0xBA, 0x12},
   {0x13E, 0x12, 0x89, 0x12},
+}
 };
 
 
@@ -344,10 +345,10 @@
 
 
 
-unsigned int saveload_dlg_xs[2] = {82, 0};
-unsigned int saveload_dlg_ys[2] = {60, 0};
-unsigned int saveload_dlg_zs[2] = {460, 640};
-unsigned int saveload_dlg_ws[2] = {344, 480};
+std::array<unsigned int, 2> saveload_dlg_xs = {82, 0};
+std::array<unsigned int, 2> saveload_dlg_ys = {60, 0};
+std::array<unsigned int, 2> saveload_dlg_zs = {460, 640};
+std::array<unsigned int, 2> saveload_dlg_ws = {344, 480};
 int pWindowList_at_506F50_minus1_indexing[1];
 int dword_4C9890[10]; // weak
 int dword_4C9920[16]; // weak
@@ -359,13 +360,13 @@
 int (__stdcall *off_4DAFDC)(char); // weak
 char asc_4DB724[777]; // idb
 int dword_4DBD94; // weak
-int dword_4DF380[5]={0,1024,2560,5120,10240}; // weak
+std::array<int, 5> dword_4DF380 = {{0,1024,2560,5120,10240}}; // weak
 //int dword_4DF390; // weak
 char Str2[777]; // idb
 
-char byte_4E185C; // weak
+
 
-char byte_4E185E; // weak
+
 
 
 
@@ -384,19 +385,19 @@
 char aIcons[777]; // idb
 char aPending[777]; // idb
 char aCanTFindS[777]; // idb
-char *spellbook_texture_filename_suffices[9] = {"f", "a", "w", "e", "s", "m", "b", "l", "d"}; // weak
+std::array<char *, 9> spellbook_texture_filename_suffices = {{"f", "a", "w", "e", "s", "m", "b", "l", "d"}}; // weak
 //__int16 word_4E1D3A[777]; // weak
-__int16 pTownPortalBook_xs[6] = {260, 324, 147, 385, 390,  19};
-__int16 pTownPortalBook_ys[6] = {206,  84, 182, 239,  17, 283};
-__int16 pTownPortalBook_ws[6] = { 80,  66,  68,  72,  67,  74};
-__int16 pTownPortalBook_hs[6] = { 55,  56,  65,  67,  67,  59};
+std::array<__int16, 6> pTownPortalBook_xs = {{260, 324, 147, 385, 390,  19}};
+std::array<__int16, 6> pTownPortalBook_ys = {{206,  84, 182, 239,  17, 283}};
+std::array<__int16, 6> pTownPortalBook_ws = {{ 80,  66,  68,  72,  67,  74}};
+std::array<__int16, 6> pTownPortalBook_hs = {{ 55,  56,  65,  67,  67,  59}};
 
 
-unsigned int pLloydsBeaconsPreviewXs[5] = {61, 281,  61, 281, 171}; // 004E249C
-unsigned int pLloydsBeaconsPreviewYs[5] = {84,  84, 228, 228, 155};
-unsigned int pLloydsBeacons_SomeXs[5] = {59, 279, 59, 279, 169};
-unsigned int pLloydsBeacons_SomeYs[5] = {82, 82, 226, 226, 153};
-char aSbwb00[7]; // weak
+std::array<unsigned int, 5> pLloydsBeaconsPreviewXs = {{61, 281,  61, 281, 171}}; // 004E249C
+std::array<unsigned int, 5> pLloydsBeaconsPreviewYs = {{84,  84, 228, 228, 155}};
+std::array<unsigned int, 5> pLloydsBeacons_SomeXs = {{59, 279, 59, 279, 169}};
+std::array<unsigned int, 5> pLloydsBeacons_SomeYs = {{82, 82, 226, 226, 153}};
+std::array<char, 7> aSbwb00; // weak
 char aW[2]; // idb
 char aA[2]; // idb
 char aSD[777]; // idb
@@ -475,28 +476,28 @@
 char aS100110D02dSS[777]; // idb
 int pCurrentScreen = SCREEN_VIDEO; // 004E28F8
 unsigned int uGammaPos;
-int BtnTurnCoord[8] = 
-{
+std::array<int, 8> BtnTurnCoord = 
+{{
   0xA4, 0x5D, 0x16, 0xB, 0x5, 0xD, 0x7, 0x3B,
-}; // weak
-__int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165};
-__int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7};
+}}; // weak
+std::array<__int16, 4> RightClickPortraitXmin={{0x14, 0x83, 0xF2, 0x165}};
+std::array<__int16, 4> RightClickPortraitXmax={{0x53, 0xC6, 0x138, 0x1A7}};
 void *off_4E2A12; // stat_string_control_button_count
 
-unsigned int pHealthBarPos[4] = {22, 137, 251, 366};
-unsigned int pManaBarPos[4] = {102, 217, 331, 447};
-char _4E2B21_buff_spell_tooltip_colors[80];
-unsigned char monster_popup_y_offsets[88] =
-{
-  236,  20,   0, 216,   0,   0,   0,   0,   0,   0, 206,
-   20,   0, 246, 246, 236,  10, 246,   0,   0,   0, 236,
-   10, 246,   0,   0,   0, 236, 246,   0,   0,   0, 216,
-  236,   0,   0,   0, 206, 226, 226, 226, 226, 226, 226,
-    0,   0,   0,   0,   0,   0, 236, 236, 236,  20,  20,
-   20,  10,  10,  10,  10,  10,  10, 166, 196, 216, 236,
-  236, 176, 246,   0,   0, 216,   0,   0,   0, 236,  10,
-    0,   0,   0,   0,   0,   0, 196,   0,   0,   0,   0
-};
+std::array<unsigned int, 4> pHealthBarPos = {{22, 137, 251, 366}};
+std::array<unsigned int, 4> pManaBarPos = {{102, 217, 331, 447}};
+std::array<char, 80> _4E2B21_buff_spell_tooltip_colors;
+std::array<char, 88> monster_popup_y_offsets =
+{{
+  -20,  20,   0, -40,   0,   0,   0,   0,   0,   0, -50,
+   20,   0, -10, -10, -20,  10, -10,   0,   0,   0, -20,
+   10, -10,   0,   0,   0, -20, -10,   0,   0,   0, -40,
+  -20,   0,   0,   0, -50, -30, -30, -30, -30, -30, -30,
+    0,   0,   0,   0,   0,   0, -20, -20, -20,  20,  20,
+   20,  10,  10,  10,  10,  10,  10, -90, -60, -40, -20,
+  -20, -80, -10,   0,   0, -40,   0,   0,   0, -20,  10,
+    0,   0,   0,   0,   0,   0, -60,   0,   0,   0,   0
+}};
 unsigned char hourglass_icon_idx = 12; // weak
 
 
@@ -507,53 +508,53 @@
 const char *format_4E2E10 = "%s\f%05u\t110%d\f00000 / %d\n";
 __int16 word_4E3C66[777]; // idb
 int dword_4E455C; // weak
-int dword_4E4560[6];
-int dword_4E4578[6];
-int dword_4E4590[6];
-int dword_4E45A8[6];
+std::array<int, 6> dword_4E4560;
+std::array<int, 6> dword_4E4578;
+std::array<int, 6> dword_4E4590;
+std::array<int, 6> dword_4E45A8;
 _UNKNOWN dword_4E49D4; // idb
 int dword_4E4A18[777]; // weak
 int dword_4E4A1C[777]; // weak
 int dword_4E4A40[777]; // weak
 int dword_4E4A44[777]; // weak
-float flt_4E4A80[10];
+std::array<float, 10> flt_4E4A80;
 
 
-int pPartySpellbuffsUI_XYs[14][2] =
-{
+std::array< std::array<int, 2>, 14> pPartySpellbuffsUI_XYs =
+{{
   {477, 247}, {497, 247}, {522, 247}, {542, 247}, {564, 247}, {581, 247}, {614, 247},
   {477, 279}, {497, 279}, {522, 279}, {542, 279}, {564, 279}, {589, 279}, {612, 279}
-};
-unsigned char byte_4E5DD8[14] =
-{
+}};
+std::array<unsigned char, 14> byte_4E5DD8 =
+{{
   PARTY_BUFF_FEATHER_FALL, PARTY_BUFF_RESIST_FIRE, PARTY_BUFF_RESIST_AIR, PARTY_BUFF_RESIST_WATER, PARTY_BUFF_RESIST_MIND,           PARTY_BUFF_RESIST_EARTH, PARTY_BUFF_RESIST_BODY,
   PARTY_BUFF_HEROISM,      PARTY_BUFF_HASTE,       PARTY_BUFF_SHIELD,     PARTY_BUFF_STONE_SKIN,   PARTY_BUFF_PROTECTION_FROM_MAGIC, PARTY_BUFF_IMMOLATION,   PARTY_BUFF_DAY_OF_GODS
-};
-unsigned __int8 pPartySpellbuffsUI_smthns[14] =
-{
+}};
+std::array<unsigned __int8, 14> pPartySpellbuffsUI_smthns =
+{{
   14, 1, 10, 4, 7,  2, 9,
    3, 6, 15, 8, 3, 12, 0
-};
+}};
 
-int pNPCPortraits_x[6][6] =     // 004E5E50
-{
+std::array< std::array<int, 6>, 6> pNPCPortraits_x =     // 004E5E50
+{{
   {521,   0,   0,   0,   0,  0},
   {521, 521,   0,   0,   0,  0},
   {521, 521, 521,   0,   0,  0},
   {521, 486, 564, 521,   0,  0},
   {521, 486, 564, 486, 564,  0},
   {486, 564, 486, 564, 486, 564}
-};
-int pNPCPortraits_y[6][6] =     // 004E5EE0
-{
+}};
+std::array< std::array<int, 6>, 6> pNPCPortraits_y =     // 004E5EE0
+{{
   {38,   0,   0,   0,   0,   0},
   {38, 165,   0,   0,   0,   0},
   {38, 133, 228,   0,   0,   0},
   {38, 133, 133, 228,   0,   0},
   {38, 133, 133, 228, 228,   0},
   {38,  38, 133, 133, 228, 228}
-};
-const char *pHouse_ExitPictures[11]=
+}};
+std::array<const char *, 11> pHouse_ExitPictures=
 {
 	"",
 	"ticon01",
@@ -569,7 +570,7 @@
 };
 
 int bWinNT4_0; // weak
-__int16 word_4E8152[11] = {0, 0, 0, 90, 8, 2, 70, 20, 10, 50, 30};
+std::array<__int16, 11> word_4E8152 = {0, 0, 0, 90, 8, 2, 70, 20, 10, 50, 30};
 
 stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};
 stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};
@@ -579,20 +580,20 @@
 char byte_4E94D3 = 10; // weak
 int dword_4E98BC_bApplicationActive; // weak
 //char *off_4EB080; // idb
-char *pTransitionStrings[465] = {"", nullptr};  // 004EB080
-const char *pPlayerPortraitsNames[25] =
-{
+std::array<char*, 465> pTransitionStrings = {"", nullptr};  // 004EB080
+std::array<const char*, 25> pPlayerPortraitsNames =
+{{
   "pc01-", "pc02",  "pc03", "pc04",  "pc05-",
   "pc06",  "pc07",  "pc08", "pc09-", "pc10",
   "pc11-", "pc12",  "pc13", "pc14",  "pc15",
   "pc16",  "pc17-", "pc18", "pc19",  "pc20",
   "pc21-", "pc22-", "pc23", "pc24-", "pc25-"
-};
+}};
 
 
 
-unsigned char byte_4ECF08[48][25] =      // 4ECF08
-{
+std::array< std::array<unsigned char, 25>, 48> byte_4ECF08 =      // 4ECF08
+{{
   {2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1},//1
   {2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2},//2
   {2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},//3
@@ -641,9 +642,9 @@
   {1, 1, 1, 2, 2, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 1, 2, 2},//46
   {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},//47
   {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},//48
-};
-unsigned char SoundSetAction[110][8] = // 4ED3D8
-{
+}};
+std::array<std::array<unsigned char, 8>, 110> SoundSetAction = // 4ED3D8
+{{
   { 0,  0,  0,  0,  0,  0,  0,  0},
   {38,  0,  0, 37, 38, 45,  0,  0},
   {37,  0,  0, 47, 53,  0,  0,  0},
@@ -754,10 +755,10 @@
   {39,  0,  0, 48,  0,  0,  0,  0},
   {14,  0,  0, 48,  0,  0,  0,  0},
   {17,  0,  0,  0,  0,  0,  0,  0}
-};
-__int16 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[4] = {34, 149, 264, 379};
-char byte_4ED970_skill_learn_ability_by_class_table[36][37] = 
-{
+}};
+std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing = {34, 149, 264, 379};
+std::array< std::array<char, 37>, 36> byte_4ED970_skill_learn_ability_by_class_table = 
+{{
  2, 3, 2, 3, 3, 2, 3, 4, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 0, 2, 1, 0, 1, 2, 2, 0, 3, 0, 0, 1,//Knight
  2, 3, 2, 3, 3, 2, 3, 4, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 0, 2, 1, 0, 1, 2, 2, 0, 3, 0, 0, 1,
  2, 4, 2, 3, 4, 2, 3, 4, 4, 3, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 0, 2, 1, 0, 1, 2, 2, 0, 4, 0, 0, 1,
@@ -802,17 +803,17 @@
  3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 3, 0, 0, 3, 3,
  3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 0, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3,
  3, 0, 2, 0, 0, 1, 0, 4, 0, 2, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 1, 2, 0, 3, 2, 1, 0, 0, 0, 0, 4, 0, 0, 3, 3,
-};
-int dword_4EDEA0[777]; // weak
-int dword_4EDEB4[777]; // weak
-int dword_4EDEC4[777]; // weak
+}};
+std::array<int, 777> dword_4EDEA0; // weak
+std::array<int, 777> dword_4EDEB4; // weak
+std::array<int, 777> dword_4EDEC4; // weak
 _UNKNOWN unk_4EDF40; // weak
-unsigned int pHiredNPCsIconsOffsetsX[2] = {489, 559};
-unsigned int pHiredNPCsIconsOffsetsY[2] = {152, 152};
-int dword_4EE07C[2]; // weak
+std::array<unsigned int, 2> pHiredNPCsIconsOffsetsX = {489, 559};
+std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY = {152, 152};
+std::array<int, 2> dword_4EE07C; // weak
 _UNKNOWN unk_4EE084; // weak
-__int16 word_4EE088_sound_ids[100] =
-{
+std::array<__int16, 100> word_4EE088_sound_ids =
+{{
       0, 10000, 10010, 10020, 10030, 10040, 10050, 10060, 10070, 10080,
   10090, 10100, 11000, 11010, 11020, 11030, 11040, 11050, 11060, 11070,
   11080, 11090, 11100, 12000, 12010, 12020, 12030, 12040, 12050, 12060,
@@ -823,12 +824,12 @@
   16030, 16040, 16050, 16060, 16070, 16080, 16090, 16100, 17000, 17010,
   17020, 17030, 17040, 17050, 17060, 17070, 17080, 17090, 17100, 18000,
   18010, 18020, 18030, 18040, 18050, 18060, 18070, 18080, 18090, 18100
-};
-short word_4EE150[28] =
-{
+}};
+std::array<short, 28> word_4EE150 =
+{{
    1,  2,  3,  4,  5,  7, 32, 33, 36, 37, 38, 40, 41, 42, 43, 45, 46,
   47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 60
-};
+}};
 
 int dword_4EED78; // weak
 _UNKNOWN unk_4EED80; // weak
@@ -836,36 +837,36 @@
 int dword_4EFA84; // weak
 void *off_4EFDB0; // weak
 int dword_4F031C[777]; // weak
-const char *off_4F03B8[19] =
-{
+std::array<const char *, 19> off_4F03B8 =
+{{
   "",         "WEPNTABL", "ARMORY",   "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF"
-};
+}};
 
-int guild_mambership_flags[32]={
+std::array<int, 32> guild_mambership_flags={{
    54, 54, 54, 54, 52, 52, 52, 52, 55, 55, 55, 55, 53, 53,
 	   53, 53, 58, 58, 58, 58, 57, 57, 57, 57, 56, 56,
-	   56, 56, 59, 59, 60, 60};
-__int16 word_4F0754[49];
-__int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54] =
-{
+     56, 56, 59, 59, 60, 60}};
+std::array<__int16, 49> word_4F0754;
+std::array<__int16, 54> _4F0882_evt_VAR_PlayerItemInHands_vals =
+{{
 	0x0D4, 0x270, 0x0D5, 0x21C, 0x0D6, 0x2BE, 0x0D7, 0x2BD, 0x0D8, 0x289, 
 	0x0D9, 0x258, 0x0DA, 0x2AB, 0x0DB, 0x281, 0x0DC, 0x280, 0x0DD,
 	0x284, 0x0DE, 0x285, 0x0DF, 0x283, 0x0E0, 0x282, 0x0E1, 0x27F,
 	0x0E2, 0x1E7, 0x0E3, 0x287, 0x0E4, 0x272, 0x0E5, 0x267, 0x0E6,
 	0x275, 0x0E7, 0x25A, 0x0E8, 0x2A4, 0x0E9, 0x2A5, 0x0EA, 0x2A3,
 	0x0EB, 0x25C, 0x0EC, 0x25D, 0x0ED, 0x259, 0x0F1, 0x21E
-};
-unsigned short pMaxLevelPerTrainingHallType[6] = {5, 15, 25, 25, 200, 200};
+}};
+std::array<unsigned short, 6> pMaxLevelPerTrainingHallType = {5, 15, 25, 25, 200, 200};
 
-int price_for_membership[11]={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak
+std::array<int, 11> price_for_membership={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak
 
 
-Vec2_int_ pMonsterArenaPlacements[20];
-__int16 word_4F0F30[32] ={ 4, 7, 10, 11,                                              
+std::array<Vec2_int_, 20> pMonsterArenaPlacements;
+std::array<__int16, 32> word_4F0F30 ={{ 4, 7, 10, 11,                                              
 						   4, 7, 10, 11,
 					       4, 7, 10, 11,
 						   4, 7, 10, 11,
@@ -873,28 +874,28 @@
 					       4, 7, 10, 11,
 					       4, 7, 10, 11,
 					       7, 11,
-						   7, 11};
+                 7, 11}};
 double dbl_4F2870; // weak
 int dword_4F288C; // weak
 double dbl_4F5372; // weak
 int dword_4F5428[777]; // weak
 int dword_4F542C[777]; // weak
 _UNKNOWN crtunk_4F54B8; // weak
-int dword_4F5B24_ys[777]; // idb
-int dword_4F5BF4_xs[777]; // idb
-int dword_4F5CC4_ys[777]; // idb
-int dword_4F5D98_xs[777]; // idb
-int ai_array_4F5E68[500];
-int ai_array_4F6638_actor_ids[500];
-int ai_near_actors_targets_pid[500];
+std::array<int, 777> dword_4F5B24_ys; // idb
+std::array<int, 777> dword_4F5BF4_xs; // idb
+std::array<int, 777> dword_4F5CC4_ys; // idb
+std::array<int, 777> dword_4F5D98_xs; // idb
+std::array<int, 500> ai_array_4F5E68;
+std::array<int, 500> ai_array_4F6638_actor_ids;
+std::array<int, 500> ai_near_actors_targets_pid;
 int ai_arrays_size; // weak
-int ai_near_actors_distances[500];
-unsigned int ai_near_actors_ids[500];
-int dword_4F8580[121]; // weak
+std::array<int, 500> ai_near_actors_distances;
+std::array<unsigned int, 500> ai_near_actors_ids;
+std::array<int, 121> dword_4F8580; // weak
 int dword_4FA9B0[777]; // weak
 int dword_4FA9B4[777]; // weak
 char byte_4FAA00; // weak
-__int16 am_sounds[12];
+std::array<__int16, 12> am_sounds;
 _UNKNOWN unk_4FAA20; // weak
 char byte_4FAA24; // weak
 HWND dword_4FAA28; // idb
@@ -903,12 +904,10 @@
 char byte_4FAA2E; // weak
 int amuint_4FAA34; // weak
 int amuint_4FAA38; // weak
-int amuint_4FAA3C_blt_xy[2];
-int am_uint_4FAA44_blt_xy[2];
+
 int amuint_4FAA4C; // weak
-unsigned int uCardID; // idb
-int amuint_4FAA54_blt_xy[2];
-int amuint_4FAA5C_blt_xy[2];
+
+
 int dword_4FAA64; // weak
 int dword_4FAA68; // weak
 
@@ -917,14 +916,13 @@
 char am_byte_4FAA75; // weak
 char am_byte_4FAA76; // weak
 
-int amuint_4FAA78[777]; // weak
+
 char am_byte_4FAA7C[777]; // weak
-int amuint_4FAA80[777]; // weak
-int amuint_4FAA84[777]; // weak
+
 int amuint_4FAA88[777]; // weak
 int amuint_4FAA8C[777]; // weak
 int amuint_4FAA90[777][2];
-int dword_4FABB8; // weak
+
 
 
 int amuint_4FABC4; // weak
@@ -954,13 +952,11 @@
 
 char byte_505880; // weak
 char byte_505881; // weak
-int amuint_505884; // weak
-int amuint_505888; // weak
-int amuint_50588C; // weak
+
 int dword_505890; // weak
-unsigned int pSRZBufferLineOffsets[480];
+std::array<unsigned int, 480> pSRZBufferLineOffsets;
 int areWeLoadingTexture; // weak
-char byte_506130[777]; // weak
+std::array<char, 777> byte_506130; // weak
 int dword_506338; // weak
 int dword_50633C; // idb
 signed int sRecoveryTime; // idb
@@ -984,26 +980,26 @@
 int BtnUp_flag; //BtnUp_flag
 int quick_spell_at_page; // weak
 char byte_506550; // weak
-char *aMoonPhaseNames[5];
+std::array<char *, 5> aMoonPhaseNames;
 int _506568_autonote_type; // weak
 char bRecallingBeacon; // weak
 int uLastPointedObjectID; // weak
 //unsigned __int8 bMonsterInfoUI_bDollInitialized;
-char *aSpellNames[44];
+std::array<char *, 44> aSpellNames;
 int pMainScreenNum; // weak
 int dword_506980_uW; // weak
 int dword_506984_uZ; // weak
 int dword_506988_uY; // weak
 int dword_50698C_uX; // weak
 int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68
-unsigned int pPrevVirtualCidesMapping[27];
+std::array<unsigned int, 27> pPrevVirtualCidesMapping;
 int KeyboardPageNum; // weak
-int dword_506F0C[777]; // idb
+std::array<int, 777> dword_506F0C; // idb
 int uRestUI_FoodRequiredToRest;
 int dword_506F14; // weak
 int _506F18_num_hours_to_sleep; // weak
 int dword_506F1C; // weak
-int pVisibleWindowsIdxs[20]; // weak
+std::array<int, 20> pVisibleWindowsIdxs; // weak
 int uNumVisibleWindows;
 char bFlashHistoryBook; // weak
 char bFlashAutonotesBook; // weak
@@ -1023,10 +1019,10 @@
 unsigned int uGameUIFontShadow;
 unsigned int uGameUIFontMain;
 int dword_507B00_spell_info_to_draw_in_popup; // weak
-char *aMonthNames[12];
-char *aDayNames[7];
-char *aSpellSchoolNames[9];
-char *aAttributeNames[7];
+std::array<char *, 12> aMonthNames;
+std::array<char *, 7> aDayNames;
+std::array<char *, 9> aSpellSchoolNames;
+std::array<char *, 7> aAttributeNames;
 int dword_507B94; // weak
 int dword_507B98_ctrl_pressed; // weak
 unsigned int uActiveCharacter;
@@ -1036,8 +1032,8 @@
 __int64 GameUI_RightPanel_BookFlashTimer; // weak
 int _507CD4_RestUI_hourglass_anim_controller; // weak
 int dword_507CD8; // weak
-int dword_50B570[50]; // weak
-int dword_50B638[50]; // weak
+std::array<int, 50> dword_50B570; // weak
+std::array<int, 50> dword_50B638; // weak
 stru367 stru_50B700;
 /*int stru_50B700.field_0; // weak
 int stru_50B700.field_38[777]; // idb
@@ -1057,14 +1053,14 @@
 int dword_50BAE8[777]; // weak
 int stru_50B700._xs2[3 + 45]; // weak
 int stru_50B700._xs3[48]; // weak*/
-int dword_50BC10[100]; // weak
-int dword_50BDA0[100]; // weak
-int dword_50BF30[100]; // weak
+std::array<int, 100> dword_50BC10; // weak
+std::array<int, 100> dword_50BDA0; // weak
+std::array<int, 100> dword_50BF30; // weak
 char town_portal_caster_id; // weak
 int some_active_character; // weak
 //_UNKNOWN unk_50C190; // weak
 int dword_50C968; // weak
-unsigned int pIconIDs_Turn[5];
+std::array<unsigned int, 5> pIconIDs_Turn;
 unsigned int uIconID_TurnStop;
 unsigned int uIconID_TurnHour;
 int uIconID_CharacterFrame; // idb
@@ -1086,17 +1082,17 @@
 int dword_50CDCC; // weak
 int bProcessorIsNotIntel; // weak
 Vec3_int_ layingitem_vel_50FDFC;
-char pStartingMapName[777]; // idb
-unsigned __int8 IsPlayerWearingWatersuit[5];
-char party_has_equipment[54];
-char byte_5111F6[16];
+std::array<char, 777> pStartingMapName; // idb
+std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
+std::array<char, 54> party_has_equipment;
+std::array<char, 16> byte_5111F6;
 
 int _unused000; // weak
 
-unsigned __int16 pOdmMinimap[117][137];
+std::array<std::array<unsigned __int16, 137>, 117> pOdmMinimap;
 unsigned int uNumBlueFacesInBLVMinimap;
-unsigned __int16 pBlueFacesInBLVMinimapIDs[50];
-int pTextureIDs_PartyBuffIcons[14];
+std::array<unsigned __int16, 50> pBlueFacesInBLVMinimapIDs;
+std::array<int, 14> pTextureIDs_PartyBuffIcons;
 unsigned int uIconIdx_FlySpell;
 unsigned int uIconIdx_WaterWalk;
 int dword_576E28; // weak
@@ -1110,7 +1106,7 @@
 unsigned int uDialogueType;
 int sDialogue_SpeakingActorNPC_ID;
 struct LevelDecoration *_591094_decoration;
-char sHouseName[200]; // idb
+std::array<char, 200> sHouseName; // idb
 int uCurrentHouse_Animation; // weak
 char *dword_591164_teleport_map_name; // idb
 int dword_591168_teleport_speedz; // weak
@@ -1119,14 +1115,14 @@
 int dword_591174_teleportz; // weak
 int dword_591178_teleporty; // weak
 int dword_59117C_teleportx; // weak
-char byte_591180[6][100]; // idb
-struct NPCData *HouseNPCData[60];//array_5913D8
-
+std::array<std::array<char, 100>, 6> byte_591180; // idb
+std::array<struct NPCData *, 7> HouseNPCData;//0 zero element holds standart house npc
+GUIButton* dword_5913F4[6];
 struct Texture *pTexture_591428;
 struct Texture *pTexture_outside; // idb
 struct Texture *pTexture_Dialogue_Background;
 _UNKNOWN unk_597F10; // weak
-char byte_5B0938[2000];
+std::array<char, 2000> byte_5B0938;
 int EvtTargetObj; // 0x5B5920
 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924
 int _5B65A8_npcdata_uflags_or_other; // weak
@@ -1143,9 +1139,9 @@
 int dword_5C3418; // weak
 int dword_5C341C; // weak
 int _5C3420_pDecoration;
-char byte_5C3427[777]; // weak
-char GameUI_Footer_TimedString[200];
-char pFooterString[200];
+std::array<char, 777> byte_5C3427; // weak
+std::array<char, 200> GameUI_Footer_TimedString;
+std::array<char, 200> pFooterString;
 unsigned int GameUI_Footer_TimeLeft;
 int bForceDrawFooter; // weak
 int dword_5C35C0; // weak
@@ -1154,24 +1150,24 @@
 char *p2DEventsTXT_Raw;
 
 int dword_5C35D4; // weak
-char *aAMPMNames[2];
+std::array<char *, 2> aAMPMNames;
 char byte_5C45AF[777]; // weak
 
-char pFinalMessage[4096]; // idb
-char pTmpBuf[2000];
-char pTmpBuf2[2000];
-char byte_5C6D50[100]; // weak
+std::array<char, 4096> pFinalMessage; // idb
+std::array<char, 2000> pTmpBuf;
+std::array<char, 2000> pTmpBuf2;
+std::array<char, 100> byte_5C6D50; // weak
 int ui_current_text_color; // weak
 __int64 qword_5C6DF0; // weak
 int dword_5C6DF8; // weak
-char item__getname_buffer[104]; // idb
-char *pClassDescriptions[36];
-char *pAttributeDescriptions[7];
-char *pGrandSkillDesc[38];
-char *pMasterSkillDesc[38];
-char *pExpertSkillDesc[38];
-char *pNormalSkillDesc[38];
-char *pSkillDesc[38];
+std::array<char, 104> item__getname_buffer; // idb
+std::array<char *, 36> pClassDescriptions;
+std::array<char *, 7> pAttributeDescriptions;
+std::array<char *, 38> pGrandSkillDesc;
+std::array<char *, 38> pMasterSkillDesc;
+std::array<char *, 38> pExpertSkillDesc;
+std::array<char *, 38> pNormalSkillDesc;
+std::array<char *, 38> pSkillDesc;
 char *pHealthPointsAttributeDescription;
 char *pSpellPointsAttributeDescription;
 char *pArmourClassAttributeDescription;
@@ -1196,10 +1192,10 @@
 char *pSkillDescTXT_Raw;
 
 struct FactionTable *pFactionTable;
-char byte_5C8D1A[777]; // weak
+std::array<char, 777> byte_5C8D1A; // weak
 
-char byte_5E4C15[777]; // weak
-char *pSomeItemsNames[14];
+std::array<char, 777> byte_5E4C15; // weak
+std::array<char *, 14> pSomeItemsNames;
 
 char *pMonstersTXT_Raw;
 char *pMonsterPlacementTXT_Raw;
@@ -1209,11 +1205,11 @@
 char *pPotionsTXT_Raw;
 char *pPotionNotesTXT_Raw;
 
-int _6807B8_level_decorations_ids[777]; // idb
+std::array<int, 777> _6807B8_level_decorations_ids; // idb
 int _6807E0_num_decorations_with_sounds_6807B8; // weak
-int _6807E8_level_decorations_ids[777]; // idb
+std::array<int, 777> _6807E8_level_decorations_ids; // idb
 int _6836C8_num_decorations_6807E8; // weak
-int dword_69B010[64];
+std::array<int, 64> dword_69B010;
 float flt_69B138_dist; // weak
 char byte_69BD41_unused; // weak
 unsigned int uTextureID_x_u;
@@ -1247,7 +1243,7 @@
 int texmapping_terrain_subdivpow2; // weak
 int texmapping_building_subdivsize; // weak
 int texmapping_building_subdivpow2; // weak
-int unnamed_6BE060[2] = {0, 1};
+std::array<int, 2> unnamed_6BE060 = {{0, 1}};
 int mipmapping_building_mm1; // weak
 int mipmapping_building_mm2; // weak
 int mipmapping_building_mm3; // weak
@@ -1269,8 +1265,8 @@
 char outdoor_night_bottom_r; // weak
 char outdoor_night_bottom_g; // weak
 char outdoor_night_bottom_b; // weak
-char pDefaultSkyTexture[777]; // idb
-char byte_6BE124_cfg_textures_DefaultGroundTexture[16]; // idb
+std::array<char, 777> pDefaultSkyTexture; // idb
+std::array<char, 16> byte_6BE124_cfg_textures_DefaultGroundTexture; // idb
 int _6BE134_odm_main_tile_group; // weak
 int dword_6BE138; // weak
 int dword_6BE13C_uCurrentlyLoadedLocationID; // weak
@@ -1286,7 +1282,7 @@
 LONG uWindowStyle; // idb
 HMENU hOSMenu; // idb
 int dword_6BE340; // weak
-char pCurrentMapName[20]; // idb
+std::array<char, 20> pCurrentMapName; // idb
 unsigned int uLevelMapStatsID;
 int dword_6BE364_game_settings_1 = 0; // weak
 int dword_6BE368_debug_settings_2 = 0; // weak
@@ -1303,7 +1299,7 @@
 float flt_6BE3A4_debug_recmod1;
 float flt_6BE3A8_debug_recmod2;
 float flt_6BE3AC_debug_recmod1_x_1_6;
-char byte_6BE3B0[20]; // idb
+std::array<char, 20> byte_6BE3B0; // idb
 char bUnderwater = false; // weak
 char bNoNPCHiring = false; // weak
 int _702AC0_unused = 0; // weak
@@ -1316,70 +1312,70 @@
 bool bNoCD = false;
 bool bNoSound = false;
 int aborting_app; // weak
-int dword_720020_zvalues[100];
-int dword_7201B0_zvalues[299];
+std::array<int, 100> dword_720020_zvalues;
+std::array<int, 299> dword_7201B0_zvalues;
 int uTextureID_720980; // weak
 int _720984_unused; // weak
 char _72098C_unused; // weak
-__int16 word_7209A0_intercepts_ys_plus_ys[104];
-__int16 word_720A70_intercepts_xs_plus_xs[104];
-__int16 word_720B40_intercepts_zs[104];
-__int16 word_720C10_intercepts_xs[102];
+std::array<__int16, 104> word_7209A0_intercepts_ys_plus_ys;
+std::array<__int16, 104> word_720A70_intercepts_xs_plus_xs;
+std::array<__int16, 104> word_720B40_intercepts_zs;
+std::array<__int16, 102> word_720C10_intercepts_xs;
 int dword_720CDC;
-__int16 word_720CE0_ys[777]; // idb
-__int16 word_720DB0_xs[777]; // idb
-int dword_720E80[20];
-int dword_720ED0[20];
-int dword_720F20[20];
-__int16 word_720F70[777]; // idb
-__int16 word_721040[777]; // idb
-int dword_721110[777]; // idb
-int dword_721160[777]; // idb
-int odm_floor_level[20]; // idb
+std::array<__int16, 777> word_720CE0_ys; // idb
+std::array<__int16, 777> word_720DB0_xs; // idb
+std::array<int, 20> dword_720E80;
+std::array<int, 20> dword_720ED0;
+std::array<int, 20> dword_720F20;
+std::array<__int16, 777> word_720F70; // idb
+std::array<__int16, 777> word_721040; // idb
+std::array<int, 777> dword_721110; // idb
+std::array<int, 777> dword_721160; // idb
+std::array<int, 20> odm_floor_level; // idb
 int blv_prev_party_x; // weak
 int blv_prev_party_z; // weak
 int blv_prev_party_y; // weak
 char *dword_721660; // idb
 char *dword_721664; // idb
-NPCTopic pNPCTopics[789];
+std::array<NPCTopic, 789> pNPCTopics;
 char *dword_722F10; // idb
-const char *pQuestTable[512];
+std::array<const char *, 512> pQuestTable;
 _UNKNOWN unk_723714; // weak
 char *dword_723718_autonote_related; // idb
 int dword_72371C[777]; // weak
-const char *pScrolls[82];
+std::array<const char *, 82> pScrolls;
 int dword_723E80_award_related[777]; // weak
 int dword_723E84[777]; // weak
 int dword_7241C8; // weak
 struct unk_F7B60C stru_73C834; // struct @ MM7.exe::0073C834
 
-char *aNPCProfessionNames[59];
+std::array<char *, 59> aNPCProfessionNames;
 char *pAwardsTXT_Raw;
 char *pScrollsTXT_Raw;
 char *pMerchantsTXT_Raw;
-const char *pMerchantsBuyPhrases[7];
-const char *pMerchantsSellPhrases[7];
-const char *pMerchantsRepairPhrases[7];
-const char *pMerchantsIdentifyPhrases[7];
+std::array<char *, 7> pMerchantsBuyPhrases;
+std::array<char *, 7> pMerchantsSellPhrases;
+std::array<char *, 7> pMerchantsRepairPhrases;
+std::array<char *, 7> pMerchantsIdentifyPhrases;
 char *pTransitionsTXT_Raw;
 char *pAutonoteTXT_Raw;
 char *pQuestsTXT_Raw;
  unsigned int    uNumTerrainNormals;
  struct Vec3_float_ *pTerrainNormals;
- unsigned short  pTerrainNormalIndices[128 * 128 * 2];
- unsigned int    pTerrainSomeOtherData[128 * 128 * 2];
+ std::array<unsigned short, 128 * 128 * 2>  pTerrainNormalIndices;
+ std::array<unsigned int, 128 * 128 * 2>    pTerrainSomeOtherData;
 struct unk_F7B60C stru_76D578; // struct @ MM7.exe::0076D578
 struct unk_F7B60C stru_76D590; // struct @ MM7.exe::0076D590
 struct unk_F7B60C stru_76D5A8; // struct @ MM7.exe::0076D5A8
 char byte_76D5C0; // weak
-int terrain_76D5C8[128];
-int terrain_76D7C8[128];
-int terrain_76D9C8[128];
-int terrain_76DBC8[128];
-int terrain_76DDC8[128];
-int terrain_76DFC8[128];
-int terrain_76E1C8[128];
-int terrain_76E3C8[128];
+std::array<int, 128> terrain_76D5C8;
+std::array<int, 128> terrain_76D7C8;
+std::array<int, 128> terrain_76D9C8;
+std::array<int, 128> terrain_76DBC8;
+std::array<int, 128> terrain_76DDC8;
+std::array<int, 128> terrain_76DFC8;
+std::array<int, 128> terrain_76E1C8;
+std::array<int, 128> terrain_76E3C8;
 
 _UNKNOWN unk_801A00; // weak
 _UNKNOWN unk_801A0C; // weak
@@ -1389,14 +1385,14 @@
 int dword_80AA1C; // weak
 int dword_80AA20; // weak
 unsigned int uNumElementsIn80AA28;
-struct stru148 *ptr_80AA28[2000];
+std::array<struct stru148 *, 2000> ptr_80AA28;
 struct Edge *pNewEdges;
 struct Surf *pSurfs;
 struct Edge *pEdges;
 struct Span *pSpans;
 struct Edge *ptr_80C978_Edges;
 struct Surf *ptr_80C97C_Surfs;
-struct Edge *ptr_80CA10[480];
+std::array<struct Edge *, 480> ptr_80CA10;
 _UNKNOWN unk_80D190; // weak
 int dword_A74C88; // weak
 unsigned int uPlayerCreationUI_SkySliderPos;
@@ -1406,34 +1402,34 @@
 struct Texture *pTexture_PlayerFaceMask;
 struct Texture *pTexture_PlayerFaceEradicated;
 struct Texture *pTexture_PlayerFaceDead;
-struct Texture *pTextures_PlayerFaces[4][56];
-struct Player *pPlayers[5];
+std::array< std::array<struct Texture *, 56>, 4> pTextures_PlayerFaces;
+std::array<struct Player *, 5> pPlayers;
 __int64 qword_A750D8; // weak
 __int16 word_A750E0; // weak
 __int16 word_A750E2; // weak
-char *pClassNames[36];
-char *aCharacterConditionNames[19];
-char *pSkillNames[38];
-char byte_AE3368[777]; // weak
+std::array<char *, 36> pClassNames;
+std::array<char *, 19> aCharacterConditionNames;
+std::array<char *, 38> pSkillNames;
+std::array<char, 777> byte_AE3368; // weak
 char byte_AE3369; // weak
 char byte_AE336A; // weak
 char byte_AE336B; // weak
 int dword_AE336C; // weak
 int dword_AE3370; // weak
 char byte_AE5B91; // weak
-int dword_F1B430[32]; // weak
+std::array<int, 32> dword_F1B430; // weak
 //int dword_F8B144; // nexindex [-1] to the following
-int player_levels[4] = {1, 1, 1, 1};
-__int16 word_F8B158[777]; // weak
+std::array<int, 4> player_levels = {{1, 1, 1, 1}};
+std::array<__int16, 777> word_F8B158; // weak
 struct Texture *ShopTexture; // idb
-struct Texture *ItemsInShopTexture[12];
+std::array<struct Texture *, 12> ItemsInShopTexture;
 __int16 word_F8B1A0; // weak
 const char *dword_F8B1A4; // idb
 int contract_approved; // weak
 int dword_F8B1AC_award_bit_number; // idb
 int dword_F8B1B0; // weak
 int gold_transaction_amount; // F8B1B4
-char *pShopOptions[4];
+std::array<char *, 4> pShopOptions;
 _UNKNOWN unk_F8B1C8; // weak
 int dword_F8B1D8; // weak
 int dword_F8B1DC; // weak
@@ -1441,8 +1437,8 @@
 int dword_F8B1E4; // weak
 const char *current_npc_text; // idb
 char dialogue_show_profession_details = false; // F8B1EC
-char byte_F8B1EF[777]; // weak
-char byte_F8B1F0[4];
+std::array<char, 777> byte_F8B1EF; // weak
+std::array<char, 4> byte_F8B1F0;
 int dword_F8B1F4; // weak
 
 
@@ -1450,8 +1446,8 @@
 //_UNKNOWN unk_F8BA50; // weak
 char byte_F8BC0C; // weak
 int bGameoverLoop = 0; // weak
-__int16 intersect_face_vertex_coords_list_a[104]; // word_F8BC48
-__int16 intersect_face_vertex_coords_list_b[104]; // word_F8BD18
+std::array<__int16, 104> intersect_face_vertex_coords_list_a; // word_F8BC48
+std::array<__int16, 104> intersect_face_vertex_coords_list_b; // word_F8BD18
 int dword_F93F20; // weak
 int dword_F93F70; // weak
 
--- a/mm7_data.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/mm7_data.h	Mon Jun 10 09:30:21 2013 +0600
@@ -2,7 +2,7 @@
 #include <string>
 #include "VectorTypes.h"
 #include "OSAPI.h"
-
+#include <array>
 typedef char _UNKNOWN;
 
 
@@ -309,14 +309,10 @@
 extern int (__stdcall *off_4DAFDC)(char); // weak
 extern char asc_4DB724[]; // idb
 extern int dword_4DBD94; // weak
-extern int dword_4DF380[]; // weak
+extern std::array<int, 5> dword_4DF380; // weak
 extern int dword_4DF390; // weak
 extern char Str2[]; // idb
 
-extern char byte_4E185C; // weak
-
-extern char byte_4E185E; // weak
-
 
 extern float flt_4D84E8;
 
@@ -334,18 +330,18 @@
 extern char aIcons[]; // idb
 extern char aPending[]; // idb
 extern char aCanTFindS[]; // idb
-extern char *spellbook_texture_filename_suffices[]; // weak
+extern std::array<char *, 9> spellbook_texture_filename_suffices; // weak
 extern __int16 word_4E1D3A[]; // weak
-extern __int16 pTownPortalBook_xs[6];
-extern __int16 pTownPortalBook_ys[6];
-extern __int16 pTownPortalBook_ws[6];
-extern __int16 pTownPortalBook_hs[6];
-extern unsigned char pSpellbookSpellIndices[9][12]; // 4E2430
-extern unsigned int pLloydsBeaconsPreviewXs[5]; // 004E249C
-extern unsigned int pLloydsBeaconsPreviewYs[5];
-extern unsigned int pLloydsBeacons_SomeXs[5];
-extern unsigned int pLloydsBeacons_SomeYs[5]; // idb
-extern char aSbwb00[7]; // weak
+extern std::array<__int16, 6> pTownPortalBook_xs;
+extern std::array<__int16, 6> pTownPortalBook_ys;
+extern std::array<__int16, 6> pTownPortalBook_ws;
+extern std::array<__int16, 6> pTownPortalBook_hs;
+extern std::array<std::array<unsigned char, 12>, 9> pSpellbookSpellIndices; // 4E2430   from pSpellbookSpellIndices[9][12]
+extern std::array<unsigned int, 5> pLloydsBeaconsPreviewXs; // 004E249C
+extern std::array<unsigned int, 5> pLloydsBeaconsPreviewYs;
+extern std::array<unsigned int, 5> pLloydsBeacons_SomeXs;
+extern std::array<unsigned int, 5> pLloydsBeacons_SomeYs; // idb
+extern std::array<char, 7> aSbwb00; // weak
 extern char aW[2]; // idb
 extern char aA[2]; // idb
 extern char aSD[]; // idb
@@ -424,18 +420,18 @@
 extern char aS100110D02dSS[]; // idb
 extern int pCurrentScreen; // 004E28F8
 extern unsigned int uGammaPos;
-extern int BtnTurnCoord[8];
-extern __int16 RightClickPortraitXmin[4];
-extern __int16 RightClickPortraitXmax[4];
+extern std::array<int, 8> BtnTurnCoord;
+extern std::array<__int16, 4> RightClickPortraitXmin;
+extern std::array<__int16, 4> RightClickPortraitXmax;
 extern void *off_4E2A12; // weak
 //extern int pArmorSkills[5];
 //extern int pWeaponSkills[9];
 //extern int pMiscSkills[12];
 //extern int pMagicSkills[9];
-extern unsigned int pHealthBarPos[4];
-extern unsigned int pManaBarPos[4];
-extern char _4E2B21_buff_spell_tooltip_colors[80];
-extern unsigned char monster_popup_y_offsets[]; // weak
+extern std::array<unsigned int, 4> pHealthBarPos;
+extern std::array<unsigned int, 4> pManaBarPos;
+extern std::array<char, 80> _4E2B21_buff_spell_tooltip_colors;
+extern std::array<char, 88>  monster_popup_y_offsets; // weak
 extern unsigned char hourglass_icon_idx; // weak
 
 
@@ -446,96 +442,96 @@
 extern const char *format_4E2E10; // format text of resistance in Stats screen
 extern __int16 word_4E3C66[]; // idb
 extern int dword_4E455C; // weak
-extern int dword_4E4560[6];
-extern int dword_4E4578[6];
-extern int dword_4E4590[6];
-extern int dword_4E45A8[6];
+extern std::array<int, 6> dword_4E4560;
+extern std::array<int, 6> dword_4E4578;
+extern std::array<int, 6> dword_4E4590;
+extern std::array<int, 6> dword_4E45A8;
 extern _UNKNOWN dword_4E49D4; // idb
 extern int dword_4E4A18[]; // weak
 extern int dword_4E4A1C[]; // weak
 extern int dword_4E4A40[]; // weak
 extern int dword_4E4A44[]; // weak
-extern float flt_4E4A80[10];
+extern std::array<float, 10> flt_4E4A80;
 
-extern int pPartySpellbuffsUI_XYs[14][2];
-extern unsigned char byte_4E5DD8[]; // weak
-extern unsigned __int8 pPartySpellbuffsUI_smthns[14];
-extern int pNPCPortraits_x[6][6]; // 004E5E50
-extern int pNPCPortraits_y[6][6]; // 004E5EE0
-extern const char *pHouse_ExitPictures[11];
-extern const char *_4E6BDC_loc_names[11];
+extern std::array< std::array<int, 2>, 14> pPartySpellbuffsUI_XYs;
+extern std::array<unsigned char, 14> byte_4E5DD8; // weak
+extern std::array<unsigned __int8, 14> pPartySpellbuffsUI_smthns;
+extern std::array< std::array<int, 6>, 6> pNPCPortraits_x; // 004E5E50
+extern std::array< std::array<int, 6>, 6> pNPCPortraits_y; // 004E5EE0
+extern std::array<const char *, 11> pHouse_ExitPictures;
+extern std::array<const char *, 11> _4E6BDC_loc_names;
 extern int bWinNT4_0; // weak
-extern __int16 word_4E8152[11];
-extern char byte_4E8168[7][14];
+extern std::array<__int16, 11> word_4E8152;
+extern std::array< std::array<char, 14>, 7> byte_4E8168;
 #include "Texture.h"
 extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000};
 extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000};
 extern char byte_4E94D0; // weak
 extern char _4E94D2_light_type; // weak
 extern char byte_4E94D3; // weak
-extern unsigned int saveload_dlg_xs[2];
-extern unsigned int saveload_dlg_ys[2];
-extern unsigned int saveload_dlg_zs[2];
-extern unsigned int saveload_dlg_ws[2];
+extern std::array<unsigned int, 2> saveload_dlg_xs;
+extern std::array<unsigned int, 2> saveload_dlg_ys;
+extern std::array<unsigned int, 2> saveload_dlg_zs;
+extern std::array<unsigned int, 2> saveload_dlg_ws;
 extern int dword_4E98BC_bApplicationActive; // weak
-extern char *pTransitionStrings[]; // 4EB080
-extern int dword_4EC268[]; // weak
-extern int dword_4EC28C[]; // weak
+extern std::array<char*, 465> pTransitionStrings; // 4EB080
+extern std::array<int, 9> dword_4EC268; // weak
+extern std::array<int, 7> dword_4EC28C; // weak
 extern int dword_4EC2A8; // weak
 extern int dword_4EC2AC; // weak
-extern const char *pPlayerPortraitsNames[25];
+extern std::array<const char*, 25> pPlayerPortraitsNames;
 
-extern unsigned char byte_4ECF08[48][25];
-extern unsigned char SoundSetAction[110][8]; // weak
-extern __int16 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[4];
-extern char byte_4ED970_skill_learn_ability_by_class_table[36][37];
-extern int dword_4EDEA0[]; // weak
-extern int dword_4EDEB4[]; // weak
-extern int dword_4EDEC4[]; // weak
+extern std::array< std::array<unsigned char, 25>, 48> byte_4ECF08;
+extern std::array<std::array<unsigned char, 8>, 110> SoundSetAction; // weak
+extern std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing;
+extern std::array< std::array<char, 37>, 36> byte_4ED970_skill_learn_ability_by_class_table;
+extern std::array<int, 777> dword_4EDEA0; // weak
+extern std::array<int, 777> dword_4EDEB4; // weak
+extern std::array<int, 777> dword_4EDEC4; // weak
 extern _UNKNOWN unk_4EDF40; // weak
-extern unsigned int pHiredNPCsIconsOffsetsX[2];
-extern unsigned int pHiredNPCsIconsOffsetsY[2];
-extern int dword_4EE07C[2]; // weak
+extern std::array<unsigned int, 2> pHiredNPCsIconsOffsetsX;
+extern std::array<unsigned int, 2> pHiredNPCsIconsOffsetsY;
+extern std::array<int, 2> dword_4EE07C; // weak
 extern _UNKNOWN unk_4EE084; // weak
-extern __int16 word_4EE088_sound_ids[]; // weak
-extern short word_4EE150[];
+extern std::array<__int16, 100> word_4EE088_sound_ids; // weak
+extern std::array<short, 28> word_4EE150;
 extern int dword_4EED78; // weak
 extern _UNKNOWN unk_4EED80; // weak
 extern int dword_4EFA80; // weak
 extern int dword_4EFA84; // weak
 extern void *off_4EFDB0; // weak
 extern int dword_4F031C[]; // weak
-extern const char *off_4F03B8[]; // idb
+extern std::array<const char *, 19> off_4F03B8; // idb
 extern __int16 word_4F0576[]; // weak
 
-extern int guild_mambership_flags[32];
-extern __int16 word_4F0754[49];
-extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54];
-extern unsigned short pMaxLevelPerTrainingHallType[];
-extern int price_for_membership[]; // weak
-extern Vec2_int_ pMonsterArenaPlacements[20];
-extern __int16 word_4F0F30[32]; // weak
+extern std::array<int, 32> guild_mambership_flags;
+extern std::array<__int16, 49> word_4F0754;
+extern std::array<__int16, 54> _4F0882_evt_VAR_PlayerItemInHands_vals;
+extern std::array<unsigned short, 6> pMaxLevelPerTrainingHallType;
+extern std::array<int, 11> price_for_membership; // weak
+extern std::array<Vec2_int_, 20> pMonsterArenaPlacements;
+extern std::array<__int16, 32> word_4F0F30; // weak
 extern double dbl_4F2870; // weak
 extern int dword_4F288C; // weak
 extern double dbl_4F5372; // weak
 extern int dword_4F5428[]; // weak
 extern int dword_4F542C[]; // weak
 extern _UNKNOWN crtunk_4F54B8; // weak
-extern int dword_4F5B24_ys[]; // idb
-extern int dword_4F5BF4_xs[]; // idb
-extern int dword_4F5CC4_ys[]; // idb
-extern int dword_4F5D98_xs[]; // idb
-extern int ai_array_4F5E68[500];
-extern int ai_array_4F6638_actor_ids[500];
-extern int ai_near_actors_targets_pid[500];
+extern std::array<int, 777> dword_4F5B24_ys; // idb
+extern std::array<int, 777> dword_4F5BF4_xs; // idb
+extern std::array<int, 777> dword_4F5CC4_ys; // idb
+extern std::array<int, 777> dword_4F5D98_xs; // idb
+extern std::array<int, 500> ai_array_4F5E68;
+extern std::array<int, 500> ai_array_4F6638_actor_ids;
+extern std::array<int, 500> ai_near_actors_targets_pid;
 extern int ai_arrays_size; // weak
-extern int ai_near_actors_distances[500];
-extern unsigned int ai_near_actors_ids[500];
-extern int dword_4F8580[]; // weak
+extern std::array<int, 500> ai_near_actors_distances;
+extern std::array<unsigned int, 500> ai_near_actors_ids;
+extern std::array<int, 121> dword_4F8580; // weak
 extern int dword_4FA9B0[]; // weak
 extern int dword_4FA9B4[]; // weak
 extern char byte_4FAA00; // weak
-extern __int16 am_sounds[12];
+extern std::array<__int16, 12> am_sounds;
 extern _UNKNOWN unk_4FAA20; // weak
 extern char byte_4FAA24; // weak
 extern HWND dword_4FAA28; // idb
@@ -543,12 +539,10 @@
 extern char byte_4FAA2E; // weak
 extern int amuint_4FAA34; // weak
 extern int amuint_4FAA38; // weak
-extern int amuint_4FAA3C_blt_xy[2];
-extern int am_uint_4FAA44_blt_xy[2];
+
 extern int amuint_4FAA4C; // weak
-extern unsigned int uCardID; // idb
-extern int amuint_4FAA54_blt_xy[2];
-extern int amuint_4FAA5C_blt_xy[2];
+
+
 extern int dword_4FAA64; // weak
 extern int dword_4FAA68; // weak
 
@@ -557,14 +551,13 @@
 extern char am_byte_4FAA75; // weak
 extern char am_byte_4FAA76; // weak
 
-extern int amuint_4FAA78[777]; // weak
+
 extern char am_byte_4FAA7C[777]; // weak
-extern int amuint_4FAA80[777]; // weak
-extern int amuint_4FAA84[777]; // weak
+
 extern int amuint_4FAA88[777]; // weak
 extern int amuint_4FAA8C[777]; // weak
 extern int amuint_4FAA90[777][2];
-extern int dword_4FABB8; // weak
+
 
 
 extern int amuint_4FABC4; // weak
@@ -592,13 +585,11 @@
 
 extern char byte_505880; // weak
 extern char byte_505881; // weak
-extern int amuint_505884; // weak
-extern int amuint_505888; // weak
-extern int amuint_50588C; // weak
+
 extern int dword_505890; // weak
-extern unsigned int pSRZBufferLineOffsets[480];
+extern std::array<unsigned int, 480> pSRZBufferLineOffsets;
 extern int areWeLoadingTexture; // weak
-extern char byte_506130[]; // weak
+extern std::array<char, 777> byte_506130; // weak
 extern int dword_506338; // weak
 extern int dword_50633C; // idb
 extern signed int sRecoveryTime; // idb
@@ -621,27 +612,27 @@
 extern int BtnUp_flag; //BtnUp_flag
 extern int quick_spell_at_page; // weak
 extern char byte_506550; // weak
-extern char *aMoonPhaseNames[5];
+extern std::array<char *, 5> aMoonPhaseNames;
 extern int _506568_autonote_type; // 506568
 extern char bRecallingBeacon; // weak
 extern int uLastPointedObjectID; // weak
 //extern unsigned __int8 bMonsterInfoUI_bDollInitialized;
-extern char *aSpellNames[44];
+extern std::array<char *, 44> aSpellNames;
 extern int pMainScreenNum; // weak
 extern int dword_506980_uW; // weak
 extern int dword_506984_uZ; // weak
 extern int dword_506988_uY; // weak
 extern int dword_50698C_uX; // weak
 extern int uGameMenuUI_CurentlySelectedKeyIdx; // 506E68
-extern bool GameMenuUI_InvaligKeyBindingsFlags[28]; // 506E6C
-extern unsigned int pPrevVirtualCidesMapping[27];
+extern std::array<bool, 28> GameMenuUI_InvaligKeyBindingsFlags; // 506E6C
+extern std::array<unsigned int, 27> pPrevVirtualCidesMapping;
 extern int KeyboardPageNum; // weak
-extern int dword_506F0C[]; // idb
+extern std::array<int, 777> dword_506F0C; // idb
 extern int uRestUI_FoodRequiredToRest;
 extern int dword_506F14; // weak
 extern int _506F18_num_hours_to_sleep; // weak
 extern int dword_506F1C; // weak
-extern int pVisibleWindowsIdxs[20]; // weak
+extern std::array<int, 20> pVisibleWindowsIdxs; // weak
 extern int uNumVisibleWindows;
 extern char bFlashHistoryBook; // weak
 extern char bFlashAutonotesBook; // weak
@@ -661,10 +652,10 @@
 extern unsigned int uGameUIFontShadow;
 extern unsigned int uGameUIFontMain;
 extern int dword_507B00_spell_info_to_draw_in_popup; // weak
-extern char *aMonthNames[12];
-extern char *aDayNames[7];
-extern char *aSpellSchoolNames[9];
-extern char *aAttributeNames[7];
+extern std::array<char *, 12> aMonthNames;
+extern std::array<char *, 7> aDayNames;
+extern std::array<char *, 9> aSpellSchoolNames;
+extern std::array<char *, 7> aAttributeNames;
 extern int dword_507B94; // weak
 extern int dword_507B98_ctrl_pressed; // weak
 extern unsigned int uActiveCharacter;
@@ -674,8 +665,8 @@
 extern __int64 GameUI_RightPanel_BookFlashTimer; // weak
 extern int _507CD4_RestUI_hourglass_anim_controller; // weak
 extern int dword_507CD8; // weak
-extern int dword_50B570[]; // weak
-extern int dword_50B638[]; // weak
+extern std::array<int, 50> dword_50B570; // weak
+extern std::array<int, 50> dword_50B638; // weak
 extern struct stru367 stru_50B700;
 /*extern int stru_50B700.field_0; // weak
 extern int stru_50B700.field_38[]; // idb
@@ -695,14 +686,14 @@
 extern int dword_50BAE8[]; // weak
 extern int stru_50B700._xs2[]; // weak
 extern int stru_50B700._xs3[]; // weak*/
-extern int dword_50BC10[]; // weak
-extern int dword_50BDA0[]; // weak
-extern int dword_50BF30[]; // weak
+extern std::array<int, 100> dword_50BC10; // weak
+extern std::array<int, 100> dword_50BDA0; // weak
+extern std::array<int, 100> dword_50BF30; // weak
 extern char town_portal_caster_id; // weak
 extern int some_active_character; // weak
 extern _UNKNOWN unk_50C190; // weak
 extern int dword_50C968; // weak
-extern unsigned int pIconIDs_Turn[5];
+extern std::array<unsigned int, 5> pIconIDs_Turn;
 extern unsigned int uIconID_TurnStop;
 extern unsigned int uIconID_TurnHour;
 extern int uIconID_CharacterFrame; // idb
@@ -724,19 +715,19 @@
 extern int dword_50CDCC; // weak
 extern int bProcessorIsNotIntel; // weak
 extern Vec3_int_ layingitem_vel_50FDFC;
-extern char pStartingMapName[]; // idb
-extern unsigned __int8 IsPlayerWearingWatersuit[5];
-extern char party_has_equipment[54];
-extern char byte_5111F6[];
-extern unsigned int papredoll_dbrds[16];
+extern std::array<char, 777> pStartingMapName; // idb
+extern std::array<unsigned __int8, 5> IsPlayerWearingWatersuit;
+extern std::array<char, 54> party_has_equipment;
+extern std::array<char, 16> byte_5111F6;
+extern std::array<unsigned int, 16> papredoll_dbrds;
 
 extern int bRingsShownInCharScreen; // weak
 extern int _unused000; // weak
 
-extern unsigned __int16 pOdmMinimap[117][137];
+extern std::array<std::array<unsigned __int16, 137>, 117> pOdmMinimap;
 extern unsigned int uNumBlueFacesInBLVMinimap;
-extern unsigned __int16 pBlueFacesInBLVMinimapIDs[50];
-extern int pTextureIDs_PartyBuffIcons[14];
+extern std::array<unsigned __int16, 50> pBlueFacesInBLVMinimapIDs;
+extern std::array<int, 14> pTextureIDs_PartyBuffIcons;
 extern unsigned int uIconIdx_FlySpell;
 extern unsigned int uIconIdx_WaterWalk;
 extern int dword_576E28; // weak
@@ -750,7 +741,7 @@
 extern unsigned int uDialogueType;
 extern signed int sDialogue_SpeakingActorNPC_ID;
 extern struct LevelDecoration *_591094_decoration;
-extern char sHouseName[200]; // idb
+extern std::array<char, 200> sHouseName; // idb
 extern int uCurrentHouse_Animation; // weak
 extern char *dword_591164_teleport_map_name; // idb
 extern int dword_591168_teleport_speedz; // weak
@@ -759,14 +750,14 @@
 extern int dword_591174_teleportz; // weak
 extern int dword_591178_teleporty; // weak
 extern int dword_59117C_teleportx; // weak
-extern char byte_591180[6][100]; // idb
-extern struct NPCData *HouseNPCData[60];
-
+extern std::array<std::array<char, 100>, 6> byte_591180; // idb
+extern std::array<struct NPCData *, 7> HouseNPCData; //0this array size temporarily increased to 60 from 6 to work aroud house overflow
+extern GUIButton* dword_5913F4[6];
 extern struct Texture *pTexture_591428;
 extern struct Texture *pTexture_outside; // idb
 extern struct Texture *pTexture_Dialogue_Background;
 extern _UNKNOWN unk_597F10; // weak
-extern char byte_5B0938[2000];
+extern std::array<char, 2000> byte_5B0938;
 extern int EvtTargetObj; // weak
 extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924
 extern int _5B65A8_npcdata_uflags_or_other; // weak
@@ -783,9 +774,9 @@
 extern int dword_5C3418; // weak
 extern int dword_5C341C; // weak
 extern int _5C3420_pDecoration;
-extern char byte_5C3427[]; // weak
-extern char GameUI_Footer_TimedString[200];
-extern char pFooterString[200];
+extern std::array<char, 777> byte_5C3427; // weak
+extern std::array<char, 200> GameUI_Footer_TimedString;
+extern std::array<char, 200> pFooterString;
 extern unsigned int GameUI_Footer_TimeLeft;
 extern int bForceDrawFooter; // weak
 extern int dword_5C35C0; // weak
@@ -794,24 +785,24 @@
 extern char *p2DEventsTXT_Raw;
 
 extern int dword_5C35D4; // weak
-extern char *aAMPMNames[2];
+extern std::array<char *, 2> aAMPMNames;
 extern char byte_5C45AF[]; // weak
-extern char pTmpBuf3[];
-extern char pFinalMessage[4096]; // idb
-extern char pTmpBuf[2000];
-extern char pTmpBuf2[2000];
-extern char byte_5C6D50[]; // weak
+extern std::array<char, 10000> pTmpBuf3;
+extern std::array<char, 4096> pFinalMessage; // idb
+extern std::array<char, 2000> pTmpBuf;
+extern std::array<char, 2000> pTmpBuf2;
+extern std::array<char, 100> byte_5C6D50; // weak
 extern int ui_current_text_color; // weak
 extern __int64 qword_5C6DF0; // weak
 extern int dword_5C6DF8; // weak
-extern char item__getname_buffer[104]; // idb
-extern char *pClassDescriptions[36];
-extern char *pAttributeDescriptions[7];
-extern char *pGrandSkillDesc[38];
-extern char *pMasterSkillDesc[38];
-extern char *pExpertSkillDesc[38];
-extern char *pNormalSkillDesc[38];
-extern char *pSkillDesc[38];
+extern std::array<char, 104> item__getname_buffer; // idb
+extern std::array<char *, 36> pClassDescriptions;
+extern std::array<char *, 7> pAttributeDescriptions;
+extern std::array<char *, 38> pGrandSkillDesc;
+extern std::array<char *, 38> pMasterSkillDesc;
+extern std::array<char *, 38> pExpertSkillDesc;
+extern std::array<char *, 38> pNormalSkillDesc;
+extern std::array<char *, 38> pSkillDesc;
 extern char *pHealthPointsAttributeDescription;
 extern char *pSpellPointsAttributeDescription;
 extern char *pArmourClassAttributeDescription;
@@ -835,10 +826,10 @@
 extern char *pStatsTXT_Raw;
 extern char *pSkillDescTXT_Raw;
 extern struct FactionTable *pFactionTable;
-extern char byte_5C8D1A[]; // weak
+extern std::array<char, 777> byte_5C8D1A; // weak
 
-extern char byte_5E4C15[]; // weak
-extern char *pSomeItemsNames[14];
+extern std::array<char, 777> byte_5E4C15; // weak
+extern std::array<char *, 14> pSomeItemsNames;
 
 extern char *pMonstersTXT_Raw;
 extern char *pMonsterPlacementTXT_Raw;
@@ -848,11 +839,11 @@
 extern char *pPotionsTXT_Raw;
 extern char *pPotionNotesTXT_Raw;
 
-extern int _6807B8_level_decorations_ids[]; // idb
+extern std::array<int, 777> _6807B8_level_decorations_ids; // idb
 extern int _6807E0_num_decorations_with_sounds_6807B8; // weak
-extern int _6807E8_level_decorations_ids[]; // idb
+extern std::array<int, 777> _6807E8_level_decorations_ids; // idb
 extern int _6836C8_num_decorations_6807E8; // weak
-extern int dword_69B010[64];
+extern std::array<int, 64> dword_69B010;
 extern float flt_69B138_dist; // weak
 extern char byte_69BD41_unused; // weak
 extern unsigned int uTextureID_x_u;
@@ -886,7 +877,7 @@
 extern int texmapping_terrain_subdivpow2; // weak
 extern int texmapping_building_subdivsize; // weak
 extern int texmapping_building_subdivpow2; // weak
-extern int unnamed_6BE060[2];
+extern std::array<int, 2> unnamed_6BE060;
 extern int mipmapping_building_mm1; // weak
 extern int mipmapping_building_mm2; // weak
 extern int mipmapping_building_mm3; // weak
@@ -908,8 +899,8 @@
 extern char outdoor_night_bottom_r; // weak
 extern char outdoor_night_bottom_g; // weak
 extern char outdoor_night_bottom_b; // weak
-extern char pDefaultSkyTexture[]; // idb
-extern char byte_6BE124_cfg_textures_DefaultGroundTexture[16]; // idb
+extern std::array<char, 777> pDefaultSkyTexture; // idb
+extern std::array<char, 16> byte_6BE124_cfg_textures_DefaultGroundTexture; // idb
 extern int _6BE134_odm_main_tile_group; // weak
 extern int dword_6BE138; // weak
 extern int dword_6BE13C_uCurrentlyLoadedLocationID; // weak
@@ -928,7 +919,7 @@
 extern LONG uWindowStyle; // idb
 extern HMENU hOSMenu; // idb
 extern int dword_6BE340; // weak
-extern char pCurrentMapName[20]; // idb
+extern std::array<char, 20> pCurrentMapName; // idb
 extern unsigned int uLevelMapStatsID;
 extern int dword_6BE364_game_settings_1; // weak
 extern int dword_6BE368_debug_settings_2; // weak
@@ -945,7 +936,7 @@
 extern float flt_6BE3A4_debug_recmod1;
 extern float flt_6BE3A8_debug_recmod2;
 extern float flt_6BE3AC_debug_recmod1_x_1_6;
-extern char byte_6BE3B0[20]; // idb
+extern std::array<char, 20> byte_6BE3B0; // idb
 extern char bUnderwater; // weak
 extern char bNoNPCHiring; // weak
 extern int _702AC0_unused; // weak
@@ -958,69 +949,69 @@
 extern bool bNoCD;
 extern bool bNoSound;
 extern int aborting_app; // weak
-extern int dword_720020_zvalues[100];
-extern int dword_7201B0_zvalues[299];
+extern std::array<int, 100> dword_720020_zvalues;
+extern std::array<int, 299> dword_7201B0_zvalues;
 extern int dword_7207F0[]; // idb
 extern int uTextureID_720980; // weak
 extern int _720984_unused; // weak
 extern char _72098C_unused; // weak
-extern __int16 word_7209A0_intercepts_ys_plus_ys[104];
-extern __int16 word_720A70_intercepts_xs_plus_xs[104];
-extern __int16 word_720B40_intercepts_zs[104];
-extern __int16 word_720C10_intercepts_xs[102];
+extern std::array<__int16, 104> word_7209A0_intercepts_ys_plus_ys;
+extern std::array<__int16, 104> word_720A70_intercepts_xs_plus_xs;
+extern std::array<__int16, 104> word_720B40_intercepts_zs;
+extern std::array<__int16, 102> word_720C10_intercepts_xs;
 extern int dword_720CDC;
-extern __int16 word_720CE0_ys[]; // idb
-extern __int16 word_720DB0_xs[]; // idb
-extern int dword_720E80[20];
-extern int dword_720ED0[20];
-extern int dword_720F20[20];
-extern __int16 word_720F70[]; // idb
-extern __int16 word_721040[]; // idb
-extern int dword_721110[]; // idb
-extern int dword_721160[]; // idb
-extern int odm_floor_level[20]; // idb dword_7211B0
+extern std::array<__int16, 777> word_720CE0_ys; // idb
+extern std::array<__int16, 777> word_720DB0_xs; // idb
+extern std::array<int, 20> dword_720E80;
+extern std::array<int, 20> dword_720ED0;
+extern std::array<int, 20> dword_720F20;
+extern std::array<__int16, 777> word_720F70; // idb
+extern std::array<__int16, 777> word_721040; // idb
+extern std::array<int, 777> dword_721110; // idb
+extern std::array<int, 777> dword_721160; // idb
+extern std::array<int, 20> odm_floor_level; // idb dword_7211B0
 extern int blv_prev_party_x; // weak
 extern int blv_prev_party_z; // weak
 extern int blv_prev_party_y; // weak
 extern char *dword_721660; // idb
 extern char *dword_721664; // idb
 extern char *dword_722F10; // idb
-extern const char *pQuestTable[512];
+extern std::array<const char *, 512> pQuestTable;
 extern _UNKNOWN unk_723714; // weak
 extern char *dword_723718_autonote_related; // idb
 extern int dword_72371C[]; // weak
-extern const char *pScrolls[82];
+extern std::array<const char *, 82> pScrolls;
 extern int dword_723E80_award_related[]; // weak
 extern int dword_723E84[]; // weak
 extern int dword_7241C8; // weak
 
-extern char *aNPCProfessionNames[59];
+extern std::array<char *, 59> aNPCProfessionNames;
 extern char *pAwardsTXT_Raw;
 extern char *pScrollsTXT_Raw;
 extern char *pMerchantsTXT_Raw;
-extern const char *pMerchantsBuyPhrases[7];
-extern const char *pMerchantsSellPhrases[7];
-extern const char *pMerchantsRepairPhrases[7];
-extern const char *pMerchantsIdentifyPhrases[7];
+extern std::array<char *, 7> pMerchantsBuyPhrases;
+extern std::array<char *, 7> pMerchantsSellPhrases;
+extern std::array<char *, 7> pMerchantsRepairPhrases;
+extern std::array<char *, 7> pMerchantsIdentifyPhrases;
 extern char *pTransitionsTXT_Raw;
 extern char *pAutonoteTXT_Raw;
 extern char *pQuestsTXT_Raw;
 extern unsigned int    uNumTerrainNormals;
 extern struct Vec3_float_ *pTerrainNormals;
-extern unsigned short  pTerrainNormalIndices[128 * 128 * 2];
-extern unsigned int    pTerrainSomeOtherData[128 * 128 * 2];
+extern std::array<unsigned short, 128 * 128 * 2>  pTerrainNormalIndices;
+extern std::array<unsigned int, 128 * 128 * 2>    pTerrainSomeOtherData;
 extern char byte_76D5C0;
 extern struct unk_F7B60C stru_76D578;
 extern struct unk_F7B60C stru_76D590;
 extern struct unk_F7B60C stru_76D5A8;
-extern int terrain_76D5C8[128];
-extern int terrain_76D7C8[128];
-extern int terrain_76D9C8[128];
-extern int terrain_76DBC8[128];
-extern int terrain_76DDC8[128];
-extern int terrain_76DFC8[128];
-extern int terrain_76E1C8[128];
-extern int terrain_76E3C8[128];
+extern std::array<int, 128> terrain_76D5C8;
+extern std::array<int, 128> terrain_76D7C8;
+extern std::array<int, 128> terrain_76D9C8;
+extern std::array<int, 128> terrain_76DBC8;
+extern std::array<int, 128> terrain_76DDC8;
+extern std::array<int, 128> terrain_76DFC8;
+extern std::array<int, 128> terrain_76E1C8;
+extern std::array<int, 128> terrain_76E3C8;
 struct unk_F7B60C
 {
  int   some_data_ptr;  // dword @ 000000
@@ -1039,14 +1030,14 @@
 extern int dword_80AA1C; // weak
 extern int dword_80AA20; // weak
 extern unsigned int uNumElementsIn80AA28;
-extern struct stru148 *ptr_80AA28[];
+extern std::array<struct stru148 *, 2000> ptr_80AA28;
 extern struct Edge *pNewEdges;
 extern struct Surf *pSurfs;
 extern struct Edge *pEdges;
 extern struct Span *pSpans;
 extern struct Edge *ptr_80C978_Edges;
 extern struct Surf *ptr_80C97C_Surfs;
-extern struct Edge *ptr_80CA10[480];
+extern std::array<struct Edge *, 480> ptr_80CA10;
 extern _UNKNOWN unk_80D190; // weak
 extern int dword_A74C88; // weak
 extern unsigned int uPlayerCreationUI_SkySliderPos;
@@ -1056,34 +1047,34 @@
 extern struct Texture *pTexture_PlayerFaceMask;
 extern struct Texture *pTexture_PlayerFaceEradicated;
 extern struct Texture *pTexture_PlayerFaceDead;
-extern struct Texture *pTextures_PlayerFaces[4][56];
+extern std::array< std::array<struct Texture *, 56>, 4> pTextures_PlayerFaces;
 extern int dword_A75070; // weak
-extern struct Player *pPlayers[5];
+extern std::array<struct Player *, 5> pPlayers;
 extern __int64 qword_A750D8; // weak
 extern __int16 word_A750E0; // weak
 extern __int16 word_A750E2; // weak
-extern char *pClassNames[36];
-extern char *aCharacterConditionNames[19];
-extern char *pSkillNames[38];
-extern char byte_AE3368[]; // weak
+extern std::array<char *, 36> pClassNames;
+extern std::array<char *, 19> aCharacterConditionNames;
+extern std::array<char *, 38> pSkillNames;
+extern std::array<char, 777> byte_AE3368; // weak
 extern char byte_AE3369; // weak
 extern char byte_AE336A; // weak
 extern char byte_AE336B; // weak
 extern int dword_AE336C; // weak
 extern int dword_AE3370; // weak
 extern char byte_AE5B91; // weak
-extern int dword_F1B430[32]; // weak
-extern int player_levels[4];
-extern __int16 word_F8B158[]; // weak
+extern std::array<int, 32> dword_F1B430; // weak
+extern std::array<int, 4> player_levels;
+extern std::array<__int16, 777> word_F8B158; // weak
 extern struct Texture *ShopTexture; // idb
-extern struct Texture *ItemsInShopTexture[12];
+extern std::array<struct Texture *, 12> ItemsInShopTexture;
 extern __int16 word_F8B1A0; // weak
 extern const char *dword_F8B1A4; // idb
 extern int contract_approved; // weak
 extern int dword_F8B1AC_award_bit_number; // idb
 extern int dword_F8B1B0; // weak
 extern int gold_transaction_amount; // F8B1B4
-extern char *pShopOptions[4];
+extern std::array<char *, 4> pShopOptions;
 extern _UNKNOWN unk_F8B1C8; // weak
 extern int dword_F8B1D8; // weak
 extern int dword_F8B1DC; // weak
@@ -1091,8 +1082,8 @@
 extern int dword_F8B1E4; // weak
 extern const char *current_npc_text; // 0xF8B1E8
 extern char dialogue_show_profession_details; // weak
-extern char byte_F8B1EF[]; // weak
-extern char byte_F8B1F0[4];
+extern std::array<char, 777> byte_F8B1EF; // weak
+extern std::array<char, 4> byte_F8B1F0;
 extern int dword_F8B1F4; // weak
 
 
@@ -1101,8 +1092,8 @@
 //extern _UNKNOWN unk_F8BA50; // weak
 extern char byte_F8BC0C; // weak
 extern int bGameoverLoop; // weak
-extern __int16 intersect_face_vertex_coords_list_a[]; // word_F8BC48
-extern __int16 intersect_face_vertex_coords_list_b[]; // word_F8BD18
+extern std::array<__int16, 104> intersect_face_vertex_coords_list_a; // word_F8BC48
+extern std::array<__int16, 104> intersect_face_vertex_coords_list_b; // word_F8BD18
 //extern _UNKNOWN unk_F8EA04; // weak
 //extern _UNKNOWN unk_F8F8F8; // weak
 extern int dword_F93F20; // weak
@@ -1155,7 +1146,7 @@
 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID);
 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup);
 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2);
-void __cdecl PrepareArcomage();
+void  PrepareArcomage();
 
 // int __cdecl crt_retnull_sub();
 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor); // idb
--- a/stru159.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/stru159.h	Mon Jun 10 09:30:21 2013 +0600
@@ -8,7 +8,7 @@
 {
   char *video_name;
   int field_4;
-  int field_8;
+  int house_npc_id;
   unsigned __int8 uBuildingType;
   unsigned __int8 uRoomSoundId;
   unsigned __int16 padding_e;
@@ -16,4 +16,4 @@
 #pragma pack(pop)
 
 
-extern  const stru159 pAnimatedRooms[196];
\ No newline at end of file
+extern  std::array<const stru159, 196> pAnimatedRooms;
\ No newline at end of file
--- a/stru160.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/stru160.h	Mon Jun 10 09:30:21 2013 +0600
@@ -21,6 +21,6 @@
 };
 #pragma pack(pop)
 
-extern stru160 array_4EB8B8[66];
-extern stru160 array_4EBBD0[128];
-extern __int32 array_4EBBD0_x[128*3];
\ No newline at end of file
+extern std::array<stru160, 66> array_4EB8B8;
+extern std::array<stru160, 128> array_4EBBD0;
+extern std::array<__int32, 128*3> array_4EBBD0_x;
\ No newline at end of file
--- a/stru220.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/stru220.h	Mon Jun 10 09:30:21 2013 +0600
@@ -11,4 +11,4 @@
   __int16 distance;
 };
 #pragma pack(pop)
-extern stru220 stru_76E5C8[16384];
\ No newline at end of file
+extern std::array<stru220, 16384> stru_76E5C8;
\ No newline at end of file
--- a/stru6.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/stru6.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -56,7 +56,7 @@
     pArray1[i].field_8 = array_4EB8B8[i].field_8;
     pArray1[i].field_C = a2;
   }
-  memcpy(pArray2, array_4EBBD0_x/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160));
+  memcpy(pArray2, array_4EBBD0_x.data()/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160));
 }
 
 //----- (0047829F) --------------------------------------------------------
--- a/stru9.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/stru9.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -31,6 +31,7 @@
 
   //__debugbreak();
   //thisa = this;
+  return true;
 
   static RenderVertexSoft static_AE3FB4;
   /*static bool __init_flag1 = false;
--- a/texts.cpp	Mon Jun 10 09:30:12 2013 +0600
+++ b/texts.cpp	Mon Jun 10 09:30:21 2013 +0600
@@ -14,7 +14,7 @@
 
 static char *pGlobalTXT_Raw=NULL;
 
-char *pGlobalTXT_LocalizationStrings[MAX_LOC_STRINGS];
+std::array<char *, MAX_LOC_STRINGS> pGlobalTXT_LocalizationStrings;
 
 
 
--- a/texts.h	Mon Jun 10 09:30:12 2013 +0600
+++ b/texts.h	Mon Jun 10 09:30:21 2013 +0600
@@ -1,5 +1,5 @@
 #pragma once
-
+#include <array>
 
 
 int __cdecl sprintfex(char *buf, const char *format, ...);
@@ -168,7 +168,7 @@
 
 	};
 
-extern  char *pGlobalTXT_LocalizationStrings[MAX_LOC_STRINGS];
+  extern  std::array<char *, MAX_LOC_STRINGS> pGlobalTXT_LocalizationStrings;
 
 /*