Skip to content

Commit

Permalink
TDM add snap and remove gameflag_flags
Browse files Browse the repository at this point in the history
  • Loading branch information
M0REKZ committed Jul 29, 2024
1 parent 76f8e10 commit 6a76f96
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game/server/gamemodes/dm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CGameControllerDM::CGameControllerDM(class CGameContext *pGameServer) :
CGameControllerInstagib(pGameServer)
{
m_GameFlags = GAMEFLAG_FLAGS;
m_GameFlags = 0;
}

CGameControllerDM::~CGameControllerDM() = default;
Expand Down
17 changes: 16 additions & 1 deletion src/game/server/gamemodes/tdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CGameControllerTDM::CGameControllerTDM(class CGameContext *pGameServer) :
CGameControllerDM(pGameServer)
{
m_GameFlags = GAMEFLAG_TEAMS | GAMEFLAG_FLAGS;
m_GameFlags = GAMEFLAG_TEAMS;
}

CGameControllerTDM::~CGameControllerTDM() = default;
Expand Down Expand Up @@ -54,3 +54,18 @@ int CGameControllerTDM::OnCharacterDeath(class CCharacter *pVictim, class CPlaye
}
return false;
}

void CGameControllerTDM::Snap(int SnappingClient)
{
IGameController::Snap(SnappingClient);

CNetObj_GameData *pGameDataObj = (CNetObj_GameData *)Server()->SnapNewItem(NETOBJTYPE_GAMEDATA, 0, sizeof(CNetObj_GameData));
if(!pGameDataObj)
return;

pGameDataObj->m_TeamscoreRed = m_aTeamscore[TEAM_RED];
pGameDataObj->m_TeamscoreBlue = m_aTeamscore[TEAM_BLUE];

pGameDataObj->m_FlagCarrierRed = 0;
pGameDataObj->m_FlagCarrierBlue = 0;
}
1 change: 1 addition & 0 deletions src/game/server/gamemodes/tdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class CGameControllerTDM : public CGameControllerDM
CGameControllerTDM(class CGameContext *pGameServer);
~CGameControllerTDM();

virtual void Snap(int SnappingClient) override;
virtual int OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int Weapon) override;
void Tick() override;
};
Expand Down

0 comments on commit 6a76f96

Please sign in to comment.