tweak(ini): Improve consistency in use of INI::getNextTokenOrNull#2597
Draft
Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Draft
tweak(ini): Improve consistency in use of INI::getNextTokenOrNull#2597Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Caball009 wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains two changes that may change behavior:
for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull())->for (const char* token = ini->getNextTokenOrNull(); token; token = ini->getNextTokenOrNull())GeneralsGameCode/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
Lines 1439 to 1449 in 4de60c2
Line 1447 is unnecessary / undesirable.
Note on the first change
WRT the first change, it's not possible to have all loops match this format:
for (const char* token = ini->getNextToken(); token; token = ini->getNextTokenOrNull())because some lines in the standard ini files are incomplete and so the token may be empty. I came across two types of incomplete lines:https://github.com/TheSuperHackers/GeneralsGamePatch/blob/5845293dd12ab10c5f16c6f3116ce526f62dc369/Patch104pZH/GameFilesOriginalZH/Data/INI/SoundEffects.ini#L333
https://github.com/TheSuperHackers/GeneralsGamePatch/blob/5845293dd12ab10c5f16c6f3116ce526f62dc369/Patch104pZH/GameFilesOriginalZH/Data/INI/Object/ChemicalGeneral.ini#L10693
GeneralsGameCode/Core/GameEngine/Source/Common/INI/INI.cpp
Lines 1871 to 1872 in 4de60c2
GeneralsGameCode/GeneralsMD/Code/GameEngine/Include/Common/BitFlagsIO.h
Line 70 in 4de60c2