From 0ef49ba324e49ad56f37f770702d3716d9c57471 Mon Sep 17 00:00:00 2001 From: Theriaca Date: Sat, 26 Jan 2019 15:58:41 +0100 Subject: rename pers.credit to pers.funds --- src/game/g_active.c | 2 +- src/game/g_client.c | 28 ++++++++++++++-------------- src/game/g_cmds.c | 24 ++++++++++++------------ src/game/g_local.h | 2 +- src/game/g_ptr.c | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/game') diff --git a/src/game/g_active.c b/src/game/g_active.c index 3a989cc..5cdf985 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -2164,7 +2164,7 @@ void ClientEndFrame( gentity_t *ent ) // save a copy of certain playerState values in case of SPECTATOR_FOLLOW pers->score = ent->client->ps.persistant[ PERS_SCORE ]; - pers->credit = ent->client->ps.persistant[ PERS_CREDIT ]; + pers->funds = ent->client->ps.persistant[ PERS_CREDIT ]; // // If the end of unit layout is displayed, don't give diff --git a/src/game/g_client.c b/src/game/g_client.c index 5b3f122..ac4a081 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -81,7 +81,7 @@ void SP_info_human_intermission( gentity_t *ent ) static int compare_client_funds(const void *c1, const void *c2) { - return (((const gclient_t *)c1)->pers.credit - ((const gclient_t *)c2)->pers.credit); + return (((const gclient_t *)c1)->pers.funds - ((const gclient_t *)c2)->pers.funds); } /* @@ -129,24 +129,24 @@ static void G_OverflowFunds(gclient_t *donor, float funds) break; if (target->ps.stats[STAT_PTEAM] == PTE_ALIENS) { - buffer = target->pers.credit + target->pers.fractionalCredit + funds - max; + buffer = target->pers.funds + target->pers.fractionalCredit + funds - max; } else { funds = floor(funds); - buffer = target->pers.credit + funds - max; + buffer = target->pers.funds + funds - max; } if (buffer > 0) { - target->pers.credit = max; + target->pers.funds = max; target->pers.fractionalCredit = 0.0f; } else { - target->pers.credit += floor(funds); + target->pers.funds += floor(funds); target->pers.fractionalCredit += funds - floor(funds); } funds = buffer; // synchronize PERS_CREDIT - target->ps.persistant[PERS_CREDIT] = (int)target->pers.credit; + target->ps.persistant[PERS_CREDIT] = (int)target->pers.funds; } } @@ -176,25 +176,25 @@ void G_AddFundsToClient(gclient_t *client, float funds, qboolean cap) max = HUMAN_MAX_CREDITS; } - buffer = client->pers.credit + funds - max; + buffer = client->pers.funds + funds - max; if (buffer > 0) { G_OverflowFunds(client, buffer + client->pers.fractionalCredit); - client->pers.credit = max; + client->pers.funds = max; client->pers.fractionalCredit = 0.0f; } else { - client->pers.credit += (short)funds; + client->pers.funds += (short)funds; } } else { - client->pers.credit += (short)funds; + client->pers.funds += (short)funds; } - if (client->pers.credit < 0) - client->pers.credit = 0; + if (client->pers.funds < 0) + client->pers.funds = 0; // keep PERS_CREDIT in sync if not following if (client->sess.spectatorState != SPECTATOR_FOLLOW) - client->ps.persistant[PERS_CREDIT] = client->pers.credit; + client->ps.persistant[PERS_CREDIT] = client->pers.funds; } @@ -2066,7 +2066,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles // restore really persistant things client->ps.persistant[ PERS_SCORE ] = client->pers.score; - client->ps.persistant[ PERS_CREDIT ] = client->pers.credit; + client->ps.persistant[ PERS_CREDIT ] = client->pers.funds; client->airOutTime = level.time + 12000; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index aa80248..d6126c8 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -698,13 +698,13 @@ void G_ChangeTeam( gentity_t *ent, pTeam_t newTeam ) && ( level.time - ent->client->pers.teamChangeTime ) > 60000 ) ) { if( oldTeam == PTE_ALIENS ) - ent->client->pers.credit *= (float)FREEKILL_HUMAN / FREEKILL_ALIEN; + ent->client->pers.funds *= (float)FREEKILL_HUMAN / FREEKILL_ALIEN; else if( newTeam == PTE_ALIENS ) - ent->client->pers.credit *= (float)FREEKILL_ALIEN / FREEKILL_HUMAN; + ent->client->pers.funds *= (float)FREEKILL_ALIEN / FREEKILL_HUMAN; } else { - ent->client->pers.credit = 0; + ent->client->pers.funds = 0; ent->client->pers.score = 0; } @@ -5263,9 +5263,9 @@ static void Cmd_Ignore_f( gentity_t *ent ) } // transfer only credits the player really has - if( creds > ent->client->pers.credit ) + if( creds > ent->client->pers.funds ) { - creds = ent->client->pers.credit; + creds = ent->client->pers.funds; } // player has no credits @@ -5278,14 +5278,14 @@ static void Cmd_Ignore_f( gentity_t *ent ) // allow transfers only up to the credit/evo limit if( ( team == PTE_HUMANS ) && - ( creds > HUMAN_MAX_CREDITS - level.clients[ clientNum ].pers.credit ) ) + ( creds > HUMAN_MAX_CREDITS - level.clients[ clientNum ].pers.funds ) ) { - creds = HUMAN_MAX_CREDITS - level.clients[ clientNum ].pers.credit; + creds = HUMAN_MAX_CREDITS - level.clients[ clientNum ].pers.funds; } else if( ( team == PTE_ALIENS ) && - ( creds > ALIEN_MAX_KILLS - level.clients[ clientNum ].pers.credit ) ) + ( creds > ALIEN_MAX_KILLS - level.clients[ clientNum ].pers.funds ) ) { - creds = ALIEN_MAX_KILLS - level.clients[ clientNum ].pers.credit; + creds = ALIEN_MAX_KILLS - level.clients[ clientNum ].pers.funds; } // target cannot take any more credits @@ -5374,8 +5374,8 @@ static void Cmd_Ignore_f( gentity_t *ent ) "print \"donate: very funny\n\"" ); return; } - if( value > ent->client->pers.credit) - value = ent->client->pers.credit; + if( value > ent->client->pers.funds) + value = ent->client->pers.funds; // allocate memory for distribution amounts amounts = G_Alloc( level.maxclients * sizeof( int ) ); @@ -5392,7 +5392,7 @@ static void Cmd_Ignore_f( gentity_t *ent ) ent->client != level.clients + i && level.clients[ i ].pers.teamSelection == ent->client->pers.teamSelection ) { - new_credits = level.clients[ i ].pers.credit + portion; + new_credits = level.clients[ i ].pers.funds + portion; amounts[ i ] = portion; if( new_credits > max ) { amounts[ i ] -= new_credits - max; diff --git a/src/game/g_local.h b/src/game/g_local.h index 5250913..4d70a33 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -408,7 +408,7 @@ typedef struct // used to save playerState_t values while in SPECTATOR_FOLLOW mode int score; - int credit; + int funds; float fractionalCredit; // alien-only int ping; diff --git a/src/game/g_ptr.c b/src/game/g_ptr.c index e102183..3727c99 100644 --- a/src/game/g_ptr.c +++ b/src/game/g_ptr.c @@ -62,7 +62,7 @@ void G_UpdatePTRConnection( gclient_t *client ) if( client && client->pers.connection ) { client->pers.connection->clientTeam = client->pers.teamSelection; - client->pers.connection->clientCredit = client->pers.credit; + client->pers.connection->clientCredit = client->pers.funds; client->pers.connection->clientScore = client->pers.score; } } -- cgit