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