Skip to content

Commit

Permalink
Fix flag not attached to carrier (closed #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Sep 6, 2023
1 parent 0ff43d2 commit ba4c074
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/game/server/entities/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,32 @@ void CFlag::Snap(int SnappingClient)
if(NetworkClipped(SnappingClient))
return;

// this should not be here ._.
// it is also done in TickDeferred and vanilla does not
// keep this in here
// but thats the only fix i found for
// https://github.com/ZillyInsta/ddnet-insta/issues/6
// in 0.7 the flag laggs behind otherwise unless cl_predict_players is set to 1
// which is not needed on vanilla servers
if(m_pCarrier)
m_Pos = m_pCarrier->GetPos();

if(Server()->IsSixup(SnappingClient))
{
protocol7::CNetObj_Flag *pFlag = Server()->SnapNewItem<protocol7::CNetObj_Flag>(m_Team);
if(!pFlag)
return;
pFlag->m_X = (int)m_Pos.x;
pFlag->m_Y = (int)m_Pos.y;
pFlag->m_X = round_to_int(m_Pos.x);
pFlag->m_Y = round_to_int(m_Pos.y);
pFlag->m_Team = m_Team;
}
else
{
CNetObj_Flag *pFlag = Server()->SnapNewItem<CNetObj_Flag>(m_Team);
if(!pFlag)
return;
pFlag->m_X = (int)m_Pos.x;
pFlag->m_Y = (int)m_Pos.y;
pFlag->m_X = round_to_int(m_Pos.x);
pFlag->m_Y = round_to_int(m_Pos.y);
pFlag->m_Team = m_Team;
}
}

0 comments on commit ba4c074

Please sign in to comment.