Fixed BITDW level name

This commit is contained in:
NoHomoBoi 2020-09-13 16:44:24 -05:00
parent 8f5b1b74c2
commit b20e3c7940
1 changed files with 8 additions and 5 deletions

View File

@ -104,21 +104,24 @@ void load_language(char* jsonTxt, s8 language){
const cJSON *act = NULL; const cJSON *act = NULL;
char* courseName = cJSON_GetObjectItemCaseSensitive(course, "course")->valuestring; char* courseName = cJSON_GetObjectItemCaseSensitive(course, "course")->valuestring;
languages[language]->courses[courseID] = getTranslatedText(courseName); if(courseID + 1 <= cJSON_GetArraySize(courses) - 1){
courseID++; languages[language]->courses[courseID] = getTranslatedText(courseName);
courseID++;
}
cJSON_ArrayForEach(act, acts) { cJSON_ArrayForEach(act, acts) {
languages[language]->acts[actID] = getTranslatedText(act->valuestring); languages[language]->acts[actID] = getTranslatedText(act->valuestring);
actSize += strlen(act->valuestring); actSize += strlen(act->valuestring);
actID++; actID++;
} }
actAmount += cJSON_GetArraySize(acts); actAmount += cJSON_GetArraySize(acts);
actSize += strlen(courseName); actSize += strlen(courseName);
} }
languages[language]->acts = realloc(languages[language]->acts, sizeof(u8*) * (actAmount * actSize)); languages[language]->acts = realloc(languages[language]->acts, sizeof(u8*) * (actAmount * actSize));
cJSON_ArrayForEach(secret, secrets) { cJSON_ArrayForEach(secret, secrets) {
languages[language]->courses[courseID] = getTranslatedText(secret->valuestring); languages[language]->courses[courseID] = getTranslatedText(secret->valuestring);
courseID++; courseID++;
} }