• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Révisionab01759a332d40b16c467246cbed2f9491da7a5b (tree)
l'heure2023-02-05 00:00:50
AuteurAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Message de Log

Fixed the DONTSEPARATETEAMS flag not being handled properly.

Change Summary

Modification

diff -r 67e4d8fd109d -r ab01759a332d src/scoreboard.cpp
--- a/src/scoreboard.cpp Thu Feb 02 19:25:23 2023 -0500
+++ b/src/scoreboard.cpp Sat Feb 04 10:00:50 2023 -0500
@@ -1924,8 +1924,8 @@
19241924 {
19251925 int result = 0;
19261926
1927- // [AK] Sanity check: make sure that we're pointing to a rank order.
1928- if ( pRankOrder == NULL )
1927+ // [AK] Sanity check: make sure that we're pointing to a scoreboard.
1928+ if ( pScoreboard == NULL )
19291929 return false;
19301930
19311931 // [AK] Always return false if the first player index is invalid,
@@ -1944,7 +1944,7 @@
19441944
19451945 // [AK] In team-based game modes, order players by team. Players with lower
19461946 // team indices should come before those with higher indices.
1947- if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS )
1947+ if ( pScoreboard->ShouldSeparateTeams( ))
19481948 {
19491949 result = players[arg1].Team - players[arg2].Team;
19501950
@@ -1952,13 +1952,13 @@
19521952 return ( result < 0 );
19531953 }
19541954
1955- for ( unsigned int i = 0; i < pRankOrder->Size( ); i++ )
1955+ for ( unsigned int i = 0; i < pScoreboard->RankOrder.Size( ); i++ )
19561956 {
1957- if (( *pRankOrder )[i]->IsDisabled( ))
1957+ if ( pScoreboard->RankOrder[i]->IsDisabled( ))
19581958 continue;
19591959
1960- const ColumnValue Value1 = ( *pRankOrder )[i]->GetValue( arg1 );
1961- const ColumnValue Value2 = ( *pRankOrder )[i]->GetValue( arg2 );
1960+ const ColumnValue Value1 = pScoreboard->RankOrder[i]->GetValue( arg1 );
1961+ const ColumnValue Value2 = pScoreboard->RankOrder[i]->GetValue( arg2 );
19621962
19631963 // [AK] Always return false if the data type of the first value is unknown.
19641964 // This is also the case when both values have unknown data types.
@@ -2001,7 +2001,7 @@
20012001
20022002 // [AK] If the values for this column aren't the same for both players, return the result.
20032003 if ( result != 0 )
2004- return (( *pRankOrder )[i]->GetFlags( ) & COLUMNFLAG_REVERSEORDER ) ? ( result < 0 ) : ( result > 0 );
2004+ return ( pScoreboard->RankOrder[i]->GetFlags( ) & COLUMNFLAG_REVERSEORDER ) ? ( result < 0 ) : ( result > 0 );
20052005 }
20062006
20072007 return false;
@@ -2053,7 +2053,7 @@
20532053 for ( ULONG ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
20542054 ulPlayerList[ulIdx] = ulIdx;
20552055
2056- std::stable_sort( ulPlayerList, ulPlayerList + MAXPLAYERS, PlayerComparator( &RankOrder ));
2056+ std::stable_sort( ulPlayerList, ulPlayerList + MAXPLAYERS, PlayerComparator( this ));
20572057 }
20582058
20592059 //*****************************************************************************
@@ -2138,7 +2138,7 @@
21382138 // [AK] Add the total height of all rows for active players.
21392139 if ( ulNumActivePlayers > 0 )
21402140 {
2141- if (( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) && (( ulFlags & SCOREBOARDFLAG_DONTSEPARATETEAMS ) == false ))
2141+ if ( ShouldSeparateTeams( ))
21422142 {
21432143 for ( ULONG ulTeam = 0; ulTeam < teams.Size( ); ulTeam++ )
21442144 {
@@ -2219,7 +2219,7 @@
22192219
22202220 // [AK] In team-based game modes, if the previous player is on a different team than
22212221 // the current player, leave a gap between both teams and make the row background light.
2222- if (( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) && ( ulIdx > 0 ) && ( players[ulPlayer].Team != players[ulPlayerList[ulIdx - 1]].Team ))
2222+ if (( ShouldSeparateTeams( )) && ( ulIdx > 0 ) && ( players[ulPlayer].Team != players[ulPlayerList[ulIdx - 1]].Team ))
22232223 {
22242224 lYPos += lRowHeight;
22252225 bUseLightBackground = true;
@@ -2449,6 +2449,19 @@
24492449
24502450 //*****************************************************************************
24512451 //
2452+// [AK] Scoreboard::ShouldSeparateTeams
2453+//
2454+// Checks if the scoreboard should separate players into their respective teams.
2455+//
2456+//*****************************************************************************
2457+
2458+bool Scoreboard::ShouldSeparateTeams( void ) const
2459+{
2460+ return (( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) && (( ulFlags & SCOREBOARDFLAG_DONTSEPARATETEAMS ) == false ));
2461+}
2462+
2463+//*****************************************************************************
2464+//
24522465 // [AK] SCOREBOARD_GetColumn
24532466 //
24542467 // Returns a pointer to a column by searching for its name.
diff -r 67e4d8fd109d -r ab01759a332d src/scoreboard.h
--- a/src/scoreboard.h Thu Feb 02 19:25:23 2023 -0500
+++ b/src/scoreboard.h Sat Feb 04 10:00:50 2023 -0500
@@ -392,14 +392,15 @@
392392 void DrawBorder( const EColorRange Color, LONG &lYPos, const bool bReverse ) const;
393393 void DrawRowBackground( const PalEntry color, int x, int y, int width, int height, const float fAlpha ) const;
394394 void DrawRowBackground( const PalEntry color, const int y, const float fAlpha ) const;
395+ bool ShouldSeparateTeams( void ) const;
395396
396397 private:
397398 struct PlayerComparator
398399 {
399- PlayerComparator( TArray<DataScoreColumn *> *pList ) : pRankOrder( pList ) { }
400+ PlayerComparator( Scoreboard *pOtherScoreboard ) : pScoreboard( pOtherScoreboard ) { }
400401 bool operator( )( const int &arg1, const int &arg2 ) const;
401402
402- const TArray<DataScoreColumn *> *pRankOrder;
403+ const Scoreboard *pScoreboard;
403404 };
404405
405406 ULONG ulPlayerList[MAXPLAYERS];
Afficher sur ancien navigateur de dépôt.