Commit 311951a1 authored by Romain Bignon's avatar Romain Bignon

rename "deaths" stat to "losses", and fix related bug on server

parent d143c155
......@@ -250,7 +250,7 @@ Sommaire:
USET <account> <modes> [<args> ..] :Paramètres d'un account
+k <killed> :- unités tués
+d <deaths> :- unités perdues
+d <losses> :- unités perdues
+s <score> :- score
+c <creations> :- créations
+v :- victoire
......@@ -270,7 +270,7 @@ Sommaire:
> EOL :fin du listing
< SCORE
> SCORE <nick> <deaths> <killed> <creations> :score
> SCORE <nick> <losses> <killed> <creations> :score
<scores> <best_revenu> <nbgames> <victories>
<regtime> <lastvisit>
......
......@@ -101,7 +101,7 @@ static int show_scores(struct Client* cl)
max_show = 5;
for(i=0; u && i < max_show; ++i, u = u->next)
sendrpl(cl, MSG_SCORE, "%s %llu %llu %llu %llu %llu %u %u %lu %lu", u->name, u->deaths, u->killed,
sendrpl(cl, MSG_SCORE, "%s %llu %llu %llu %llu %llu %u %u %lu %lu", u->name, u->losses, u->killed,
u->creations, u->score, u->best_revenu,
u->nb_games, u->victories,
u->reg_timestamp, u->last_visit);
......
......@@ -34,7 +34,7 @@ void strip_newline(char *string)
*p = '\0';
}
struct RegUser* add_reguser(const char* name, const char* passwd, int nb_games, ullint deaths, ullint killed,
struct RegUser* add_reguser(const char* name, const char* passwd, int nb_games, ullint losses, ullint killed,
ullint creations, ullint score, ullint best_revenu, int victories, time_t reg_timestamp,
time_t last_visit)
{
......@@ -47,7 +47,7 @@ struct RegUser* add_reguser(const char* name, const char* passwd, int nb_games,
strncpy(reguser->passwd, passwd, PASSWDLEN);
reguser->cookie[0] = 0;
reguser->nb_games = nb_games;
reguser->deaths = deaths;
reguser->losses = losses;
reguser->killed = killed;
reguser->creations = creations;
reguser->score = score;
......@@ -140,7 +140,7 @@ int load_users(const char* file)
strip_newline(parv[parc-1]);
// NICK <name> <pass> <nb_games> <deaths> <killed> <creations> <score> <meilleurs revenu> <victoires> <reg_timestamp> <last_game>
// NICK <name> <pass> <nb_games> <losses> <killed> <creations> <score> <meilleurs revenu> <victoires> <reg_timestamp> <last_game>
if(!strcmp(buf, "VERSION"))
version = atoi(parv[1]);
else if(!version)
......@@ -154,8 +154,8 @@ int load_users(const char* file)
/* parv[1] = name
* parv[2] = passws
* parv[3] = nb_games
* parv[4] = deaths
* parv[5] = killed
* parv[4] = killed
* parv[5] = losses
* parv[6] = creations
* parv[7] = score
* parv[8] = best income
......@@ -180,7 +180,7 @@ int load_users(const char* file)
reg_timestamp = atoi(parv[10]);
last_game = atoi(parv[11]);
}
add_reguser(parv[1], parv[2], atoi(parv[3]), strtoull(parv[4], 0, 10), strtoull(parv[5], 0, 10), strtoull(parv[6], 0, 10),
add_reguser(parv[1], parv[2], atoi(parv[3]), strtoull(parv[5], 0, 10), strtoull(parv[4], 0, 10), strtoull(parv[6], 0, 10),
strtoull(parv[7], 0, 10), strtoull(parv[8], 0, 10), victories, reg_timestamp, last_game);
}
else
......@@ -203,8 +203,8 @@ int write_users(const char* file)
fprintf(fp, "NBUSER %d\n", nb_tusers);
for(; reg; reg = reg->next)
fprintf(fp, "NICK %s %s %u %llu %llu %llu %llu %llu %u %ld %ld\n", reg->name, reg->passwd, reg->nb_games, reg->deaths,
reg->killed, reg->creations, reg->score, reg->best_revenu, reg->victories,
fprintf(fp, "NICK %s %s %u %llu %llu %llu %llu %llu %u %ld %ld\n", reg->name, reg->passwd, reg->nb_games, reg->killed,
reg->losses, reg->creations, reg->score, reg->best_revenu, reg->victories,
reg->reg_timestamp, reg->last_visit);
fclose(fp);
......
......@@ -39,7 +39,7 @@ struct RegUser
char passwd[PASSWDLEN+1];
char cookie[COOKIELEN+1];
ullint killed, deaths, creations, score, best_revenu;
ullint killed, losses, creations, score, best_revenu;
int nb_games, victories;
time_t reg_timestamp, last_visit;
......@@ -62,7 +62,7 @@ extern struct RegUser* reguser_head;
extern int load_users(const char* file);
extern int write_users(const char* file);
extern struct RegUser* add_reguser(const char* nick, const char* passwd, int nb_games, ullint deaths, ullint killed, ullint creations,
extern struct RegUser* add_reguser(const char* nick, const char* passwd, int nb_games, ullint losses, ullint killed, ullint creations,
ullint score, ullint best_revenu, int victories, time_t reg_timestamp, time_t last_game);
extern void remove_reguser(struct RegUser* reguser);
extern struct RegUser* find_reguser(const char* nick);
......
......@@ -132,7 +132,7 @@ int m_user_set (struct Client* cl, int parc, char** parv)
{
int c = atoi(parv[i++]);
if(c > 0)
reg->deaths += c;
reg->losses += c;
}
break;
case 's':
......
......@@ -1449,8 +1449,8 @@ bool EChannel::CheckEndOfGame()
{
ECPlayer* pl = dynamic_cast<ECPlayer*>(*it);
ECArgs args;
args += TypToStr(pl->Stats()->losses);
args += TypToStr(pl->Stats()->killed);
args += TypToStr(pl->Stats()->shooted);
args += TypToStr(pl->Stats()->created);
args += TypToStr(pl->Stats()->score);
args += TypToStr(pl->Stats()->best_revenu);
......
......@@ -89,9 +89,9 @@ public:
struct stats_t
{
stats_t() : killed(0), shooted(0), created(0), score(0), best_revenu(0) {}
stats_t() : killed(0), losses(0), created(0), score(0), best_revenu(0) {}
uint killed;
uint shooted;
uint losses;
uint created;
int score;
int best_revenu;
......
......@@ -308,7 +308,6 @@ void TIA::FirstMovements()
switch((*enti)->Type())
{
case ECEntity::E_MCDO:
if(!(*enti)->Deployed()) break;
case ECEntity::E_CASERNE:
switch(rand()%7)
{
......
......@@ -288,7 +288,7 @@ ECEntity::~ECEntity()
void ECEntity::Shoot(ECEntity* e, uint k)
{
if(Owner())
dynamic_cast<ECPlayer*>(Owner())->Stats()->shooted += k;
dynamic_cast<ECPlayer*>(Owner())->Stats()->killed += k;
Debug(W_DEBUG, "%s shoot %s de %d", LongName().c_str(), e->LongName().c_str(), k);
e->Shooted(k);
......@@ -298,7 +298,7 @@ void ECEntity::ReleaseShoot()
{
SetNb(Nb() - (shooted > Nb() ? Nb() : shooted));
if(Owner())
Owner()->Stats()->killed += shooted;
Owner()->Stats()->losses += shooted;
shooted = 0;
}
......
......@@ -2499,7 +2499,7 @@ TScoresForm* ScoresForm = 0;
/** Scores of a player
*
* Syntax: nick SCO killed shooted created score best_revenu
* Syntax: nick SCO losses killed created score best_revenu
*/
int SCOCommand::Exec(PlayerList players, EC_Client *me, ParvList parv)
{
......@@ -2565,7 +2565,7 @@ TScoresForm::TScoresForm(ECImage* w, EChannel* ch)
Font::GetInstance(Font::Huge)));
Players = AddComponent(new TList(70, 250));
Players->AddLine(new TScoresPlayerLine(_("Players"), white_color, _("Deaths"), _("Killed"), _("Creations"), _("Score"), ""));
Players->AddLine(new TScoresPlayerLine(_("Players"), white_color, _("Losses"), _("Killed"), _("Creations"), _("Score"), ""));
InitDate = AddComponent(new TLabel(150, _("Begin of fight: ") + ch->Map()->InitDate()->String(), white_color,
Font::GetInstance(Font::Big)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment