mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #3626
3626: Rename save/load to conform to the code style r=def- a=Zwelf Small cleanup ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Zwelf <zwelf@strct.cc>
This commit is contained in:
commit
1ac07fe797
|
@ -756,7 +756,7 @@ void CGameContext::ConDrySave(IConsole::IResult *pResult, void *pUserData)
|
|||
return;
|
||||
|
||||
CSaveTeam SavedTeam(pSelf->m_pController);
|
||||
int Result = SavedTeam.save(pPlayer->GetTeam());
|
||||
int Result = SavedTeam.Save(pPlayer->GetTeam());
|
||||
if(CSaveTeam::HandleSaveError(Result, pResult->m_ClientID, pSelf))
|
||||
return;
|
||||
|
||||
|
|
|
@ -2071,7 +2071,7 @@ void CCharacter::SetTeams(CGameTeams *pTeams)
|
|||
|
||||
void CCharacter::SetRescue()
|
||||
{
|
||||
m_RescueTee.save(this);
|
||||
m_RescueTee.Save(this);
|
||||
m_SetSavePos = true;
|
||||
}
|
||||
|
||||
|
@ -2344,7 +2344,7 @@ void CCharacter::Rescue()
|
|||
}
|
||||
|
||||
float StartTime = m_StartTime;
|
||||
m_RescueTee.load(this, Team());
|
||||
m_RescueTee.Load(this, Team());
|
||||
// Don't load these from saved tee:
|
||||
m_Core.m_Vel = vec2(0, 0);
|
||||
m_Core.m_HookState = HOOK_IDLE;
|
||||
|
|
|
@ -17,7 +17,7 @@ CSaveTee::~CSaveTee()
|
|||
{
|
||||
}
|
||||
|
||||
void CSaveTee::save(CCharacter *pChr)
|
||||
void CSaveTee::Save(CCharacter *pChr)
|
||||
{
|
||||
m_ClientID = pChr->m_pPlayer->GetCID();
|
||||
str_copy(m_aName, pChr->Server()->ClientName(m_ClientID), sizeof(m_aName));
|
||||
|
@ -108,7 +108,7 @@ void CSaveTee::save(CCharacter *pChr)
|
|||
FormatUuid(pChr->GameServer()->GameUuid(), m_aGameUuid, sizeof(m_aGameUuid));
|
||||
}
|
||||
|
||||
void CSaveTee::load(CCharacter *pChr, int Team)
|
||||
void CSaveTee::Load(CCharacter *pChr, int Team)
|
||||
{
|
||||
pChr->m_pPlayer->Pause(m_Paused, true);
|
||||
|
||||
|
@ -415,7 +415,7 @@ CSaveTeam::~CSaveTeam()
|
|||
delete[] m_pSavedTees;
|
||||
}
|
||||
|
||||
int CSaveTeam::save(int Team)
|
||||
int CSaveTeam::Save(int Team)
|
||||
{
|
||||
if(g_Config.m_SvTeam == 3 || (Team > 0 && Team < MAX_CLIENTS))
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ int CSaveTeam::save(int Team)
|
|||
continue;
|
||||
if(m_MembersCount == j)
|
||||
return 3;
|
||||
m_pSavedTees[j].save(p);
|
||||
m_pSavedTees[j].Save(p);
|
||||
j++;
|
||||
}
|
||||
if(m_MembersCount != j)
|
||||
|
@ -498,7 +498,7 @@ bool CSaveTeam::HandleSaveError(int Result, int ClientID, CGameContext *pGameCon
|
|||
return true;
|
||||
}
|
||||
|
||||
void CSaveTeam::load(int Team, bool KeepCurrentWeakStrong)
|
||||
void CSaveTeam::Load(int Team, bool KeepCurrentWeakStrong)
|
||||
{
|
||||
CGameTeams *pTeams = &(((CGameControllerDDRace *)m_pController)->m_Teams);
|
||||
|
||||
|
@ -513,7 +513,7 @@ void CSaveTeam::load(int Team, bool KeepCurrentWeakStrong)
|
|||
if(m_pController->GameServer()->m_apPlayers[ClientID] && pTeams->m_Core.Team(ClientID) == Team)
|
||||
{
|
||||
CCharacter *pChr = MatchCharacter(m_pSavedTees[i].GetClientID(), i, KeepCurrentWeakStrong);
|
||||
m_pSavedTees[i].load(pChr, Team);
|
||||
m_pSavedTees[i].Load(pChr, Team);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ class CSaveTee
|
|||
public:
|
||||
CSaveTee();
|
||||
~CSaveTee();
|
||||
void save(CCharacter *pchr);
|
||||
void load(CCharacter *pchr, int Team);
|
||||
void Save(CCharacter *pchr);
|
||||
void Load(CCharacter *pchr, int Team);
|
||||
char *GetString(const CSaveTeam *pTeam);
|
||||
int FromString(const char *String);
|
||||
void LoadHookedPlayer(const CSaveTeam *pTeam);
|
||||
|
@ -119,8 +119,8 @@ public:
|
|||
int FromString(const char *String);
|
||||
// returns true if a team can load, otherwise writes a nice error Message in pMessage
|
||||
bool MatchPlayers(const char (*paNames)[MAX_NAME_LENGTH], const int *pClientID, int NumPlayer, char *pMessage, int MessageLen);
|
||||
int save(int Team);
|
||||
void load(int Team, bool KeepCurrentWeakStrong);
|
||||
int Save(int Team);
|
||||
void Load(int Team, bool KeepCurrentWeakStrong);
|
||||
CSaveTee *m_pSavedTees;
|
||||
|
||||
// returns true if an error occured
|
||||
|
|
|
@ -1349,7 +1349,7 @@ void CScore::SaveTeam(int ClientID, const char *Code, const char *Server)
|
|||
|
||||
auto SaveResult = std::make_shared<CScoreSaveResult>(ClientID, pController);
|
||||
SaveResult->m_SaveID = RandomUuid();
|
||||
int Result = SaveResult->m_SavedTeam.save(Team);
|
||||
int Result = SaveResult->m_SavedTeam.Save(Team);
|
||||
if(CSaveTeam::HandleSaveError(Result, ClientID, GameServer()))
|
||||
return;
|
||||
pController->m_Teams.SetSaving(Team, SaveResult);
|
||||
|
|
|
@ -717,7 +717,7 @@ void CGameTeams::ProcessSaveTeam()
|
|||
if(Count(Team) > 0)
|
||||
{
|
||||
// load weak/strong order to prevent switching weak/strong while saving
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.load(Team, false);
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.Load(Team, false);
|
||||
}
|
||||
break;
|
||||
case CScoreSaveResult::LOAD_SUCCESS:
|
||||
|
@ -732,7 +732,7 @@ void CGameTeams::ProcessSaveTeam()
|
|||
if(Count(Team) > 0)
|
||||
{
|
||||
// keep current weak/strong order as on some maps there is no other way of switching
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.load(Team, true);
|
||||
m_pSaveTeamResult[Team]->m_SavedTeam.Load(Team, true);
|
||||
}
|
||||
char aSaveID[UUID_MAXSTRSIZE];
|
||||
FormatUuid(m_pSaveTeamResult[Team]->m_SaveID, aSaveID, UUID_MAXSTRSIZE);
|
||||
|
|
Loading…
Reference in a new issue