World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
FactionTable.cpp
См. документацию.
2 
3 #include "Engine/Engine.h"
4 
5 #include "../LOD.h"
6 
7 //----- (004547E4) --------------------------------------------------------
9  int i;
10  char* test_string;
11  unsigned char c;
12  bool break_loop;
13  unsigned int temp_str_len;
14  char* tmp_pos;
15  int decode_step;
16  // int item_counter;
17 
18  free(pHostileTXT_Raw);
19  pHostileTXT_Raw = (char*)pEvents_LOD->LoadCompressedTexture("hostile.txt");
20  strtok(pHostileTXT_Raw, "\r");
21  for (i = 0; i < 89; ++i) {
22  test_string = strtok(NULL, "\r") + 1;
23  break_loop = false;
24  decode_step = 0;
25  do {
26  c = *(unsigned char*)test_string;
27  temp_str_len = 0;
28  while ((c != '\t') && (c > 0)) {
29  ++temp_str_len;
30  c = test_string[temp_str_len];
31  }
32  tmp_pos = test_string + temp_str_len;
33  if (*tmp_pos == 0) break_loop = true;
34  *tmp_pos = 0;
35  if (temp_str_len) {
36  if (decode_step >= 1 && decode_step < 90)
37  relations[decode_step - 1][i] = atoi(test_string);
38  } else {
39  break_loop = true;
40  }
41  ++decode_step;
42  test_string = tmp_pos + 1;
43  } while ((decode_step < 92) && !break_loop);
44  }
45  free(pHostileTXT_Raw);
46  pHostileTXT_Raw = nullptr;
47 }
LOD::File::LoadCompressedTexture
void * LoadCompressedTexture(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:921
FactionTable.h
Engine.h
pHostileTXT_Raw
char * pHostileTXT_Raw
Definition: mm7_data.cpp:681
pEvents_LOD
LODFile_IconsBitmaps * pEvents_LOD
Definition: LOD.cpp:10
FactionTable::relations
char relations[89][89]
Definition: FactionTable.h:8
FactionTable::Initialize
void Initialize()
Definition: FactionTable.cpp:8
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096