Revision | bb0847e0ac03293f3ea68f9887a9b9bd886d0d49 (tree) |
---|---|
Time | 2021-06-01 13:37:29 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Added the function CALLVOTE_GetPlayerVoteChoice which returns whatever choice a player made during a vote.
@@ -85,6 +85,7 @@ | ||
85 | 85 | static ULONG g_ulPlayersWhoVotedNo[(MAXPLAYERS / 2) + 1]; |
86 | 86 | static NETADDRESS_s g_KickVoteVictimAddress; |
87 | 87 | static std::list<VOTE_s> g_PreviousVotes; |
88 | +static ULONG g_ulPlayerVoteChoice[MAXPLAYERS]; // [AK] | |
88 | 89 | |
89 | 90 | //***************************************************************************** |
90 | 91 | // PROTOTYPES |
@@ -289,6 +290,10 @@ | ||
289 | 290 | g_ulPlayersWhoVotedNo[ulIdx] = MAXPLAYERS; |
290 | 291 | } |
291 | 292 | |
293 | + // [AK] Reset the choices of all players. | |
294 | + for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) | |
295 | + g_ulPlayerVoteChoice[ulIdx] = VOTE_UNDECIDED; | |
296 | + | |
292 | 297 | g_bVoteCancelled = false; |
293 | 298 | } |
294 | 299 |
@@ -353,6 +358,9 @@ | ||
353 | 358 | } |
354 | 359 | } |
355 | 360 | |
361 | + // [AK] Update this player's choice to "yes". | |
362 | + g_ulPlayerVoteChoice[ulPlayer] = VOTE_YES; | |
363 | + | |
356 | 364 | // Display the message in the console. |
357 | 365 | if ( NETWORK_GetState( ) == NETSTATE_SERVER ) |
358 | 366 | Printf( "%s (%s) votes \"yes\".\n", players[ulPlayer].userinfo.GetName(), SERVER_GetClient( ulPlayer )->Address.ToString() ); |
@@ -447,6 +455,9 @@ | ||
447 | 455 | } |
448 | 456 | } |
449 | 457 | |
458 | + // [AK] Update this player's choice to "no". | |
459 | + g_ulPlayerVoteChoice[ulPlayer] = VOTE_NO; | |
460 | + | |
450 | 461 | // Display the message in the console. |
451 | 462 | if ( NETWORK_GetState( ) == NETSTATE_SERVER ) |
452 | 463 | Printf( "%s (%s) votes \"no\".\n", players[ulPlayer].userinfo.GetName(), SERVER_GetClient( ulPlayer )->Address.ToString() ); |
@@ -561,6 +572,17 @@ | ||
561 | 572 | |
562 | 573 | //***************************************************************************** |
563 | 574 | // |
575 | +ULONG CALLVOTE_GetPlayerVoteChoice( ULONG ulPlayer ) | |
576 | +{ | |
577 | + // [AK] Sanity check. | |
578 | + if ( ulPlayer > MAXPLAYERS ) | |
579 | + return VOTE_UNDECIDED; | |
580 | + | |
581 | + return ( g_ulPlayerVoteChoice[ulPlayer] ); | |
582 | +} | |
583 | + | |
584 | +//***************************************************************************** | |
585 | +// | |
564 | 586 | void CALLVOTE_DisconnectedVoter( ULONG ulPlayer ) |
565 | 587 | { |
566 | 588 | ULONG ulIdx; |
@@ -60,6 +60,11 @@ | ||
60 | 60 | #define VOTE_COUNTDOWN_TIME 15 |
61 | 61 | #define VOTE_PASSED_TIME 4 |
62 | 62 | |
63 | +// [AK] Definitions for whether we (the local player) voted yes or no. | |
64 | +#define VOTE_UNDECIDED 0 | |
65 | +#define VOTE_YES 1 | |
66 | +#define VOTE_NO 2 | |
67 | + | |
63 | 68 | //***************************************************************************** |
64 | 69 | enum |
65 | 70 | { |
@@ -136,6 +141,7 @@ | ||
136 | 141 | ULONG *CALLVOTE_GetPlayersWhoVotedYes( void ); |
137 | 142 | ULONG *CALLVOTE_GetPlayersWhoVotedNo( void ); |
138 | 143 | bool CALLVOTE_ShouldShowVoteScreen( void ); |
144 | +ULONG CALLVOTE_GetPlayerVoteChoice( ULONG ulPlayer ); | |
139 | 145 | |
140 | 146 | //***************************************************************************** |
141 | 147 | // EXTERNAL CONSOLE VARIABLES |