diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 1f074634..bbf8f9ab 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -800,7 +800,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false) ds.flags = getint(p); ds.frags = getint(p); ds.deaths = getint(p); - ds.points = getint(p); } break; } diff --git a/source/src/protos.h b/source/src/protos.h index 70a7fe86..c9ecbc7d 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -613,7 +613,7 @@ extern void votecount(int v); extern void clearvote(); // scoreboard -struct discscore { int team, flags, frags, deaths, points; char name[MAXNAMELEN + 1]; }; +struct discscore { int team, flags, frags, deaths; char name[MAXNAMELEN + 1]; }; extern vector discscores; extern void showscores(bool on); extern void renderscores(void *menu, bool init); diff --git a/source/src/scoreboard.cpp b/source/src/scoreboard.cpp index 44eeb403..c5c876f7 100644 --- a/source/src/scoreboard.cpp +++ b/source/src/scoreboard.cpp @@ -85,9 +85,9 @@ vector discscores; struct teamscore { - int team, frags, deaths, flagscore, points; + int team, frags, deaths, flagscore; vector teammembers; - teamscore(int t) : team(t), frags(0), deaths(0), flagscore(0), points(0) {} + teamscore(int t) : team(t), frags(0), deaths(0), flagscore(0) {} void addplayer(playerent *d) { @@ -102,7 +102,6 @@ struct teamscore { frags += d.frags; deaths += d.deaths; - points += d.points; if(m_flags_) flagscore += d.flags; } }; @@ -132,8 +131,6 @@ static int teamscorecmp(const teamscore *x, const teamscore *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; return 0; } diff --git a/source/src/server.cpp b/source/src/server.cpp index 20d3bfeb..405509aa 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1562,8 +1562,6 @@ void htf_forceflag(int flag) f.lastupdate = sg->gamemillis; } -int cmpscore(const int *a, const int *b) { return clients[*a]->at3_score - clients[*b]->at3_score; } -vector tdistrib; vector sdistrib; void distributeteam(int team) @@ -1572,16 +1570,6 @@ void distributeteam(int team) if(sg->curmap) numsp = team == 100 ? sg->curmap->entstats.spawns[2] : sg->curmap->entstats.spawns[team & 1]; if(!numsp) numsp = 30; // no spawns: try to distribute anyway twoint ti; - tdistrib.shrink(0); - loopv(clients) if(clients[i]->type!=ST_EMPTY) - { - if(team == 100 || team == clients[i]->team) - { - tdistrib.add(i); - clients[i]->at3_score = rnd(0x1000000); - } - } - tdistrib.sort(cmpscore); // random player order sdistrib.shrink(0); loopi(numsp) { @@ -1590,11 +1578,9 @@ void distributeteam(int team) sdistrib.add(ti); } sdistrib.sort(cmpintasc); // random spawn order - int x = 0; - loopv(tdistrib) + loopv(clients) { - clients[tdistrib[i]]->spawnindex = sdistrib[x++].val; - x %= sdistrib.length(); + clients[i]->spawnindex = sdistrib[i % sdistrib.length()].val; } } @@ -2045,15 +2031,6 @@ bool updateclientteam(int cln, int newteam, int ftr) else { if(sg->autoteam && teamsizes[TEAM_CLA] != teamsizes[TEAM_RVSF]) newteam = teamsizes[TEAM_CLA] < teamsizes[TEAM_RVSF] ? TEAM_CLA : TEAM_RVSF; - else - { // join weaker team - int teamscore[2] = {0, 0}, sum = calcscores(); - loopv(clients) if(clients[i]->type!=ST_EMPTY && i != cln && clients[i]->isauthed && clients[i]->team != TEAM_SPECT) - { - teamscore[team_base(clients[i]->team)] += clients[i]->at3_score; - } - newteam = sum > 200 ? (teamscore[TEAM_CLA] < teamscore[TEAM_RVSF] ? TEAM_CLA : TEAM_RVSF) : rnd(2); - } } } if(ftr == FTR_PLAYERWISH) @@ -2089,52 +2066,20 @@ bool updateclientteam(int cln, int newteam, int ftr) return true; } -int calcscores() // skill eval -{ - int sum = 0; - loopv(clients) if(clients[i]->type!=ST_EMPTY) - { - clientstate &cs = clients[i]->state; - sum += clients[i]->at3_score = cs.points > 0 ? sqrtf((float)cs.points) : -sqrtf((float)-cs.points); - } - return sum; -} - vector shuffle; void shuffleteams(int ftr = FTR_AUTOTEAM) { int numplayers = numclients(); - int team, sums = calcscores(); - if(sg->gamemillis < 2 * 60 *1000) - { // random - int teamsize[2] = {0, 0}; - loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->isonrightmap && !team_isspect(clients[i]->team)) // only shuffle active players - { - sums += rnd(1000); - team = sums & 1; - if(teamsize[team] >= numplayers/2) team = team_opposite(team); - updateclientteam(i, team, ftr); - teamsize[team]++; - sums >>= 1; - } - } - else - { // skill sorted - shuffle.shrink(0); - sums /= 4 * numplayers + 2; - team = rnd(2); - loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->isonrightmap && !team_isspect(clients[i]->team)) - { - clients[i]->at3_score += rnd(sums | 1); - shuffle.add(i); - } - shuffle.sort(cmpscore); - loopi(shuffle.length()) - { - updateclientteam(shuffle[i], team, ftr); - team = !team; - } + int team = rnd(2); + + // random + int teamsize[2] = {0, 0}; + loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->isonrightmap && !team_isspect(clients[i]->team)) // only shuffle active players + { + if(teamsize[team] >= numplayers/2) team = team_opposite(team); + updateclientteam(i, team, ftr); + teamsize[team]++; } if(m_ctf || m_htf) @@ -2151,7 +2096,6 @@ bool refillteams(bool now, int ftr) // force only minimal amounts of players int teamsize[2] = {0, 0}, teamscore[2] = {0, 0}, moveable[2] = {0, 0}; bool switched = false; - calcscores(); loopv(clients) if(clients[i]->type!=ST_EMPTY) // playerlist stocktaking { client *c = clients[i]; @@ -2161,7 +2105,6 @@ bool refillteams(bool now, int ftr) // force only minimal amounts of players if(team_isactive(c->team)) // only active players count { teamsize[c->team]++; - teamscore[c->team] += c->at3_score; if(clienthasflag(i) < 0) { c->at3_dontmove = false; @@ -2189,7 +2132,7 @@ bool refillteams(bool now, int ftr) // force only minimal amounts of players int targetscore = diffscore / (diffnum & ~1); loopv(clients) if(clients[i]->type!=ST_EMPTY && !clients[i]->at3_dontmove) // try all still movable players { - int fit = targetscore - clients[i]->at3_score; + int fit = targetscore; if(fit < 0 ) fit = -(fit * 15) / 10; // avoid too good players int forcedelay = clients[i]->at3_lastforce ? (1000 - (sg->gamemillis - clients[i]->at3_lastforce) / (5 * 60)) : 0; if(forcedelay > 0) fit += (fit * forcedelay) / 600; // avoid lately forced players @@ -2206,7 +2149,6 @@ bool refillteams(bool now, int ftr) // force only minimal amounts of players if(updateclientteam(pick, !bigteam, ftr)) { diffnum -= 2; - diffscore -= 2 * clients[pick]->at3_score; clients[pick]->at3_lastforce = sg->gamemillis; // try not to force this player again for the next 5 minutes switched = true; } @@ -2703,7 +2645,6 @@ void senddisconnectedscores(int cn) putint(p, sc.flagscore); putint(p, sc.frags); putint(p, sc.deaths); - putint(p, sc.points); } } } diff --git a/source/src/server.h b/source/src/server.h index 579c61c8..b629351a 100644 --- a/source/src/server.h +++ b/source/src/server.h @@ -116,7 +116,7 @@ struct clientstate : playerstate projectilestate<8> grenades; int akimbomillis; bool scoped; - int flagscore, frags, teamkills, deaths, shotdamage, damage, points, events, lastdisc, reconnections; + int flagscore, frags, teamkills, deaths, shotdamage, damage, events, lastdisc, reconnections; clientstate() : state(CS_DEAD) {} @@ -160,13 +160,13 @@ struct savedscore { string name; uint ip; - int frags, flagscore, deaths, teamkills, shotdamage, damage, team, points, events, lastdisc, reconnections; + int frags, flagscore, deaths, teamkills, shotdamage, damage, team, events, lastdisc, reconnections; bool valid, forced; void reset() { // to avoid 2 connections with the same score... this can disrupt some laggers that eventually produces 2 connections (but it is rare) - frags = flagscore = deaths = teamkills = shotdamage = damage = points = events = lastdisc = reconnections = 0; + frags = flagscore = deaths = teamkills = shotdamage = damage = events = lastdisc = reconnections = 0; } void save(clientstate &cs, int t) @@ -193,7 +193,6 @@ struct savedscore cs.teamkills = teamkills; cs.shotdamage = shotdamage; cs.damage = damage; - cs.points = points; cs.forced = forced; cs.events = events; cs.lastdisc = lastdisc; @@ -262,7 +261,7 @@ struct client // server side version of "dynent" type vector position, messages; string lastsaytext; int saychars, lastsay, spamcount, badspeech, badmillis; - int at3_score, at3_lastforce, eff_score; + int at3_lastforce; bool at3_dontmove; int spawnindex; int spawnperm, spawnpermsent; @@ -302,7 +301,7 @@ struct client // server side version of "dynent" type freshgame = true; // permission to spawn at once } lastevent = 0; - at3_lastforce = eff_score = 0; + at3_lastforce = 0; mapcollisions = farpickups = 0; upspawnp = false; lag = 0; @@ -404,7 +403,6 @@ int clienthasflag(int cn); bool refillteams(bool now = false, int ftr = FTR_AUTOTEAM); void changeclientrole(int client, int role, char *pwd = NULL, bool force=false); int findmappath(const char *mapname, char *filename = NULL); -int calcscores(); void recordpacket(int chan, void *data, int len); void senddisconnectedscores(int cn); void process(ENetPacket *packet, int sender, int chan);