Enhanced slightly
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2542 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
1069d3bfd5
commit
0efe5eb421
1 changed files with 49 additions and 5 deletions
|
@ -65,15 +65,47 @@ typedef struct {
|
||||||
stat deaths; //times they died (including by you)
|
stat deaths; //times they died (including by you)
|
||||||
stat kills; //times they killed (including by you)
|
stat kills; //times they killed (including by you)
|
||||||
stat teamkills; //times they killed a team member.
|
stat teamkills; //times they killed a team member.
|
||||||
stat teamdeaths; //times they killed a team member.
|
stat teamdeaths; //times they died to a team member.
|
||||||
stat suisides; //times they were stupid.
|
stat suisides; //times they were stupid.
|
||||||
} clienttotals[MAX_CLIENTS];
|
} clienttotals[MAX_CLIENTS];
|
||||||
|
|
||||||
|
qboolean readcaps;
|
||||||
|
qboolean readkills;
|
||||||
statmessage_t *message;
|
statmessage_t *message;
|
||||||
} fragstats_t;
|
} fragstats_t;
|
||||||
|
|
||||||
static fragstats_t fragstats;
|
static fragstats_t fragstats;
|
||||||
|
|
||||||
|
int Stats_GetKills(int playernum)
|
||||||
|
{
|
||||||
|
return fragstats.clienttotals[playernum].kills;
|
||||||
|
}
|
||||||
|
int Stats_GetTKills(int playernum)
|
||||||
|
{
|
||||||
|
return fragstats.clienttotals[playernum].teamkills;
|
||||||
|
}
|
||||||
|
int Stats_GetDeaths(int playernum)
|
||||||
|
{
|
||||||
|
return fragstats.clienttotals[playernum].deaths;
|
||||||
|
}
|
||||||
|
int Stats_GetTouches(int playernum)
|
||||||
|
{
|
||||||
|
return fragstats.clienttotals[playernum].grabs;
|
||||||
|
}
|
||||||
|
int Stats_GetCaptures(int playernum)
|
||||||
|
{
|
||||||
|
return fragstats.clienttotals[playernum].caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean Stats_HaveFlags(void)
|
||||||
|
{
|
||||||
|
return fragstats.readcaps;
|
||||||
|
}
|
||||||
|
qboolean Stats_HaveKills(void)
|
||||||
|
{
|
||||||
|
return fragstats.readkills;
|
||||||
|
}
|
||||||
|
|
||||||
void VARGS Stats_Message(char *msg, ...)
|
void VARGS Stats_Message(char *msg, ...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -111,6 +143,8 @@ void Stats_Evaluate(fragfilemsgtypes_t mt, int wid, int p1, int p2)
|
||||||
fragstats.weapontotals[wid].ownsuicides++;
|
fragstats.weapontotals[wid].ownsuicides++;
|
||||||
fragstats.weapontotals[wid].owndeaths++;
|
fragstats.weapontotals[wid].owndeaths++;
|
||||||
fragstats.weapontotals[wid].ownkills++;
|
fragstats.weapontotals[wid].ownkills++;
|
||||||
|
|
||||||
|
Stats_Message("You are a fool\n");
|
||||||
}
|
}
|
||||||
fragstats.weapontotals[wid].suicides++;
|
fragstats.weapontotals[wid].suicides++;
|
||||||
fragstats.weapontotals[wid].kills++;
|
fragstats.weapontotals[wid].kills++;
|
||||||
|
@ -270,6 +304,12 @@ static void Stats_StatMessage(fragfilemsgtypes_t type, int wid, char *token1, ch
|
||||||
|
|
||||||
ms->next = fragstats.message;
|
ms->next = fragstats.message;
|
||||||
fragstats.message = ms;
|
fragstats.message = ms;
|
||||||
|
|
||||||
|
//we have a message type, save the fact that we have it.
|
||||||
|
if (type == ff_flagtouch || type == ff_flagcaps || type == ff_flagdrops)
|
||||||
|
fragstats.readcaps = true;
|
||||||
|
if (type == ff_frags || type == ff_fragedby)
|
||||||
|
fragstats.readkills = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Stats_Clear(void)
|
static void Stats_Clear(void)
|
||||||
|
@ -311,10 +351,15 @@ static void Stats_LoadFragFile(char *name)
|
||||||
|
|
||||||
file = COM_LoadTempFile(filename);
|
file = COM_LoadTempFile(filename);
|
||||||
if (!file || !*file)
|
if (!file || !*file)
|
||||||
|
{
|
||||||
|
Con_DPrintf("Couldn't load %s\n", filename);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Con_DPrintf("Loaded %s\n", filename);
|
||||||
|
|
||||||
oend = 1;
|
oend = 1;
|
||||||
for (;;)
|
for (;*file;)
|
||||||
{
|
{
|
||||||
if (!oend)
|
if (!oend)
|
||||||
break;
|
break;
|
||||||
|
@ -322,9 +367,6 @@ static void Stats_LoadFragFile(char *name)
|
||||||
;
|
;
|
||||||
oend = *end;
|
oend = *end;
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
if (!*file)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Cmd_TokenizeString(file, true, false);
|
Cmd_TokenizeString(file, true, false);
|
||||||
file = end+1;
|
file = end+1;
|
||||||
if (!Cmd_Argc())
|
if (!Cmd_Argc())
|
||||||
|
@ -477,7 +519,9 @@ void Stats_ParsePrintLine(char *line)
|
||||||
|
|
||||||
p1 = Stats_ExtractName(&line);
|
p1 = Stats_ExtractName(&line);
|
||||||
if (p1<0) //reject it.
|
if (p1<0) //reject it.
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (ms = fragstats.message; ms; ms = ms->next)
|
for (ms = fragstats.message; ms; ms = ms->next)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue