Mercurial > mm7
annotate StorylineTextTable.cpp @ 1743:26c1a3d50635
Merge
author | Ritor1 |
---|---|
date | Thu, 26 Sep 2013 23:42:25 +0600 |
parents | 75fafd8ced59 |
children | d28d3c006077 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
338
diff
changeset
|
4 |
233 | 5 #include <stdlib.h> |
6 #include <string.h> | |
7 | |
8 #include "LOD.h" | |
9 #include "texts.h" | |
10 #include "StorylineTextTable.h" | |
11 | |
12 char *pHistoryTXT_Raw; | |
13 struct StorylineText *pStorylineText; | |
14 | |
15 //----- (00453E6D) -------------------------------------------------------- | |
16 void StorylineText::Initialize() | |
237 | 17 { |
18 | |
19 int i; | |
233 | 20 char* test_string; |
21 unsigned char c; | |
22 bool break_loop; | |
23 unsigned int temp_str_len; | |
24 char* tmp_pos; | |
25 int decode_step; | |
26 | |
237 | 27 if ( pHistoryTXT_Raw ) |
1583 | 28 free(pHistoryTXT_Raw); |
237 | 29 pHistoryTXT_Raw = NULL; |
30 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); | |
31 strtok(pHistoryTXT_Raw, "\r"); | |
32 | |
338 | 33 StoreLine[0].pText=nullptr; |
34 StoreLine[0].pPageTitle=nullptr; | |
35 StoreLine[0].uTime=0; | |
36 StoreLine[0].f_9=0; | |
37 StoreLine[0].f_A=0; | |
38 StoreLine[0].f_B=0; | |
39 | |
237 | 40 for (i=0;i<29;++i) |
233 | 41 { |
42 test_string = strtok(NULL, "\r") + 1; | |
43 break_loop = false; | |
44 decode_step=0; | |
45 do | |
46 { | |
47 c = *(unsigned char*)test_string; | |
48 temp_str_len = 0; | |
49 while((c!='\t')&&(c>0)) | |
50 { | |
51 ++temp_str_len; | |
52 c=test_string[temp_str_len]; | |
53 } | |
54 tmp_pos=test_string+temp_str_len; | |
55 if (*tmp_pos == 0) | |
56 break_loop = true; | |
57 *tmp_pos = 0; | |
58 if (temp_str_len) | |
59 { | |
60 switch (decode_step) | |
61 { | |
62 case 1: | |
329 | 63 StoreLine[i+1].pText=RemoveQuotes(test_string); |
233 | 64 break; |
65 case 2: | |
329 | 66 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit |
233 | 67 break; |
68 case 3: | |
329 | 69 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); |
233 | 70 break; |
71 } | |
72 } | |
73 else | |
74 { | |
237 | 75 break_loop = true; |
233 | 76 } |
77 ++decode_step; | |
78 test_string=tmp_pos+1; | |
79 } while ((decode_step<4)&&!break_loop); | |
80 } | |
237 | 81 } |