Clean up getMultiStats() to remove unused parameter.
2.3: r11017 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11019 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
6a7e9bb725
commit
9a22573863
|
@ -3401,13 +3401,13 @@ static UDWORD bestPlayer(UDWORD player)
|
|||
|
||||
UDWORD i, myscore, score, count=1;
|
||||
|
||||
myscore = getMultiStats(player,false).totalScore;
|
||||
myscore = getMultiStats(player).totalScore;
|
||||
|
||||
for(i=0;i<MAX_PLAYERS;i++)
|
||||
{
|
||||
if(isHumanPlayer(i) && i!=player )
|
||||
{
|
||||
score = getMultiStats(i, false).totalScore;
|
||||
score = getMultiStats(i).totalScore;
|
||||
|
||||
if(score >= myscore)
|
||||
{
|
||||
|
@ -3546,13 +3546,13 @@ void displayPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *p
|
|||
break;
|
||||
}
|
||||
|
||||
if(getMultiStats(j,false).played < 5)
|
||||
if(getMultiStats(j).played < 5)
|
||||
{
|
||||
iV_DrawImage(FrontImages,IMAGE_MEDAL_DUMMY,x+37,y+13);
|
||||
}
|
||||
else
|
||||
{
|
||||
stat = getMultiStats(j,false);
|
||||
stat = getMultiStats(j);
|
||||
|
||||
// star 1 total droid kills
|
||||
eval = stat.totalKills;
|
||||
|
|
|
@ -289,7 +289,7 @@ BOOL MultiPlayerJoin(UDWORD playerIndex)
|
|||
{
|
||||
if (NetPlay.players[i].allocated)
|
||||
{
|
||||
setMultiStats(i, getMultiStats(i, false), false);
|
||||
setMultiStats(i, getMultiStats(i), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void setupNewPlayer(UDWORD player)
|
|||
|
||||
resetMultiVisibility(player); // set visibility flags.
|
||||
|
||||
setMultiStats(player, getMultiStats(player, false), true); // get the players score from the ether.
|
||||
setMultiStats(player, getMultiStats(player), true); // get the players score
|
||||
|
||||
ssprintf(buf, _("%s is Joining the Game"), getPlayerName(player));
|
||||
addConsoleMessage(buf, DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
|
||||
|
|
|
@ -872,11 +872,11 @@ static void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
|
|||
if (NetPlay.bComms)
|
||||
{
|
||||
//c8:score,
|
||||
sprintf(str,"%d",getMultiStats(player,true).recentScore);
|
||||
sprintf(str,"%d",getMultiStats(player).recentScore);
|
||||
iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
|
||||
|
||||
//c9:kills,
|
||||
sprintf(str,"%d",getMultiStats(player,true).recentKills);
|
||||
sprintf(str,"%d",getMultiStats(player).recentKills);
|
||||
iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
|
||||
}
|
||||
else
|
||||
|
@ -936,11 +936,11 @@ static void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
|
|||
if (NetPlay.bComms)
|
||||
{
|
||||
//c8:score,
|
||||
sprintf(str,"%d",getMultiStats(player,true).recentScore);
|
||||
sprintf(str,"%d",getMultiStats(player).recentScore);
|
||||
iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
|
||||
|
||||
//c9:kills,
|
||||
sprintf(str,"%d",getMultiStats(player,true).recentKills);
|
||||
sprintf(str,"%d",getMultiStats(player).recentKills);
|
||||
iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -612,7 +612,7 @@ BOOL multiGameShutdown(void)
|
|||
sendLeavingMsg(); // say goodbye
|
||||
updateMultiStatsGames(); // update games played.
|
||||
|
||||
st = getMultiStats(selectedPlayer, true); // save stats
|
||||
st = getMultiStats(selectedPlayer); // save stats
|
||||
|
||||
saveMultiStats(getPlayerName(selectedPlayer), getPlayerName(selectedPlayer), &st);
|
||||
|
||||
|
|
|
@ -40,18 +40,14 @@ static PLAYERSTATS playerStats[MAX_PLAYERS];
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Get Player's stats
|
||||
PLAYERSTATS getMultiStats(UDWORD player, BOOL bLocal)
|
||||
PLAYERSTATS getMultiStats(UDWORD player)
|
||||
{
|
||||
static PLAYERSTATS stat;
|
||||
|
||||
// Copy over the data from our local array
|
||||
memcpy(&stat, &playerStats[player], sizeof(stat));
|
||||
|
||||
return stat;
|
||||
return playerStats[player];
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Set Player's stats
|
||||
// send stats to all players when bLocal is false
|
||||
BOOL setMultiStats(SDWORD player, PLAYERSTATS plStats, BOOL bLocal)
|
||||
{
|
||||
uint32_t playerIndex = (uint32_t)player;
|
||||
|
@ -206,7 +202,7 @@ void updateMultiStatsDamage(UDWORD attacker, UDWORD defender, UDWORD inflicted)
|
|||
// Host controls self + AI, so update the scores for them as well.
|
||||
if(myResponsibility(attacker) && NetPlay.bComms)
|
||||
{
|
||||
st = getMultiStats(attacker,true); // get stats
|
||||
st = getMultiStats(attacker); // get stats
|
||||
if(NetPlay.bComms)
|
||||
{
|
||||
st.scoreToAdd += (2*inflicted);
|
||||
|
@ -226,7 +222,7 @@ void updateMultiStatsDamage(UDWORD attacker, UDWORD defender, UDWORD inflicted)
|
|||
// Host controls self + AI, so update the scores for them as well.
|
||||
if(myResponsibility(defender) && NetPlay.bComms)
|
||||
{
|
||||
st = getMultiStats(defender,true); // get stats
|
||||
st = getMultiStats(defender); // get stats
|
||||
if(NetPlay.bComms)
|
||||
{
|
||||
st.scoreToAdd -= inflicted;
|
||||
|
@ -252,7 +248,7 @@ void updateMultiStatsGames(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
st = getMultiStats(selectedPlayer,true);
|
||||
st = getMultiStats(selectedPlayer);
|
||||
st.played ++;
|
||||
setMultiStats(selectedPlayer, st, true);
|
||||
}
|
||||
|
@ -265,7 +261,7 @@ void updateMultiStatsWins(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
st = getMultiStats(selectedPlayer,true);
|
||||
st = getMultiStats(selectedPlayer);
|
||||
st.wins ++;
|
||||
setMultiStats(selectedPlayer, st, true);
|
||||
}
|
||||
|
@ -278,7 +274,7 @@ void updateMultiStatsLoses(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
st = getMultiStats(selectedPlayer,true);
|
||||
st = getMultiStats(selectedPlayer);
|
||||
++st.losses;
|
||||
setMultiStats(selectedPlayer, st, true);
|
||||
}
|
||||
|
@ -296,7 +292,7 @@ void updateMultiStatsKills(BASE_OBJECT *psKilled,UDWORD player)
|
|||
// Host controls self + AI, so update the scores for them as well.
|
||||
if(myResponsibility(player) && NetPlay.bComms)
|
||||
{
|
||||
st = getMultiStats(player,true);
|
||||
st = getMultiStats(player);
|
||||
|
||||
if(NetPlay.bComms)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct
|
|||
|
||||
BOOL saveMultiStats(const char *sFName, const char *sPlayerName, const PLAYERSTATS *playerStats); // to disk
|
||||
BOOL loadMultiStats(char *sPlayerName, PLAYERSTATS *playerStats); // form disk
|
||||
PLAYERSTATS getMultiStats(UDWORD player,BOOL bLocal); // get from net
|
||||
PLAYERSTATS getMultiStats(UDWORD player); // get from net
|
||||
BOOL setMultiStats(SDWORD player, PLAYERSTATS plStats,BOOL bLocal); // send to net.
|
||||
void updateMultiStatsDamage(UDWORD attacker, UDWORD defender, UDWORD inflicted);
|
||||
void updateMultiStatsGames(void);
|
||||
|
|
|
@ -992,8 +992,8 @@ BOOL sendScoreCheck(void)
|
|||
// Host controls AI's scores + his own...
|
||||
if (myResponsibility(i))
|
||||
{
|
||||
// Update local score
|
||||
stats = getMultiStats(i, true);
|
||||
// Update score
|
||||
stats = getMultiStats(i);
|
||||
|
||||
// Add recently scored points
|
||||
stats.recentKills += stats.killsToAdd;
|
||||
|
|
Loading…
Reference in New Issue