dump scoreboard to console at end of game

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2565 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2008-09-13 18:40:16 +00:00
parent 93f0aa140b
commit 2ff6f2695d
3 changed files with 34 additions and 0 deletions
+1
View File
@@ -508,6 +508,7 @@ void timeupdate(int timeremain)
player1->attacking = false;
conoutf("intermission:");
conoutf("game has ended!");
consolescores();
showscores(true);
if(identexists("start_intermission")) execute("start_intermission");
}
+1
View File
@@ -357,6 +357,7 @@ extern void clearvote();
// scoreboard
extern void showscores(bool on);
extern void renderscores(void *menu, bool init);
extern void consolescores();
// world
extern void setupworld(int factor);
+32
View File
@@ -189,3 +189,35 @@ void renderscores(void *menu, bool init)
}
}
void consolescores()
{
static string team, flags;
playerent *d;
scoreratio sr;
vector<playerent *> scores;
scores.add(player1);
loopv(players) if(players[i]) scores.add(players[i]);
scores.sort(scorecmp);
if(getclientmap()[0])
{
printf("\n\"%s\" on map %s", modestr(gamemode, 0), getclientmap());
}
if(multiplayer(false))
{
serverinfo *s = getconnectedserverinfo();
if(s) printf(", %s:%d %s", s->name, s->port, s->sdesc);
}
printf("\n%sfrags deaths ratio cn%s name\n", m_flags ? "flags " : "", m_teammode ? " team" : "");
loopv(scores)
{
d = scores[i];
sr.calc(d->frags, d->deaths);
s_sprintf(team)(" %-4s", d->team);
s_sprintf(flags)(" %4d ", d->flagscore);
printf("%s %4d %4d %5.2f %2d%s %s%s\n", m_flags ? flags : "", d->frags, d->deaths, sr.ratio, d->clientnum,
m_teammode ? team : "", d->name, d->clientrole==CR_ADMIN ? " (admin)" : d==player1 ? " (you)" : "");
}
printf("\n");
}