points to score
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5122 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -709,6 +709,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
ds.flags = getint(p);
|
||||
ds.frags = getint(p);
|
||||
ds.deaths = getint(p);
|
||||
ds.points = getint(p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-3
@@ -845,9 +845,9 @@ int main(int argc, char **argv)
|
||||
|
||||
initlog("cfg");
|
||||
extern void *scoremenu, *teammenu, *ctfmenu, *servmenu, *searchmenu, *serverinfomenu, *kickmenu, *banmenu, *forceteammenu, *giveadminmenu, *docmenu, *applymenu;
|
||||
scoremenu = addmenu("score", "frags\tdeath\tratio\tpoints\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
teammenu = addmenu("team score", "frags\tdeath\tratio\tpoints\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
ctfmenu = addmenu("ctf score", "flags\tfrags\tdeath\tratio\tpoints\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
scoremenu = addmenu("score", "frags\tdeath\tratio\tscore\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
teammenu = addmenu("team score", "frags\tdeath\tratio\tscore\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
ctfmenu = addmenu("ctf score", "flags\tfrags\tdeath\tratio\tscore\tpj\tping\tcn\tname", false, renderscores, NULL, false, true);
|
||||
servmenu = addmenu("server", NULL, true, refreshservers, serverskey);
|
||||
searchmenu = addmenu("search", NULL, true, refreshservers, serverskey);
|
||||
serverinfomenu = addmenu("serverinfo", NULL, true, refreshservers, serverinfokey);
|
||||
|
||||
+1
-1
@@ -392,7 +392,7 @@ extern void votecount(int v);
|
||||
extern void clearvote();
|
||||
|
||||
// scoreboard
|
||||
struct discscore { int team, flags, frags, deaths; char name[MAXNAMELEN + 1]; };
|
||||
struct discscore { int team, flags, frags, deaths, points; char name[MAXNAMELEN + 1]; };
|
||||
extern vector<discscore> discscores;
|
||||
extern void showscores(int on);
|
||||
extern void renderscores(void *menu, bool init);
|
||||
|
||||
@@ -47,7 +47,7 @@ struct teamscore
|
||||
{
|
||||
frags += d.frags;
|
||||
deaths += d.deaths;
|
||||
// points += d.points;
|
||||
points += d.points;
|
||||
if(m_flags) flagscore += d.flags;
|
||||
}
|
||||
};
|
||||
@@ -56,6 +56,8 @@ static int teamscorecmp(const teamscore *x, const teamscore *y)
|
||||
{
|
||||
if(x->flagscore > y->flagscore) return -1;
|
||||
if(x->flagscore < y->flagscore) return 1;
|
||||
if(x->points > y->points) return -1;
|
||||
if(x->points < y->points) return 1;
|
||||
if(x->frags > y->frags) return -1;
|
||||
if(x->frags < y->frags) return 1;
|
||||
if(x->deaths < y->deaths) return -1;
|
||||
@@ -66,6 +68,8 @@ static int scorecmp(const playerent **x, const playerent **y)
|
||||
{
|
||||
if((*x)->flagscore > (*y)->flagscore) return -1;
|
||||
if((*x)->flagscore < (*y)->flagscore) return 1;
|
||||
if((*x)->points > (*y)->points) return -1;
|
||||
if((*x)->points < (*y)->points) return 1;
|
||||
if((*x)->frags > (*y)->frags) return -1;
|
||||
if((*x)->frags < (*y)->frags) return 1;
|
||||
if((*x)->deaths > (*y)->deaths) return 1;
|
||||
@@ -106,10 +110,11 @@ void renderdiscscores(int team)
|
||||
discscore &d = discscores[i];
|
||||
sline &line = scorelines.add();
|
||||
const char *spect = team_isspect(d.team) ? "\f4" : "";
|
||||
const char *sr = scoreratio(d.frags, d.deaths);
|
||||
// const char *sr = scoreratio(d.frags, d.deaths);
|
||||
float ratio = (float)(d.frags >= 0 ? d.frags : 0) / (float)(d.deaths > 0 ? d.deaths : 1);
|
||||
const char *clag = team_isspect(d.team) ? "SPECT" : "";
|
||||
if(m_flags) formatstring(line.s)("%s%d\t%d\t%d\t%s\t%s\tDISC\t\t%s", spect, d.flags, d.frags, d.deaths, sr, clag, d.name);
|
||||
else formatstring(line.s)("%s%d\t%d\t%s\t%s\tDISC\t\t%s", spect, d.frags, d.deaths, sr, clag, d.name);
|
||||
if(m_flags) formatstring(line.s)("%s%d\t%d\t%d\t%.1f\t%d\t%s\tDISC\t\t%s", spect, d.flags, d.frags, d.deaths, ratio, d.points, clag, d.name);
|
||||
else formatstring(line.s)("%s%d\t%d\t%.1f\t%d\t%s\tDISC\t\t%s", spect, d.frags, d.deaths, ratio, d.points, clag, d.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,8 +133,8 @@ void renderscore(playerent *d)
|
||||
sline &line = scorelines.add();
|
||||
line.bgcolor = d==player1 ? &localplayerc : NULL;
|
||||
string &s = line.s;
|
||||
if(m_flags) formatstring(s)("%s%d\t%d\t%d\t%.1f\t%.1f\t%s\t%s\t%d\t%s%s%s", spect, d->flagscore, d->frags, d->deaths, ratio, 0.1f * d->points, clag, cping, d->clientnum, status, colorname(d), ign);
|
||||
else formatstring(s)("%s%d\t%d\t%.1f\t%.1f\t%s\t%s\t%d\t%s%s%s", spect, d->frags, d->deaths, ratio, 0.1f * d->points, clag, cping, d->clientnum, status, colorname(d), ign);
|
||||
if(m_flags) formatstring(s)("%s%d\t%d\t%d\t%.1f\t%d\t%s\t%s\t%d\t%s%s%s", spect, d->flagscore, d->frags, d->deaths, ratio, d->points, clag, cping, d->clientnum, status, colorname(d), ign);
|
||||
else formatstring(s)("%s%d\t%d\t%.1f\t%d\t%s\t%s\t%d\t%s%s%s", spect, d->frags, d->deaths, ratio, d->points, clag, cping, d->clientnum, status, colorname(d), ign);
|
||||
}
|
||||
|
||||
void renderteamscore(teamscore *t)
|
||||
@@ -143,8 +148,8 @@ void renderteamscore(teamscore *t)
|
||||
defformatstring(plrs)("(%d %s)", t->teammembers.length(), t->teammembers.length() == 1 ? "player" : "players");
|
||||
// const char *sr = scoreratio(t->frags, t->deaths);
|
||||
float ratio = (float)(t->frags >= 0 ? t->frags : 0) / (float)(t->deaths > 0 ? t->deaths : 1);
|
||||
if(m_flags) formatstring(line.s)("%d\t%d\t%d\t%.1f\t%.1f\t\t\t\t%s\t\t%s", t->flagscore, t->frags, t->deaths, ratio, 0.1f * t->points, team_string(t->team), plrs);
|
||||
else formatstring(line.s)("%d\t%d\t%.1f\t%.1f\t\t\t\t%s\t\t%s", t->frags, t->deaths, ratio, 0.1f * t->points, team_string(t->team), plrs);
|
||||
if(m_flags) formatstring(line.s)("%d\t%d\t%d\t%.1f\t%d\t\t\t\t%s\t\t%s", t->flagscore, t->frags, t->deaths, ratio, t->points, team_string(t->team), plrs);
|
||||
else formatstring(line.s)("%d\t%d\t%.1f\t%d\t\t\t\t%s\t\t%s", t->frags, t->deaths, ratio, t->points, team_string(t->team), plrs);
|
||||
static color teamcolors[2] = { color(1.0f, 0, 0, 0.2f), color(0, 0, 1.0f, 0.2f) };
|
||||
line.bgcolor = &teamcolors[team_base(t->team)];
|
||||
loopv(t->teammembers) renderscore(t->teammembers[i]);
|
||||
|
||||
@@ -1952,6 +1952,7 @@ void senddisconnectedscores(int cn)
|
||||
putint(p, sc.flagscore);
|
||||
putint(p, sc.frags);
|
||||
putint(p, sc.deaths);
|
||||
putint(p, sc.points);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user