Rename Read() function to avoid equal naming

This commit is contained in:
c0d3d3v 2022-03-23 18:19:23 +01:00
parent 5ac46f9bd5
commit 320e9e030f
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
4 changed files with 14 additions and 17 deletions

View file

@ -1098,8 +1098,7 @@ void CGameClient::OnNewSnapshot()
mem_zero(&TempCore, sizeof(TempCore)); mem_zero(&TempCore, sizeof(TempCore));
mem_zero(&TempTeams, sizeof(TempTeams)); mem_zero(&TempTeams, sizeof(TempTeams));
TempCore.Init(&TempWorld, Collision(), &TempTeams); TempCore.Init(&TempWorld, Collision(), &TempTeams);
TempCore.Read(pCharacter); TempCore.ReadCharacter(pCharacter);
TempCore.m_ActiveWeapon = pCharacter->m_Weapon;
while(pCharacter->m_Tick < Tick) while(pCharacter->m_Tick < Tick)
{ {
@ -1274,7 +1273,7 @@ void CGameClient::OnNewSnapshot()
{ {
const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_ID); const void *pOld = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_CHARACTER, Item.m_ID);
m_Snap.m_aCharacters[Item.m_ID].m_Cur = *((const CNetObj_Character *)pData); m_Snap.m_aCharacters[Item.m_ID].m_Cur = *((const CNetObj_Character *)pData);
m_aClients[Item.m_ID].m_Predicted.Read((const CNetObj_Character *)pData); m_aClients[Item.m_ID].m_Predicted.ReadCharacter((const CNetObj_Character *)pData);
if(pOld) if(pOld)
{ {
m_Snap.m_aCharacters[Item.m_ID].m_Active = true; m_Snap.m_aCharacters[Item.m_ID].m_Active = true;
@ -1709,13 +1708,11 @@ void CGameClient::OnPredict()
{ {
if(m_Snap.m_pLocalCharacter) if(m_Snap.m_pLocalCharacter)
{ {
m_PredictedChar.Read(m_Snap.m_pLocalCharacter); m_PredictedChar.ReadCharacter(m_Snap.m_pLocalCharacter);
m_PredictedChar.m_ActiveWeapon = m_Snap.m_pLocalCharacter->m_Weapon;
} }
if(m_Snap.m_pLocalPrevCharacter) if(m_Snap.m_pLocalPrevCharacter)
{ {
m_PredictedPrevChar.Read(m_Snap.m_pLocalPrevCharacter); m_PredictedPrevChar.ReadCharacter(m_Snap.m_pLocalPrevCharacter);
m_PredictedPrevChar.m_ActiveWeapon = m_Snap.m_pLocalPrevCharacter->m_Weapon;
} }
return; return;
} }
@ -2520,7 +2517,7 @@ void CGameClient::DetectStrongHook()
float PredictErr[2]; float PredictErr[2];
CCharacterCore ToCharCur; CCharacterCore ToCharCur;
ToCharCur.Read(&m_Snap.m_aCharacters[ToPlayer].m_Cur); ToCharCur.ReadCharacterCore(&m_Snap.m_aCharacters[ToPlayer].m_Cur);
CWorldCore World; CWorldCore World;
World.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy]; World.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
@ -2530,12 +2527,12 @@ void CGameClient::DetectStrongHook()
CCharacterCore ToChar = pFromCharWorld->GetCore(); CCharacterCore ToChar = pFromCharWorld->GetCore();
ToChar.Init(&World, Collision(), &m_Teams); ToChar.Init(&World, Collision(), &m_Teams);
World.m_apCharacters[ToPlayer] = &ToChar; World.m_apCharacters[ToPlayer] = &ToChar;
ToChar.Read(&m_Snap.m_aCharacters[ToPlayer].m_Prev); ToChar.ReadCharacterCore(&m_Snap.m_aCharacters[ToPlayer].m_Prev);
CCharacterCore FromChar = pFromCharWorld->GetCore(); CCharacterCore FromChar = pFromCharWorld->GetCore();
FromChar.Init(&World, Collision(), &m_Teams); FromChar.Init(&World, Collision(), &m_Teams);
World.m_apCharacters[FromPlayer] = &FromChar; World.m_apCharacters[FromPlayer] = &FromChar;
FromChar.Read(&m_Snap.m_aCharacters[FromPlayer].m_Prev); FromChar.ReadCharacterCore(&m_Snap.m_aCharacters[FromPlayer].m_Prev);
for(int Tick = Client()->PrevGameTick(g_Config.m_ClDummy); Tick < Client()->GameTick(g_Config.m_ClDummy); Tick++) for(int Tick = Client()->PrevGameTick(g_Config.m_ClDummy); Tick < Client()->GameTick(g_Config.m_ClDummy); Tick++)
{ {

View file

@ -1121,7 +1121,7 @@ void CCharacter::ResetPrediction()
void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtended, bool IsLocal) void CCharacter::Read(CNetObj_Character *pChar, CNetObj_DDNetCharacter *pExtended, bool IsLocal)
{ {
m_Core.Read((CNetObj_CharacterCore *)pChar); m_Core.ReadCharacterCore((const CNetObj_CharacterCore *)pChar);
m_IsLocal = IsLocal; m_IsLocal = IsLocal;
if(pExtended) if(pExtended)

View file

@ -521,7 +521,7 @@ void CCharacterCore::Write(CNetObj_CharacterCore *pObjCore)
pObjCore->m_Angle = m_Angle; pObjCore->m_Angle = m_Angle;
} }
void CCharacterCore::Read(const CNetObj_CharacterCore *pObjCore) void CCharacterCore::ReadCharacterCore(const CNetObj_CharacterCore *pObjCore)
{ {
m_Pos.x = pObjCore->m_X; m_Pos.x = pObjCore->m_X;
m_Pos.y = pObjCore->m_Y; m_Pos.y = pObjCore->m_Y;
@ -539,10 +539,10 @@ void CCharacterCore::Read(const CNetObj_CharacterCore *pObjCore)
m_Angle = pObjCore->m_Angle; m_Angle = pObjCore->m_Angle;
} }
void CCharacterCore::Read(const CNetObj_Character *pObjChar) void CCharacterCore::ReadCharacter(const CNetObj_Character *pObjChar)
{ {
m_ActiveWeapon = pObjChar->m_Weapon; m_ActiveWeapon = pObjChar->m_Weapon;
Read((const CNetObj_CharacterCore *)pObjChar); ReadCharacterCore((const CNetObj_CharacterCore *)pObjChar);
} }
void CCharacterCore::ReadDDNet(const CNetObj_DDNetCharacter *pObjDDNet) void CCharacterCore::ReadDDNet(const CNetObj_DDNetCharacter *pObjDDNet)
{ {
@ -589,7 +589,7 @@ void CCharacterCore::Quantize()
{ {
CNetObj_CharacterCore Core; CNetObj_CharacterCore Core;
Write(&Core); Write(&Core);
Read(&Core); ReadCharacterCore(&Core);
} }
// DDRace // DDRace

View file

@ -248,8 +248,8 @@ public:
void Tick(bool UseInput); void Tick(bool UseInput);
void Move(); void Move();
void Read(const CNetObj_CharacterCore *pObjCore); void ReadCharacterCore(const CNetObj_CharacterCore *pObjCore);
void Read(const CNetObj_Character *pObjCore); void ReadCharacter(const CNetObj_Character *pObjCore);
void Write(CNetObj_CharacterCore *pObjCore); void Write(CNetObj_CharacterCore *pObjCore);
void Quantize(); void Quantize();