2499
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
2541
|
6
|
|
7 #include "Engine/Engine.h"
|
|
8
|
2499
|
9 #include "FactionTable.h"
|
|
10 #include "../LOD.h"
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15 //----- (004547E4) --------------------------------------------------------
|
|
16 void FactionTable::Initialize()
|
|
17 {
|
|
18 int i;
|
|
19 char* test_string;
|
|
20 unsigned char c;
|
|
21 bool break_loop;
|
|
22 unsigned int temp_str_len;
|
|
23 char* tmp_pos;
|
|
24 int decode_step;
|
|
25 // int item_counter;
|
|
26
|
|
27 free(pHostileTXT_Raw);
|
|
28 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0);
|
|
29 strtok(pHostileTXT_Raw, "\r");
|
|
30 for (i = 0; i < 89; ++i)
|
|
31 {
|
|
32 test_string = strtok(NULL, "\r") + 1;
|
|
33 break_loop = false;
|
|
34 decode_step = 0;
|
|
35 do
|
|
36 {
|
|
37 c = *(unsigned char*)test_string;
|
|
38 temp_str_len = 0;
|
|
39 while ((c != '\t') && (c > 0))
|
|
40 {
|
|
41 ++temp_str_len;
|
|
42 c = test_string[temp_str_len];
|
|
43 }
|
|
44 tmp_pos = test_string + temp_str_len;
|
|
45 if (*tmp_pos == 0)
|
|
46 break_loop = true;
|
|
47 *tmp_pos = 0;
|
|
48 if (temp_str_len)
|
|
49 {
|
|
50 if (decode_step >= 1 && decode_step < 90)
|
|
51 relations[decode_step - 1][i] = atoi(test_string);
|
|
52 }
|
|
53 else
|
|
54 break_loop = true;
|
|
55 ++decode_step;
|
|
56 test_string = tmp_pos + 1;
|
|
57 } while ((decode_step < 92) && !break_loop);
|
|
58 }
|
|
59 free(pHostileTXT_Raw);
|
|
60 pHostileTXT_Raw = nullptr;
|
|
61 }
|