mirror of
https://github.com/alexbatalov/fallout2-ce.git
synced 2024-09-04 13:59:04 +00:00
Fix ini section parsing
This commit is contained in:
parent
67351b8b09
commit
a70912d311
@ -379,10 +379,25 @@ static bool configParseLine(Config* config, char* string)
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
// Find opening bracket.
|
||||
pch = strchr(string, '[');
|
||||
if (pch != NULL) {
|
||||
char* sectionKey = pch + 1;
|
||||
// CE: Original implementation treats any line with brackets as section key.
|
||||
// The problem can be seen when loading Olympus settings (ddraw.ini), which
|
||||
// contains the following line:
|
||||
//
|
||||
// ```ini
|
||||
// VersionString=Olympus 2207 [Complete].
|
||||
// ```
|
||||
//
|
||||
// It thinks that [Complete] is a start of new section, and puts remaining
|
||||
// keys there.
|
||||
|
||||
// Skip leading whitespace.
|
||||
while (isspace(*string)) {
|
||||
string++;
|
||||
}
|
||||
|
||||
// Check if it's a section key.
|
||||
if (*string == '[') {
|
||||
char* sectionKey = string + 1;
|
||||
|
||||
// Find closing bracket.
|
||||
pch = strchr(sectionKey, ']');
|
||||
|
Loading…
Reference in New Issue
Block a user