mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Log save/load in teehistorian
This commit is contained in:
parent
df66d83a04
commit
d8aab366fc
|
@ -8,3 +8,7 @@ UUID(TEEHISTORIAN_AUTH_LOGIN, "teehistorian-auth-login@ddnet.tw")
|
|||
UUID(TEEHISTORIAN_AUTH_LOGOUT, "teehistorian-auth-logout@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_JOINVER6, "teehistorian-joinver6@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_JOINVER7, "teehistorian-joinver7@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_SAVE_SUCCESS, "teehistorian-save-success@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_SAVE_FAILURE, "teehistorian-save-failure@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_LOAD_SUCCESS, "teehistorian-load-success@ddnet.tw")
|
||||
UUID(TEEHISTORIAN_LOAD_FAILURE, "teehistorian-load-failure@ddnet.tw")
|
||||
|
|
|
@ -127,6 +127,8 @@ public:
|
|||
CTuningParams *Tuning() { return &m_Tuning; }
|
||||
CTuningParams *TuningList() { return &m_aTuningList[0]; }
|
||||
IAntibot *Antibot() { return m_pAntibot; }
|
||||
CTeeHistorian *TeeHistorian() { return &m_TeeHistorian; }
|
||||
bool TeeHistorianActive() const { return m_TeeHistorianActive; }
|
||||
|
||||
CGameContext();
|
||||
~CGameContext();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
||||
#include "teams.h"
|
||||
#include "teehistorian.h"
|
||||
#include "score.h"
|
||||
#include <engine/shared/config.h>
|
||||
|
||||
|
@ -681,11 +682,17 @@ void CGameTeams::ProcessSaveTeam()
|
|||
GameServer()->SendBroadcast(m_pSaveTeamResult[Team]->m_aBroadcast, -1);
|
||||
if(m_pSaveTeamResult[Team]->m_aMessage[0] != '\0' && m_pSaveTeamResult[Team]->m_Status != CScoreSaveResult::LOAD_FAILED)
|
||||
GameServer()->SendChatTeam(Team, m_pSaveTeamResult[Team]->m_aMessage);
|
||||
// TODO: log load/save success/fail in teehistorian
|
||||
switch(m_pSaveTeamResult[Team]->m_Status)
|
||||
{
|
||||
case CScoreSaveResult::SAVE_SUCCESS:
|
||||
{
|
||||
if(GameServer()->TeeHistorianActive())
|
||||
{
|
||||
GameServer()->TeeHistorian()->RecordTeamSaveSuccess(
|
||||
Team,
|
||||
m_pSaveTeamResult[Team]->m_SaveID,
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.GetString());
|
||||
}
|
||||
ResetSavedTeam(m_pSaveTeamResult[Team]->m_RequestingPlayer, Team);
|
||||
char aSaveID[UUID_MAXSTRSIZE];
|
||||
FormatUuid(m_pSaveTeamResult[Team]->m_SaveID, aSaveID, UUID_MAXSTRSIZE);
|
||||
|
@ -693,11 +700,20 @@ void CGameTeams::ProcessSaveTeam()
|
|||
break;
|
||||
}
|
||||
case CScoreSaveResult::SAVE_FAILED:
|
||||
if(GameServer()->TeeHistorianActive())
|
||||
GameServer()->TeeHistorian()->RecordTeamSaveFailure(Team);
|
||||
if(Count(Team) > 0)
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.load(Team);
|
||||
break;
|
||||
case CScoreSaveResult::LOAD_SUCCESS:
|
||||
{
|
||||
if(GameServer()->TeeHistorianActive())
|
||||
{
|
||||
GameServer()->TeeHistorian()->RecordTeamLoadSuccess(
|
||||
Team,
|
||||
m_pSaveTeamResult[Team]->m_SaveID,
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.GetString());
|
||||
}
|
||||
if(Count(Team) > 0)
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.load(Team);
|
||||
char aSaveID[UUID_MAXSTRSIZE];
|
||||
|
@ -706,6 +722,8 @@ void CGameTeams::ProcessSaveTeam()
|
|||
break;
|
||||
}
|
||||
case CScoreSaveResult::LOAD_FAILED:
|
||||
if(GameServer()->TeeHistorianActive())
|
||||
GameServer()->TeeHistorian()->RecordTeamLoadFailure(Team);
|
||||
if(m_pSaveTeamResult[Team]->m_aMessage[0] != '\0')
|
||||
GameServer()->SendChatTarget(m_pSaveTeamResult[Team]->m_RequestingPlayer, m_pSaveTeamResult[Team]->m_aMessage);
|
||||
break;
|
||||
|
|
|
@ -490,6 +490,70 @@ void CTeeHistorian::RecordTestExtra()
|
|||
WriteExtra(UUID_TEEHISTORIAN_TEST, "", 0);
|
||||
}
|
||||
|
||||
void CTeeHistorian::RecordTeamSaveSuccess(int Team, CUuid SaveID, const char *pTeamSave)
|
||||
{
|
||||
CPacker Buffer;
|
||||
Buffer.Reset();
|
||||
Buffer.AddInt(Team);
|
||||
Buffer.AddRaw(&SaveID, sizeof(SaveID));
|
||||
Buffer.AddString(pTeamSave, 0);
|
||||
|
||||
if(m_Debug)
|
||||
{
|
||||
char aSaveID[UUID_MAXSTRSIZE];
|
||||
FormatUuid(SaveID, aSaveID, sizeof(aSaveID));
|
||||
dbg_msg("teehistorian", "save_load team=%d save_id=%s team_save='%s'", Team, aSaveID, pTeamSave);
|
||||
}
|
||||
|
||||
WriteExtra(UUID_TEEHISTORIAN_SAVE_SUCCESS, Buffer.Data(), Buffer.Size());
|
||||
}
|
||||
|
||||
void CTeeHistorian::RecordTeamSaveFailure(int Team)
|
||||
{
|
||||
CPacker Buffer;
|
||||
Buffer.Reset();
|
||||
Buffer.AddInt(Team);
|
||||
|
||||
if(m_Debug)
|
||||
{
|
||||
dbg_msg("teehistorian", "save_load team=%d", Team);
|
||||
}
|
||||
|
||||
WriteExtra(UUID_TEEHISTORIAN_SAVE_FAILURE, Buffer.Data(), Buffer.Size());
|
||||
}
|
||||
|
||||
void CTeeHistorian::RecordTeamLoadSuccess(int Team, CUuid SaveID, const char *pTeamSave)
|
||||
{
|
||||
CPacker Buffer;
|
||||
Buffer.Reset();
|
||||
Buffer.AddInt(Team);
|
||||
Buffer.AddRaw(&SaveID, sizeof(SaveID));
|
||||
Buffer.AddString(pTeamSave, 0);
|
||||
|
||||
if(m_Debug)
|
||||
{
|
||||
char aSaveID[UUID_MAXSTRSIZE];
|
||||
FormatUuid(SaveID, aSaveID, sizeof(aSaveID));
|
||||
dbg_msg("teehistorian", "save_load team=%d save_id=%s team_save='%s'", Team, aSaveID, pTeamSave);
|
||||
}
|
||||
|
||||
WriteExtra(UUID_TEEHISTORIAN_LOAD_SUCCESS, Buffer.Data(), Buffer.Size());
|
||||
}
|
||||
|
||||
void CTeeHistorian::RecordTeamLoadFailure(int Team)
|
||||
{
|
||||
CPacker Buffer;
|
||||
Buffer.Reset();
|
||||
Buffer.AddInt(Team);
|
||||
|
||||
if(m_Debug)
|
||||
{
|
||||
dbg_msg("teehistorian", "save_load team=%d", Team);
|
||||
}
|
||||
|
||||
WriteExtra(UUID_TEEHISTORIAN_LOAD_FAILURE, Buffer.Data(), Buffer.Size());
|
||||
}
|
||||
|
||||
void CTeeHistorian::EndInputs()
|
||||
{
|
||||
dbg_assert(m_State == STATE_INPUTS, "invalid teehistorian state");
|
||||
|
|
|
@ -66,6 +66,10 @@ public:
|
|||
void RecordPlayerDrop(int ClientID, const char *pReason);
|
||||
void RecordConsoleCommand(int ClientID, int FlagMask, const char *pCmd, IConsole::IResult *pResult);
|
||||
void RecordTestExtra();
|
||||
void RecordTeamSaveSuccess(int Team, CUuid SaveID, const char *pTeamSave);
|
||||
void RecordTeamSaveFailure(int Team);
|
||||
void RecordTeamLoadSuccess(int Team, CUuid SaveID, const char *pTeamSave);
|
||||
void RecordTeamLoadFailure(int Team);
|
||||
void EndInputs();
|
||||
|
||||
void EndTick();
|
||||
|
|
Loading…
Reference in a new issue