annotate Engine/Tables/FactionTable.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents a902abdfc7f2
children
rev   line source
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
6
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
7 #include "Engine/Engine.h"
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
8
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
9 #include "FactionTable.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
10 #include "../LOD.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
12
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
15 //----- (004547E4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
16 void FactionTable::Initialize()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
17 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
18 int i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
19 char* test_string;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
20 unsigned char c;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
21 bool break_loop;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
22 unsigned int temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
23 char* tmp_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
24 int decode_step;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
25 // int item_counter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
27 free(pHostileTXT_Raw);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
28 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
29 strtok(pHostileTXT_Raw, "\r");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
30 for (i = 0; i < 89; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
31 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
32 test_string = strtok(NULL, "\r") + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
33 break_loop = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
34 decode_step = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
35 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
36 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
37 c = *(unsigned char*)test_string;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
38 temp_str_len = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
39 while ((c != '\t') && (c > 0))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
40 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
41 ++temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
42 c = test_string[temp_str_len];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
43 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
44 tmp_pos = test_string + temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
45 if (*tmp_pos == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
46 break_loop = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
47 *tmp_pos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
48 if (temp_str_len)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
49 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
50 if (decode_step >= 1 && decode_step < 90)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
51 relations[decode_step - 1][i] = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
52 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
53 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
54 break_loop = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
55 ++decode_step;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
56 test_string = tmp_pos + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
57 } while ((decode_step < 92) && !break_loop);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
58 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
59 free(pHostileTXT_Raw);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
60 pHostileTXT_Raw = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
61 }