comparison StorylineTextTable.cpp @ 233:0df4136b6aac

store_line
author Gloval
date Sun, 17 Feb 2013 18:48:03 +0400
parents
children 2799737f8a74
comparison
equal deleted inserted replaced
230:b9f4ff2f6c45 233:0df4136b6aac
1 #include <stdlib.h>
2 #include <string.h>
3
4 #include "LOD.h"
5 #include "allocator.h"
6 #include "texts.h"
7 #include "StorylineTextTable.h"
8
9 char *pHistoryTXT_Raw;
10 struct StorylineText *pStorylineText;
11
12 //----- (00453E6D) --------------------------------------------------------
13 void StorylineText::Initialize()
14 {
15 char *v1; // ebx@1
16 StorylineText *v2; // esi@1
17 char *v3; // ecx@4
18 char v4; // dl@5
19 char *v5; // eax@5
20 int v6; // esi@9
21 int v7; // [sp+Ch] [bp-10h]@3
22 int v8; // [sp+10h] [bp-Ch]@4
23 char *v9; // [sp+14h] [bp-8h]@4
24 int Str; // [sp+18h] [bp-4h]@3
25 int i,j;
26 char* test_string;
27 unsigned char c;
28 bool break_loop;
29 unsigned int temp_str_len;
30 char* tmp_pos;
31 int decode_step;
32 v1 = 0;
33 v2 = this;
34 if ( pHistoryTXT_Raw )
35 pAllocator->FreeChunk(pHistoryTXT_Raw);
36 pHistoryTXT_Raw = NULL;
37 pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0);
38 strtok(pHistoryTXT_Raw, "\r");
39
40 for (i=0;i<29;++i)
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:
63 StoreLine[i+1].pText=RemoveQuotes(test_string);
64 break;
65 case 2:
66 StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit
67 break;
68 case 3:
69 StoreLine[i+1].pPageTitle=RemoveQuotes(test_string);
70 break;
71 }
72 }
73 else
74 {
75 break_loop = true;
76 }
77 ++decode_step;
78 test_string=tmp_pos+1;
79 } while ((decode_step<4)&&!break_loop);
80 }
81 }