Change:
Code:
SectionExists(file, setting_section[])
{
// Seek to setting's section
new linedata[96], section[64]
while (!feof(file))
{
// Read one line at a time
fgets(file, linedata, charsmax(linedata))
// Replace newlines with a null character
replace(linedata, charsmax(linedata), "^n", "")
// New section starting
if (linedata[0] == '[')
{
// Store section name without braces
copyc(section, charsmax(section), linedata[1], ']')
// Is this our setting's section?
if (equal(section, setting_section))
return true;
}
}
return false;
}
To:
Code:
SectionExists(file, setting_section[])
{
// Seek to setting's section
new linedata[96], section[64]
while (!feof(file))
{
// Read one line at a time
fgets(file, linedata, charsmax(linedata))
// Replace newlines with a null character
replace(linedata, charsmax(linedata), "^n", "")
// New section starting
if (linedata[0] == '[')
{
// Store Section Name
formatex(section, charsmax(section), "[%s]", setting_section)
// Is this our setting's section?
if(equal(linedata, section, strlen(section)))
return true;
}
}
return false;
}
For Fix this bug when save/load section with [ or ] chars:
https://imgur.com/u28wrhP
__________________