This commit is contained in:
btd 2010-11-13 00:50:51 +03:00
parent 30680ddd79
commit 7fcd245611
5 changed files with 21 additions and 14 deletions

View file

@ -93,7 +93,9 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
if(m_pPlayer->m_RconFreeze) Freeze(-1);
GameServer()->m_pController->OnCharacterSpawn(this);
if(GetPlayer()->m_IsUsingDDRaceClient) {
Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID());
}
return true;
}
@ -102,6 +104,7 @@ void CCharacter::Destroy()
{
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
m_Alive = false;
CEntity::Destroy();
}
void CCharacter::SetWeapon(int W)
@ -1368,7 +1371,7 @@ void CCharacter::Die(int Killer, int Weapon)
m_pPlayer->m_DieTick = Server()->Tick();
m_Alive = false;
GameServer()->m_World.RemoveEntity(this);
MarkDestroy();
GameServer()->m_World.m_Core.m_apCharacters[m_pPlayer->GetCID()] = 0;
GameServer()->CreateDeath(m_Pos, m_pPlayer->GetCID());

View file

@ -25,7 +25,7 @@ void CDoor::Open(int Tick, bool ActivatedTeam[])
{
for (int i = 0; i < MAX_CLIENTS; ++i) {
if(ActivatedTeam[i]) m_EvalTick[i] = Tick;
m_Opened[i] = ActivatedTeam[i];
//m_Opened[i] = ActivatedTeam[i];
if(ActivatedTeam[i]) Open(i);
}
}
@ -62,7 +62,7 @@ void CDoor::Close(int Team)
void CDoor::Reset()
{
for (int i = 0; i < MAX_CLIENTS; ++i) {
m_Opened[i] = false;
//m_Opened[i] = false;
Close(i);
}
}

View file

@ -76,6 +76,10 @@ public:
class CGameContext *GameServer() { return GameWorld()->GameServer(); }
class IServer *Server() { return GameWorld()->Server(); }
void MarkDestroy() {
m_MarkedForDestroy = true;
}
CEntity *TypeNext() { return m_pNextTypeEntity; }
CEntity *TypePrev() { return m_pPrevTypeEntity; }

View file

@ -35,8 +35,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team)
CPlayer::~CPlayer()
{
delete Character;
Character = 0;
if(!Character) Character->Destroy();
}
void CPlayer::Tick()
@ -80,7 +79,7 @@ void CPlayer::Tick()
}
else
{
delete Character;
Character->MarkDestroy();
Character = 0;
}
}
@ -179,7 +178,7 @@ void CPlayer::KillCharacter(int Weapon)
if(Character)
{
Character->Die(m_ClientID, Weapon);
delete Character;
//delete Character;
Character = 0;
}
}
@ -207,8 +206,8 @@ void CPlayer::SetTeam(int Team)
m_LastActionTick = Server()->Tick();
// we got to wait 0.5 secs before respawning
m_RespawnTick = Server()->Tick()+Server()->TickSpeed()/2;
str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' m_Team=%d", m_ClientID, Server()->ClientName(m_ClientID), m_Team);
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
//str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' m_Team=%d", m_ClientID, Server()->ClientName(m_ClientID), m_Team);
//GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
//GameServer()->m_pController->OnPlayerInfoChange(GameServer()->m_apPlayers[m_ClientID]);
}

View file

@ -89,11 +89,7 @@ bool CGameTeams::SetCharacterTeam(int id, int Team) {
}
SetForceCharacterTeam(id, Team);
dbg_msg1("Teams", "Id = %d Team = %d", id, Team);
if(Character(id) && Character(id)->GetPlayer()->m_IsUsingDDRaceClient) {
SendTeamsState(id);
}
//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());
return true;
}
@ -120,6 +116,11 @@ void CGameTeams::SetForceCharacterTeam(int id, int Team) {
if(Team != TEAM_SUPER && m_TeamState[Team] == EMPTY) {
ChangeTeamState(Team, OPEN);
}
dbg_msg1("Teams", "Id = %d Team = %d", id, Team);
if(Character(id) && Character(id)->GetPlayer()->m_IsUsingDDRaceClient) {
SendTeamsState(id);
}
}
int CGameTeams::Count(int Team) const{