From 05a83c81707059807451cd6defc64f35d6d93088 Mon Sep 17 00:00:00 2001 From: drian Date: Fri, 30 Apr 2021 06:14:29 +0200 Subject: [PATCH] #269 score is not working --- source/src/clientgame.cpp | 6 ------ source/src/clients2c.cpp | 2 -- source/src/entity.h | 6 +++--- source/src/scoreboard.cpp | 26 +++++--------------------- source/src/serverchecks.h | 39 --------------------------------------- 5 files changed, 8 insertions(+), 71 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 99123e1b..a8924844 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -280,7 +280,6 @@ void playerinfo(int *cn, const char *attr) ATTR_INT(role, p->clientrole); ATTR_INT(frags, p->frags); ATTR_INT(flags, p->flagscore); - ATTR_INT(points, p->points); ATTR_INT(deaths, p->deaths); ATTR_INT(tks, p->tks); ATTR_INT(alive, p->state == CS_ALIVE ? 1 : 0); @@ -318,7 +317,6 @@ void teaminfo(const char *team, const char *attr) int t_flags = 0; int t_frags = 0; int t_deaths = 0; - int t_points = 0; string teammembers = ""; @@ -326,7 +324,6 @@ void teaminfo(const char *team, const char *attr) { t_frags += players[i]->frags; t_deaths += players[i]->deaths; - t_points += players[i]->points; t_flags += players[i]->flagscore; concatformatstring(teammembers, "%d ", players[i]->clientnum); } @@ -335,7 +332,6 @@ void teaminfo(const char *team, const char *attr) { t_frags += discscores[i].frags; t_deaths += discscores[i].deaths; - t_points += discscores[i].points; t_flags += discscores[i].flags; } @@ -343,7 +339,6 @@ void teaminfo(const char *team, const char *attr) { t_frags += player1->frags; t_deaths += player1->deaths; - t_points += player1->points; t_flags += player1->flagscore; concatformatstring(teammembers, "%d ", player1->clientnum); } @@ -351,7 +346,6 @@ void teaminfo(const char *team, const char *attr) ATTR_INT(flags, t_flags); ATTR_INT(frags, t_frags); ATTR_INT(deaths, t_deaths); - ATTR_INT(points, t_points); ATTR_STR(name, team_string(t)); ATTR_STR(players, teammembers); conoutf("invalid attribute: %s", attr); diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 0438c347..32404787 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -759,7 +759,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false) deaths = getint(p), health = getint(p), armour = getint(p), - points = getint(p), teamkills = getint(p); int ammo[NUMGUNS], mag[NUMGUNS]; loopi(NUMGUNS) ammo[i] = getint(p); @@ -771,7 +770,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false) d->flagscore = flagscore; d->frags = frags; d->deaths = deaths; - d->points = points; d->tks = teamkills; if(d!=player1) { diff --git a/source/src/entity.h b/source/src/entity.h index de05d307..2538790c 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -417,7 +417,7 @@ public: int clientnum, lastupdate, plag, ping; enet_uint32 address; int lifesequence; // sequence id for each respawn, used in damage test - int frags, flagscore, deaths, points, tks; + int frags, flagscore, deaths, tks; int lastaction, lastmove, lastpain, lastvoicecom, lastdeath; int clientrole; bool attacking; @@ -446,7 +446,7 @@ public: bool ignored, muted; bool nocorpse; - playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), address(0), lifesequence(0), frags(0), flagscore(0), deaths(0), points(0), tks(0), lastpain(0), lastvoicecom(0), lastdeath(0), clientrole(CR_DEFAULT), + playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), address(0), lifesequence(0), frags(0), flagscore(0), deaths(0), tks(0), lastpain(0), lastvoicecom(0), lastdeath(0), clientrole(CR_DEFAULT), team(TEAM_SPECT), spectatemode(SM_NONE), followplayercn(FPCN_VOID), eardamagemillis(0), maxroll(ROLLMOVDEF), maxrolleffect(ROLLEFFDEF), movroll(0), effroll(0), ffov(0), scopefov(0), prevweaponsel(NULL), weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL), smoothmillis(-1), @@ -556,7 +556,7 @@ public: } void startmap() { - frags = flagscore = deaths = lifesequence = points = tks = 0; + frags = flagscore = deaths = lifesequence = tks = 0; } }; diff --git a/source/src/scoreboard.cpp b/source/src/scoreboard.cpp index 97c6321f..21e9c142 100644 --- a/source/src/scoreboard.cpp +++ b/source/src/scoreboard.cpp @@ -18,7 +18,6 @@ VARFP(sc_flags, 0, 0, 100, needscoresreorder = true); VARFP(sc_frags, 0, 1, 100, needscoresreorder = true); VARFP(sc_deaths, -1, 2, 100, needscoresreorder = true); VARFP(sc_ratio, -1, -1, 100, needscoresreorder = true); -VARFP(sc_score, -1, 4, 100, needscoresreorder = true); VARFP(sc_lag, -1, 5, 100, needscoresreorder = true); VARFP(sc_clientnum, 0, 6, 100, needscoresreorder = true); VARFP(sc_name, 0, 7, 100, needscoresreorder = true); @@ -96,7 +95,6 @@ struct teamscore teammembers.add(d); frags += d->frags; deaths += d->deaths; - points += d->points; if(m_flags_) flagscore += d->flagscore; } @@ -146,8 +144,6 @@ static int scorecmp(playerent **x, playerent **y) if((*x)->flagscore < (*y)->flagscore) return 1; if((*x)->frags > (*y)->frags) return -1; if((*x)->frags < (*y)->frags) return 1; - if((*x)->points > (*y)->points) return -1; - if((*x)->points < (*y)->points) return 1; if((*x)->deaths > (*y)->deaths) return 1; if((*x)->deaths < (*y)->deaths) return -1; if((*x)->lifesequence > (*y)->lifesequence) return 1; @@ -195,7 +191,6 @@ void renderdiscscores(int team) line.addcol(sc_frags, "%d", d.frags); line.addcol(sc_deaths, "%d", d.deaths); line.addcol(sc_ratio, "%.2f", SCORERATIO(d.frags, d.deaths)); - if(multiplayer(NULL) || watchingdemo) line.addcol(sc_score, "%d", max(d.points, 0)); line.addcol(sc_lag, "%s", clag); line.addcol(sc_clientnum, "DISC"); line.addcol(sc_name, "%s", d.name); @@ -225,13 +220,10 @@ void renderscore(playerent *d) if(m_flags_) line.addcol(sc_flags, "%d", d->flagscore); line.addcol(sc_frags, "%d", d->frags); - line.addcol(sc_deaths, "%d", d->deaths); + line.addcol(sc_deaths, "%d", 99); line.addcol(sc_ratio, "%.2f", SCORERATIO(d->frags, d->deaths)); - if(multiplayer(NULL) || watchingdemo) - { - line.addcol(sc_score, "%d", max(d->points, 0)); - line.addcol(sc_lag, "%s", lagping); - } + if(multiplayer(NULL) || watchingdemo) line.addcol(sc_lag, "%s", lagping); + line.addcol(sc_clientnum, "\fs\f%d%d\fr", cncolumncolor, d->clientnum); char flagicon = '\0'; if(m_flags_) //show flag icon at flag carrier with use radaricons font @@ -259,11 +251,7 @@ void renderteamscore(teamscore *t) line.addcol(sc_frags, "%d", t->frags); line.addcol(sc_deaths, "%d", t->deaths); line.addcol(sc_ratio, "%.2f", SCORERATIO(t->frags, t->deaths)); - if(multiplayer(NULL) || watchingdemo) - { - line.addcol(sc_score, "%d", max(t->points, 0)); - line.addcol(sc_lag); - } + if(multiplayer(NULL) || watchingdemo) line.addcol(sc_lag); line.addcol(sc_clientnum, "%s", team_string(t->team)); int n = t->teammembers.length(); line.addcol(sc_name, "(%d %s)", n, n == 1 ? "player" : "players"); @@ -286,11 +274,7 @@ void reorderscorecolumns() sscore.addcol(sc_frags, "frags"); sscore.addcol(sc_deaths, "deaths"); sscore.addcol(sc_ratio, "ratio"); - if(multiplayer(NULL) || watchingdemo) - { - sscore.addcol(sc_score, "score"); - sscore.addcol(sc_lag, "pj/ping"); - } + if(multiplayer(NULL) || watchingdemo) sscore.addcol(sc_lag, "pj/ping"); sscore.addcol(sc_clientnum, "cn"); sscore.addcol(sc_name, "name"); copystring(scoreboardtitle, sscore.getcols()); diff --git a/source/src/serverchecks.h b/source/src/serverchecks.h index 3feed894..8d83f3b7 100644 --- a/source/src/serverchecks.h +++ b/source/src/serverchecks.h @@ -27,45 +27,6 @@ extern inline void addban(client *cl, int reason, int type = BAN_AUTO); #include "anticheat.h" #endif - -/** cnumber is the number of players in the game, at a max value of 12 */ -#define CTFPICKPT cnumber // player picked the flag (ctf) -#define CTFDROPPT -cnumber // player dropped the flag to other player (probably) -#define HTFLOSTPT -2*cnumber // penalty -#define CTFLOSTPT cnumber*distance/100 // bonus: 1/4 of the flag score bonus -#define CTFRETURNPT cnumber // flag return -#define CTFSCOREPT (cnumber*distance/25+10) // flag score -#define HTFSCOREPT (cnumber*4+10) -#define KTFSCOREPT (cnumber*2+10) -#define COMBOPT 5 // player frags with combo -#define REPLYPT 2 // reply success -#define TWDONEPT 5 // team work done -#define CTFLDEFPT cnumber // player defended the flag in the base (ctf) -#define CTFLCOVPT cnumber*2 // player covered the flag stealer (ctf) -#define HTFLDEFPT cnumber // player defended a droped flag (htf) -#define HTFLCOVPT cnumber*3 // player covered the flag keeper (htf) -#define COVERPT cnumber*2 // player covered teammate -#define DEATHPT -4 // player died -#define BONUSPT target->state.points/400 // bonus (for killing high level enemies :: beware with exponential behavior!) -#define FLBONUSPT target->state.points/300 // bonus if flag team mode -#define TMBONUSPT target->state.points/200 // bonus if team mode (to give some extra reward for playing tdm modes) -#define HTFFRAGPT cnumber/2 // player frags while carrying the flag -#define CTFFRAGPT 2*cnumber // player frags the flag stealer -#define FRAGPT 10 // player frags (normal) -#define HEADSHOTPT 15 // player gibs with head shot -#define KNIFEPT 20 // player gibs with the knife -#define SHOTGPT 12 // player gibs with the shotgun -#define TKPT -20 // player tks -#define FLAGTKPT -2*(10+cnumber) // player tks the flag keeper/stealer - - - - - - - - - int next_afk_check = 200; /* this function is managed to the PUBS, id est, many people playing in an open server */