Revereted the reconnect feature because after testing it, i found out that currently it is not so useful, and i don't have time to make it work for dynamic ips atm

so revert it for now maybe later i will fix it

Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
GreYFoXGTi 2010-09-19 22:13:28 +03:00
parent 2058ad4ea7
commit b32f9d4184
2 changed files with 0 additions and 97 deletions

View file

@ -541,7 +541,6 @@ void CGameContext::OnClientEnter(int ClientId)
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
m_VoteUpdate = true; m_VoteUpdate = true;
ClientEnter(ClientId);
} }
bool compare_players(CPlayer *pl1, CPlayer *pl2) bool compare_players(CPlayer *pl1, CPlayer *pl2)
@ -604,7 +603,6 @@ void CGameContext::OnClientConnected(int ClientId)
void CGameContext::OnClientDrop(int ClientId) void CGameContext::OnClientDrop(int ClientId)
{ {
ClientLeave(ClientId);
AbortVoteKickOnDisconnect(ClientId); AbortVoteKickOnDisconnect(ClientId);
m_apPlayers[ClientId]->OnDisconnect(); m_apPlayers[ClientId]->OnDisconnect();
delete m_apPlayers[ClientId]; delete m_apPlayers[ClientId];
@ -2473,96 +2471,3 @@ const char *CGameContext::NetVersion() { return GAME_NETVERSION; }
IGameServer *CreateGameServer() { return new CGameContext; } IGameServer *CreateGameServer() { return new CGameContext; }
bool CGameContext::ClientLeave(int ClientId)
{
CCharacter *pChr = GetPlayerChar(ClientId);
for(int i =0;i<MAX_CLIENTS;i++)
{
if (!str_length(m_pReconnectInfo[i].Ip))
{
Server()->GetClientIP(ClientId,m_pReconnectInfo[i].Ip,sizeof(m_pReconnectInfo[i].Ip));
if(pChr)
{
m_pReconnectInfo[i].m_PlayerInfo.m_Core = pChr->m_Core;
m_pReconnectInfo[i].m_PlayerInfo.m_StartTime = pChr->m_StartTime;
m_pReconnectInfo[i].m_PlayerInfo.m_RaceState = pChr->m_RaceState;
for(int j = 0; j < WEAPON_NINJA; ++j)
{
m_pReconnectInfo[i].m_PlayerInfo.m_aHasWeapon[j] = pChr->m_aWeapons[j].m_Got;
}
m_pReconnectInfo[i].m_PlayerInfo.m_FreezeTime=pChr->m_FreezeTime;
m_pReconnectInfo[i].m_PlayerInfo.m_Doored = pChr->m_Doored;
m_pReconnectInfo[i].m_PlayerInfo.m_OldPos = pChr->m_OldPos;
m_pReconnectInfo[i].m_PlayerInfo.m_OlderPos = pChr->m_OlderPos;
m_pReconnectInfo[i].m_PlayerInfo.m_LastAction = pChr->m_LastAction;
m_pReconnectInfo[i].m_PlayerInfo.m_Jumped = pChr->m_Jumped;
m_pReconnectInfo[i].m_PlayerInfo.m_Health = pChr->m_Health;
m_pReconnectInfo[i].m_PlayerInfo.m_Armor = pChr->m_Armor;
m_pReconnectInfo[i].m_PlayerInfo.m_PlayerState = pChr->m_PlayerState;
m_pReconnectInfo[i].m_PlayerInfo.m_LastMove = pChr->m_LastMove;
m_pReconnectInfo[i].m_PlayerInfo.m_PrevPos = pChr->m_PrevPos;
m_pReconnectInfo[i].m_PlayerInfo.m_ActiveWeapon = pChr->m_ActiveWeapon;
m_pReconnectInfo[i].m_PlayerInfo.m_LastWeapon = pChr->m_LastWeapon;
m_pReconnectInfo[i].m_PlayerInfo.m_HammerType = pChr->m_HammerType;
m_pReconnectInfo[i].m_PlayerInfo.m_Super = pChr->m_Super;
m_pReconnectInfo[i].m_PlayerInfo.m_PauseTime = Server()->Tick();
m_pReconnectInfo[i].m_DisconnectTick = Server()->Tick();
return true;
}
else
{
mem_zero(m_pReconnectInfo[i].Ip,sizeof(m_pReconnectInfo[i].Ip));
return false;
}
}
}
}
bool CGameContext::ClientEnter(int ClientId)
{
char Temp[64];
Server()->GetClientIP(ClientId,Temp,sizeof(Temp));
for(int i =0;i<MAX_CLIENTS;i++)
{
if (!str_comp(Temp,m_pReconnectInfo[ClientId].Ip))
if(m_pReconnectInfo[i].m_DisconnectTick > Server()->Tick() - (Server()->TickSpeed() * g_Config.m_SvMaxDCRestore))
{
mem_zero(Temp,sizeof(Temp));
if(m_apPlayers[ClientId])
{
m_apPlayers[ClientId]->m_PauseInfo.m_Core = m_pReconnectInfo[i].m_PlayerInfo.m_Core;
m_apPlayers[ClientId]->m_PauseInfo.m_StartTime = m_pReconnectInfo[i].m_PlayerInfo.m_StartTime;
m_apPlayers[ClientId]->m_PauseInfo.m_RaceState = m_pReconnectInfo[i].m_PlayerInfo.m_RaceState;
for(int j = 0; j < WEAPON_NINJA; ++j)
{
m_apPlayers[ClientId]->m_PauseInfo.m_aHasWeapon[j] = m_pReconnectInfo[i].m_PlayerInfo.m_aHasWeapon[j];
}
m_apPlayers[ClientId]->m_PauseInfo.m_FreezeTime=m_pReconnectInfo[i].m_PlayerInfo.m_FreezeTime;
m_apPlayers[ClientId]->m_PauseInfo.m_Doored = m_pReconnectInfo[i].m_PlayerInfo.m_Doored;
m_apPlayers[ClientId]->m_PauseInfo.m_OldPos = m_pReconnectInfo[i].m_PlayerInfo.m_OldPos;
m_apPlayers[ClientId]->m_PauseInfo.m_OlderPos = m_pReconnectInfo[i].m_PlayerInfo.m_OlderPos;
m_apPlayers[ClientId]->m_PauseInfo.m_LastAction = m_pReconnectInfo[i].m_PlayerInfo.m_LastAction;
m_apPlayers[ClientId]->m_PauseInfo.m_Jumped = m_pReconnectInfo[i].m_PlayerInfo.m_Jumped;
m_apPlayers[ClientId]->m_PauseInfo.m_Health = m_pReconnectInfo[i].m_PlayerInfo.m_Health;
m_apPlayers[ClientId]->m_PauseInfo.m_Armor = m_pReconnectInfo[i].m_PlayerInfo.m_Armor;
m_apPlayers[ClientId]->m_PauseInfo.m_PlayerState = m_pReconnectInfo[i].m_PlayerInfo.m_PlayerState;
m_apPlayers[ClientId]->m_PauseInfo.m_LastMove = m_pReconnectInfo[i].m_PlayerInfo.m_LastMove;
m_apPlayers[ClientId]->m_PauseInfo.m_PrevPos = m_pReconnectInfo[i].m_PlayerInfo.m_PrevPos;
m_apPlayers[ClientId]->m_PauseInfo.m_ActiveWeapon = m_pReconnectInfo[i].m_PlayerInfo.m_ActiveWeapon;
m_apPlayers[ClientId]->m_PauseInfo.m_LastWeapon = m_pReconnectInfo[i].m_PlayerInfo.m_LastWeapon;
m_apPlayers[ClientId]->m_PauseInfo.m_HammerType = m_pReconnectInfo[i].m_PlayerInfo.m_HammerType;
m_apPlayers[ClientId]->m_PauseInfo.m_Super = m_pReconnectInfo[i].m_PlayerInfo.m_Super;
m_apPlayers[ClientId]->m_PauseInfo.m_PauseTime = m_pReconnectInfo[i].m_DisconnectTick;
m_apPlayers[ClientId]->m_InfoSaved = true;
m_apPlayers[ClientId]->m_PauseInfo.m_Respawn = true;
m_apPlayers[ClientId]->SetTeam(0);
mem_zero(m_pReconnectInfo[i].Ip,sizeof(m_pReconnectInfo[i].Ip));
SendChatTarget(ClientId,"Welcome back");
return true;
}
}
else
mem_zero(m_pReconnectInfo[i].Ip,sizeof(m_pReconnectInfo[i].Ip));
}
return false;
}

View file

@ -184,8 +184,6 @@ public:
void CreateSound(vec2 Pos, int Sound, int Mask=-1); void CreateSound(vec2 Pos, int Sound, int Mask=-1);
void CreateSoundGlobal(int Sound, int Target=-1); void CreateSoundGlobal(int Sound, int Target=-1);
bool ClientLeave(int ClientId);
bool ClientEnter(int ClientId);
struct ReconnectInfo struct ReconnectInfo
{ {
struct PlayerInfo { struct PlayerInfo {