Change return type of CNetBase::IsSeqInBackroom from int to bool

This commit is contained in:
Robert Müller 2022-07-17 20:51:48 +02:00
parent 5f7d19d2e0
commit b594a323a6
2 changed files with 6 additions and 6 deletions

View file

@ -339,23 +339,23 @@ unsigned char *CNetChunkHeader::Unpack(unsigned char *pData, int Split)
return pData + 2; return pData + 2;
} }
int CNetBase::IsSeqInBackroom(int Seq, int Ack) bool CNetBase::IsSeqInBackroom(int Seq, int Ack)
{ {
int Bottom = (Ack - NET_MAX_SEQUENCE / 2); int Bottom = (Ack - NET_MAX_SEQUENCE / 2);
if(Bottom < 0) if(Bottom < 0)
{ {
if(Seq <= Ack) if(Seq <= Ack)
return 1; return true;
if(Seq >= (Bottom + NET_MAX_SEQUENCE)) if(Seq >= (Bottom + NET_MAX_SEQUENCE))
return 1; return true;
} }
else else
{ {
if(Seq <= Ack && Seq >= Bottom) if(Seq <= Ack && Seq >= Bottom)
return 1; return true;
} }
return 0; return false;
} }
IOHANDLE CNetBase::ms_DataLogSent = 0; IOHANDLE CNetBase::ms_DataLogSent = 0;

View file

@ -544,7 +544,7 @@ public:
static int UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct *pPacket, bool &Sixup, SECURITY_TOKEN *pSecurityToken = nullptr, SECURITY_TOKEN *pResponseToken = nullptr); static int UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct *pPacket, bool &Sixup, SECURITY_TOKEN *pSecurityToken = nullptr, SECURITY_TOKEN *pResponseToken = nullptr);
// The backroom is ack-NET_MAX_SEQUENCE/2. Used for knowing if we acked a packet or not // The backroom is ack-NET_MAX_SEQUENCE/2. Used for knowing if we acked a packet or not
static int IsSeqInBackroom(int Seq, int Ack); static bool IsSeqInBackroom(int Seq, int Ack);
}; };
#endif #endif