Closed Meerkov closed 3 years ago
The issue is around line ~570 in GameLogicComponent.
It reuses the TextArea object instead of creating a new one for each paragraph. Making this change fixes the duplicated text issue...
New code should be something like this
string myLanguage = ""; cJSON_ArrayForEach(detectedLanguage, detectedLanguages) { const cJSON *languageCode = cJSON_GetObjectItemCaseSensitive(detectedLanguage, "languageCode"); myLanguage = languageCode->valuestring; //LogMsg("Found language %s", languageCode->valuestring); } const cJSON *paragraph; const cJSON *paragraphs = cJSON_GetObjectItemCaseSensitive(block, "paragraphs"); int paraCount = 0; cJSON_ArrayForEach(paragraph, paragraphs) { TextArea textArea; // assert(paraCount == 0 && "Should only be one of these!"); ReadFromParagraph(paragraph, textArea); textArea.language = myLanguage; if (textArea.m_rect.get_width() > 5 && textArea.m_rect.get_height() > 5) m_textareas.push_back(textArea); paraCount++; }
Thanks, applied this fix
The issue is around line ~570 in GameLogicComponent.
It reuses the TextArea object instead of creating a new one for each paragraph. Making this change fixes the duplicated text issue...
New code should be something like this