diff UI/UIHouses.cpp @ 2355:a574a80e7012

Moving more functions out of unsorted_subs
author Grumpy7
date Wed, 09 Apr 2014 22:58:22 +0200
parents 7c10dfb6d802
children bddcaf5d5db2
line wrap: on
line diff
--- a/UI/UIHouses.cpp	Wed Apr 09 21:58:46 2014 +0200
+++ b/UI/UIHouses.cpp	Wed Apr 09 22:58:22 2014 +0200
@@ -3072,4 +3072,233 @@
   jail_dialogue_window.uFrameZ = 334;
   jail_dialogue_window.DrawTitleText(pFontArrus, 0, (310 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[672], &jail_dialogue_window, 0, 0)) / 2 + 18,
      Color16(0xFFu, 0xFFu, 0x9Bu), pGlobalTXT_LocalizationStrings[672], 3);//"За многочисленные преступления и злодеяния вы были приговорены к одному году заключения."
+}
+
+
+//----- (00443801) --------------------------------------------------------
+void InitializeBuildingResidents()
+{
+
+  int i;
+  char* test_string;
+  unsigned char c;
+  bool break_loop;
+  unsigned int temp_str_len;
+  char* tmp_pos;
+  int decode_step;
+
+  if ( p2DEventsTXT_Raw )
+    free(p2DEventsTXT_Raw);
+  p2DEventsTXT_Raw = NULL;
+  p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
+  strtok(p2DEventsTXT_Raw, "\r");
+  strtok(NULL, "\r");
+
+  for (i=0;i<525;++i)
+  {
+    test_string = strtok(NULL, "\r") + 1;
+    break_loop = false;
+    decode_step=0;
+    do 
+    {
+      c = *(unsigned char*)test_string;
+      temp_str_len = 0;
+      while((c!='\t')&&(c>0))
+      {
+        ++temp_str_len;
+        c=test_string[temp_str_len];
+      }		
+      tmp_pos=test_string+temp_str_len;
+      if (*tmp_pos == 0)
+        break_loop = true;
+      *tmp_pos = 0;
+      if (temp_str_len)
+      {
+        switch (decode_step)
+        {
+        case 2:
+          {
+            if ( !_strnicmp(test_string, "wea", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_WeaponShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "arm", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_ArmorShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mag", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_MagicShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "alc", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_AlchemistShop;
+              break;
+            }
+            if ( !_strnicmp(test_string, "sta", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Stables;
+              break;
+            }
+            if ( !_strnicmp(test_string, "boa", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Boats;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tem", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Temple;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tra", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Training;
+              break;
+            }
+            if ( !_strnicmp(test_string, "tow", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_TownHall;
+              break;
+            }
+
+            if ( !_strnicmp(test_string, "tav", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Tavern;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ban", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_Bank;
+              break;
+            }
+            if ( !_strnicmp(test_string, "fir", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_FireGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "air", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_AirGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "wat", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_WaterGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ear", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_EarthGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "spi", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_SpiritGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "min", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_MindGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "bod", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_BodyGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "lig", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_LightGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "dar", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_DarkGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6
+            {
+              p2DEvents[i].uType = BuildingType_ElementalGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "sel", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_SelfGuild;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mir", 3) )
+            {
+              p2DEvents[i].uType = BuildingType_16;
+              break;
+            }
+            if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6
+            {
+              p2DEvents[i].uType = BuildingType_TownHall;
+              break;
+            }
+            p2DEvents[i].uType = BuildingType_18;
+          }
+          break;
+
+        case 4:
+          p2DEvents[i].uAnimationID = atoi(test_string);
+          break;
+        case 5:
+          p2DEvents[i].pName = RemoveQuotes(test_string);
+          break;
+        case 6:
+          p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
+          break;
+        case 7:
+          p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
+          break;
+        case 8:
+          p2DEvents[i].field_14 = atoi(test_string);
+          break;
+        case 9:
+          p2DEvents[i]._state = atoi(test_string);
+          break;
+        case 10:
+          p2DEvents[i]._rep = atoi(test_string);
+          break;
+        case 11:
+          p2DEvents[i]._per = atoi(test_string);
+          break;
+        case 12:
+          p2DEvents[i].fPriceMultiplier = atof(test_string);
+          break;
+        case 13:
+          p2DEvents[i].flt_24 = atof(test_string);
+          break;
+        case 15:
+          p2DEvents[i].field_1C = atoi(test_string);
+          break;
+        case 18:
+          p2DEvents[i].uOpenTime = atoi(test_string);
+          break;
+        case 19:
+          p2DEvents[i].uCloseTime = atoi(test_string);
+          break;
+        case 20:
+          p2DEvents[i].uExitPicID = atoi(test_string);
+          break;
+        case 21:
+          p2DEvents[i].uExitMapID = atoi(test_string);
+          break;
+        case 22:
+          p2DEvents[i]._quest_related = atoi(test_string);
+          break;
+        case 23:
+          p2DEvents[i].pEnterText = RemoveQuotes(test_string);
+          break;
+        }
+      }
+      ++decode_step;
+      test_string=tmp_pos+1;
+    } while ((decode_step<24)&&!break_loop);
+  }
+
 }
\ No newline at end of file