Corrected issue on style loading

This commit is contained in:
Ray
2017-05-10 00:50:21 +02:00
parent 85f34d0b7f
commit b941f305a0

View File

@ -1423,23 +1423,26 @@ RAYGUIDEF void LoadGuiStyle(const char *fileName)
int counter = 0; int counter = 0;
FILE *styleFile = fopen(fileName, "rt"); FILE *styleFile = fopen(fileName, "rt");
while (!feof(styleFile)) if (styleFile != NULL)
{ {
fscanf(styleFile, "%s %i\n", styleProp[counter].id, &styleProp[counter].value); while (!feof(styleFile))
counter++;
}
fclose(styleFile);
for (int i = 0; i < counter; i++)
{
for (int j = 0; j < NUM_PROPERTIES; j++)
{ {
if (strcmp(styleProp[i].id, guiPropertyName[j]) == 0) fscanf(styleFile, "%s %i\n", styleProp[counter].id, &styleProp[counter].value);
counter++;
}
fclose(styleFile);
for (int i = 0; i < counter; i++)
{
for (int j = 0; j < NUM_PROPERTIES; j++)
{ {
// Assign correct property to style if (strcmp(styleProp[i].id, guiPropertyName[j]) == 0)
style[j] = styleProp[i].value; {
// Assign correct property to style
style[j] = styleProp[i].value;
}
} }
} }
} }