Mercurial > mm7
diff StorylineTextTable.cpp @ 2283:53d4e8539ca1
StorylineText::Initialize using tokenizer
author | Grumpy7 |
---|---|
date | Fri, 14 Mar 2014 23:33:07 +0100 |
parents | aff7a7b072b7 |
children | bddcaf5d5db2 |
line wrap: on
line diff
--- a/StorylineTextTable.cpp Fri Mar 14 23:06:24 2014 +0100 +++ b/StorylineTextTable.cpp Fri Mar 14 23:33:07 2014 +0100 @@ -11,15 +11,8 @@ //----- (00453E6D) -------------------------------------------------------- void StorylineText::Initialize() - { - - int i; +{ char* test_string; - unsigned char c; - bool break_loop; - unsigned int temp_str_len; - char* tmp_pos; - int decode_step; if ( pHistoryTXT_Raw ) free(pHistoryTXT_Raw); @@ -33,46 +26,15 @@ StoreLine[0].f_9=0; StoreLine[0].f_A=0; StoreLine[0].f_B=0; + + for (int i=0;i<28;++i) + { + test_string = strtok(NULL, "\r") + 1; + auto tokens = Tokenize(test_string, '\t'); + + StoreLine[i+1].pText = RemoveQuotes(tokens[1]); + StoreLine[i+1].uTime = atoi(tokens[2]); //strange but in text here string not digit + StoreLine[i+1].pPageTitle = RemoveQuotes(tokens[3]); + } - for (i=0;i<29;++i) - { - test_string = strtok(NULL, "\r") + 1; - break_loop = false; - decode_step=0; - do - { - c = *(unsigned char*)test_string; - temp_str_len = 0; - while((c!='\t')&&(c>0)) - { - ++temp_str_len; - c=test_string[temp_str_len]; - } - tmp_pos=test_string+temp_str_len; - if (*tmp_pos == 0) - break_loop = true; - *tmp_pos = 0; - if (temp_str_len) - { - switch (decode_step) - { - case 1: - StoreLine[i+1].pText=RemoveQuotes(test_string); - break; - case 2: - StoreLine[i+1].uTime=atoi(test_string); //strange but in text here string not digit - break; - case 3: - StoreLine[i+1].pPageTitle=RemoveQuotes(test_string); - break; - } - } - else - { - break_loop = true; - } - ++decode_step; - test_string=tmp_pos+1; - } while ((decode_step<4)&&!break_loop); - } - } \ No newline at end of file +} \ No newline at end of file