Mercurial > mm7
annotate FrameTableInc.cpp @ 2300:4c3f91554be8
stru319::GetMagicalResistance renamed to stru319::DoesDmgTypeDoDamage
author | Grumpy7 |
---|---|
date | Sun, 16 Mar 2014 19:58:02 +0100 |
parents | aff7a7b072b7 |
children | f4af3b203f65 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
703
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
0 | 2 #include "FrameTableInc.h" |
701 | 3 #include <memory.h> |
4 //identical function to work in differnt threads | |
5 | |
6 //----- (004BE3BF) -------------------------------------------------------- | |
703 | 7 FrameTableTxtLine* txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) |
701 | 8 { |
9 bool new_token_flag; // edx@3 | |
10 bool in_quotes; // [sp+Ch] [bp-4h]@3 | |
11 char* parse_pos; | |
12 unsigned char test_char; | |
13 int i; | |
14 | |
15 static char tokens_buff1[1000]; | |
16 static struct FrameTableTxtLine temp_tokens_table1; // weak | |
17 | |
18 temp_tokens_table1.uPropCount = 0; | |
0 | 19 |
701 | 20 if ( str_to_parse && *str_to_parse ) |
21 { | |
22 parse_pos=(char*)str_to_parse; | |
23 new_token_flag = true; | |
24 in_quotes = false; | |
25 for(i = 0; (i<1000)&&(temp_tokens_table1.uPropCount < 30) ; ++i) | |
26 { | |
27 test_char=*parse_pos; | |
28 tokens_buff1[i]=test_char; | |
29 if ( !test_char ) | |
30 break; | |
31 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) | |
32 { | |
33 if ( test_char == '"' ) | |
34 { | |
35 tokens_buff1[i]= '\0'; | |
36 new_token_flag = true; | |
37 if ( in_quotes ) | |
38 in_quotes = false; | |
39 else | |
40 { | |
41 in_quotes = true; | |
42 if ( *(parse_pos+1) == '"' ) | |
43 { | |
44 temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; | |
45 ++temp_tokens_table1.uPropCount; | |
46 } | |
47 } | |
48 } | |
49 else | |
50 { | |
51 if ( new_token_flag ) | |
52 { | |
53 temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; | |
54 ++temp_tokens_table1.uPropCount; | |
55 } | |
56 new_token_flag = false; | |
57 } | |
58 } | |
59 else | |
60 { | |
61 tokens_buff1[i]= '\0'; | |
62 new_token_flag = true; | |
63 } | |
64 ++parse_pos; | |
65 } | |
66 tokens_buff1[i]= '\0'; | |
67 } | |
68 memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine)); | |
69 return tokens_table; | |
70 } | |
71 // F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58; | |
72 | |
73 //----- (004BE485) -------------------------------------------------------- | |
74 FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) | |
75 { | |
76 bool new_token_flag; // edx@3 | |
77 bool in_quotes; // [sp+Ch] [bp-4h]@3 | |
78 char* parse_pos; | |
79 unsigned char test_char; | |
80 int i; | |
81 | |
82 static char tokens_buff2[1000]; | |
83 static struct FrameTableTxtLine temp_tokens_table2; // weak | |
84 temp_tokens_table2.uPropCount = 0; | |
85 | |
86 if ( str_to_parse && *str_to_parse ) | |
87 { | |
88 parse_pos=(char*)str_to_parse; | |
89 new_token_flag = true; | |
90 in_quotes = false; | |
91 for(i = 0; (i<1000)&&(temp_tokens_table2.uPropCount < 30); ++i) | |
92 { | |
93 test_char=*parse_pos; | |
94 tokens_buff2[i]=test_char; | |
95 if ( !test_char ) | |
96 break; | |
97 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) | |
98 { | |
99 if ( test_char == '"' ) | |
100 { | |
101 tokens_buff2[i]= '\0'; | |
102 new_token_flag = true; | |
103 if ( in_quotes ) | |
104 in_quotes = false; | |
105 else | |
106 { | |
107 in_quotes = true; | |
108 if ( *(parse_pos+1) == '"' ) | |
109 { | |
110 temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; | |
111 ++temp_tokens_table2.uPropCount; | |
112 } | |
113 } | |
114 } | |
115 else | |
116 { | |
117 if ( new_token_flag ) | |
118 { | |
119 temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; | |
120 ++temp_tokens_table2.uPropCount; | |
121 } | |
122 new_token_flag = false; | |
123 } | |
124 } | |
125 else | |
126 { | |
127 tokens_buff2[i]= '\0'; | |
128 new_token_flag = true; | |
129 } | |
130 ++parse_pos; | |
131 } | |
132 | |
133 tokens_buff2[i]= '\0'; | |
134 } | |
135 memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine)); | |
136 return tokens_table; | |
137 } | |
138 |