diff --git a/src/engine/shared/protocolglue.cpp b/src/engine/shared/protocolglue.cpp index e6bc23f95..e690614ca 100644 --- a/src/engine/shared/protocolglue.cpp +++ b/src/engine/shared/protocolglue.cpp @@ -4,6 +4,16 @@ #include "protocolglue.h" +int GameFlags_ClampToSix(int Flags) +{ + int Six = 0; + if(Flags & GAMEFLAG_TEAMS) + Six |= GAMEFLAG_TEAMS; + if(Flags & GAMEFLAG_FLAGS) + Six |= GAMEFLAG_FLAGS; + return Six; +} + int PlayerFlags_SevenToSix(int Flags) { int Six = 0; diff --git a/src/engine/shared/protocolglue.h b/src/engine/shared/protocolglue.h index 8fa2f13dd..614cc6298 100644 --- a/src/engine/shared/protocolglue.h +++ b/src/engine/shared/protocolglue.h @@ -1,6 +1,7 @@ #ifndef ENGINE_SHARED_PROTOCOLGLUE_H #define ENGINE_SHARED_PROTOCOLGLUE_H +int GameFlags_ClampToSix(int Flags); int PlayerFlags_SevenToSix(int Flags); int PlayerFlags_SixToSeven(int Flags); void PickupType_SevenToSix(int Type7, int &Type6, int &SubType6); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 27cc8990d..61faa6a29 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1483,26 +1483,6 @@ void CGameContext::OnClientEnter(int ClientId) } m_pController->OnPlayerConnect(m_apPlayers[ClientId]); - if(Server()->IsSixup(ClientId)) - { - { - protocol7::CNetMsg_Sv_GameInfo Msg; - Msg.m_GameFlags = protocol7::GAMEFLAG_RACE; - Msg.m_MatchCurrent = 1; - Msg.m_MatchNum = 0; - Msg.m_ScoreLimit = 0; - Msg.m_TimeLimit = 0; - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId); - } - - // /team is essential - { - protocol7::CNetMsg_Sv_CommandInfoRemove Msg; - Msg.m_pName = "team"; - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId); - } - } - { CNetMsg_Sv_CommandInfoGroupStart Msg; Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId); diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index 3ca74ba05..ab5be9dd5 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -2,6 +2,7 @@ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include +#include #include #include #include @@ -397,6 +398,26 @@ void IGameController::OnPlayerConnect(CPlayer *pPlayer) str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientId, Server()->ClientName(ClientId), pPlayer->GetTeam()); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); } + + if(Server()->IsSixup(ClientId)) + { + { + protocol7::CNetMsg_Sv_GameInfo Msg; + Msg.m_GameFlags = m_GameFlags; + Msg.m_MatchCurrent = 1; + Msg.m_MatchNum = 0; + Msg.m_ScoreLimit = 0; + Msg.m_TimeLimit = 0; + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId); + } + + // /team is essential + { + protocol7::CNetMsg_Sv_CommandInfoRemove Msg; + Msg.m_pName = "team"; + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientId); + } + } } void IGameController::OnPlayerDisconnect(class CPlayer *pPlayer, const char *pReason) @@ -553,7 +574,7 @@ void IGameController::Snap(int SnappingClient) if(!pGameInfoObj) return; - pGameInfoObj->m_GameFlags = m_GameFlags; + pGameInfoObj->m_GameFlags = GameFlags_ClampToSix(m_GameFlags); pGameInfoObj->m_GameStateFlags = 0; if(m_GameOverTick != -1) pGameInfoObj->m_GameStateFlags |= GAMESTATEFLAG_GAMEOVER; diff --git a/src/game/server/gamemodes/DDRace.cpp b/src/game/server/gamemodes/DDRace.cpp index efbef3c52..da14b863a 100644 --- a/src/game/server/gamemodes/DDRace.cpp +++ b/src/game/server/gamemodes/DDRace.cpp @@ -18,6 +18,7 @@ CGameControllerDDRace::CGameControllerDDRace(class CGameContext *pGameServer) : IGameController(pGameServer) { m_pGameType = g_Config.m_SvTestingCommands ? TEST_TYPE_NAME : GAME_TYPE_NAME; + m_GameFlags = protocol7::GAMEFLAG_RACE; } CGameControllerDDRace::~CGameControllerDDRace() = default;