Inform player about possibility to keep the hook when loading

Message is displayed when saving with an active hook
This commit is contained in:
Zwelf 2021-01-23 16:49:50 +01:00
parent 7f4ec45e9a
commit a3702e8314
3 changed files with 15 additions and 0 deletions

View file

@ -395,6 +395,11 @@ void CSaveTee::LoadHookedPlayer(const CSaveTeam *pTeam)
m_HookedPlayer = pTeam->m_pSavedTees[m_HookedPlayer].GetClientID();
}
bool CSaveTee::IsHooking() const
{
return m_HookState == HOOK_GRABBED || m_HookState == HOOK_FLYING;
}
CSaveTeam::CSaveTeam(IGameController *Controller)
{
m_pController = Controller;

View file

@ -20,6 +20,7 @@ public:
char *GetString(const CSaveTeam *pTeam);
int FromString(const char *String);
void LoadHookedPlayer(const CSaveTeam *pTeam);
bool IsHooking() const;
vec2 GetPos() const { return m_Pos; }
const char *GetName() const { return m_aName; }
int GetClientID() const { return m_ClientID; }

View file

@ -687,6 +687,15 @@ void CGameTeams::ProcessSaveTeam()
m_pSaveTeamResult[Team]->m_SaveID,
m_pSaveTeamResult[Team]->m_SavedTeam.GetString());
}
for(int i = 0; i < m_pSaveTeamResult[Team]->m_SavedTeam.GetMembersCount(); i++)
{
if(m_pSaveTeamResult[Team]->m_SavedTeam.m_pSavedTees->IsHooking())
{
int ClientID = m_pSaveTeamResult[Team]->m_SavedTeam.m_pSavedTees->GetClientID();
if(GameServer()->m_apPlayers[ClientID] != nullptr)
GameServer()->SendChatTarget(ClientID, "Start holding the hook before loading the savegame to keep the hook");
}
}
ResetSavedTeam(m_pSaveTeamResult[Team]->m_RequestingPlayer, Team);
char aSaveID[UUID_MAXSTRSIZE];
FormatUuid(m_pSaveTeamResult[Team]->m_SaveID, aSaveID, UUID_MAXSTRSIZE);