Skip to content

Commit

Permalink
fix: RemoveArgs only remove the first occurence of an argument
Browse files Browse the repository at this point in the history
Make sure we remove all the occurence of the passed argument

This fix profile loading not working correctly when there are two occurence of iwad, one passed through command line and another from the profile commandline.txt if the cvar cmdlineprofile is set before starting the game

(cherry picked from commit b3654fe)
  • Loading branch information
emawind84 committed Jul 10, 2024
1 parent 4270122 commit 27d4f2d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/common/utility/m_argv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,21 @@ FString FArgs::TakeValue(const char *check)

void FArgs::RemoveArgs(const char *check)
{
int i = CheckParm(check);

if (i > 0 && i < (int)Argv.Size() - 1)
int i = 0;
do
{
do
i = CheckParm(check);

if (i > 0 && i < (int)Argv.Size() - 1)
{
RemoveArg(i);
do
{
RemoveArg(i);
}
while (Argv[i][0] != '+' && Argv[i][0] != '-' && i < (int)Argv.Size() - 1);
}
while (Argv[i][0] != '+' && Argv[i][0] != '-' && i < (int)Argv.Size() - 1);
}
while (i > 0);
}

//===========================================================================
Expand Down

0 comments on commit 27d4f2d

Please sign in to comment.