Skip to content

Commit

Permalink
Merge pull request #959 from UltraStar-Deluxe/fix-default-player-colors
Browse files Browse the repository at this point in the history
fix default player colors, we should not reference I outside the loop
  • Loading branch information
barbeque-squared authored Feb 8, 2025
2 parents 0e9ce45 + fd4b8f0 commit 3148cc0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/base/UIni.pas
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ TInputDeviceConfig = record
// * it should be possible to play with 5 players [without duplicating a lot of code]
// * there might be a valid usecase for 0 players
IMaxPlayerCount = 12;
// Switch colors for players 2 and 4, since player 2 line color is used
// for the second part in duet, and yellow (4) looks better than red (2)
DefaultPlayerColors: array[0..IMaxPlayerCount-1] of integer = (1, 4, 3, 2, 5, 6, 7, 8, 9, 10, 11, 12);
IPlayers: array[0..4] of UTF8String = ('1', '2', '3', '4', '6');
IPlayersVals: array[0..4] of integer = ( 1 , 2 , 3 , 4 , 6 );

Expand Down Expand Up @@ -1414,18 +1417,13 @@ procedure TIni.Load();
// Name
Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1));
// Color Player
PlayerColor[I] := IniFile.ReadInteger('PlayerColor', 'P'+IntToStr(I+1), I + 1);
PlayerColor[I] := IniFile.ReadInteger('PlayerColor', 'P'+IntToStr(I+1), DefaultPlayerColors[I]);
// Avatar Player
PlayerAvatar[I] := IniFile.ReadString('PlayerAvatar', 'P'+IntToStr(I+1), '');
// Level Player
PlayerLevel[I] := IniFile.ReadInteger('PlayerLevel', 'P'+IntToStr(I+1), 0);
end;

// Switch colors for players 2 and 4, since player 2 line color is used
// for the second part in duet, and yellow (4) looks better than red (2)
PlayerColor[1] := IniFile.ReadInteger('PlayerColor', 'P'+IntToStr(I+1), 4);
PlayerColor[3] := IniFile.ReadInteger('PlayerColor', 'P'+IntToStr(I+1), 2);

// Color Team
for I := 0 to 2 do
TeamColor[I] := IniFile.ReadInteger('TeamColor', 'T'+IntToStr(I+1), I + 1);
Expand Down

0 comments on commit 3148cc0

Please sign in to comment.