diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/client/client.cpp | 11 | ||||
| -rw-r--r-- | src/engine/server/server.cpp | 11 | ||||
| -rw-r--r-- | src/engine/shared/demorec.cpp | 2 | ||||
| -rw-r--r-- | src/engine/shared/ringbuffer.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/maplayers.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/menus_demo.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/entities/character.cpp | 16 |
7 files changed, 30 insertions, 16 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 613a8137..881f06d8 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1123,6 +1123,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket) int DeltaSize; unsigned char aTmpBuffer2[CSnapshot::MAX_SIZE]; unsigned char aTmpBuffer3[CSnapshot::MAX_SIZE]; + CSnapshot *pTmpBuffer3 = (CSnapshot*)aTmpBuffer3; // Fix compiler warning for strict-aliasing int SnapSize; CompleteSize = (NumParts-1) * MAX_SNAPSHOT_PACKSIZE + PartSize; @@ -1169,19 +1170,19 @@ void CClient::ProcessPacket(CNetChunk *pPacket) // unpack delta PurgeTick = DeltaTick; - SnapSize = m_SnapshotDelta.UnpackDelta(pDeltaShot, (CSnapshot*)aTmpBuffer3, pDeltaData, DeltaSize); + SnapSize = m_SnapshotDelta.UnpackDelta(pDeltaShot, pTmpBuffer3, pDeltaData, DeltaSize); if(SnapSize < 0) { dbg_msg("client", "delta unpack failed!"); return; } - if(Msg != NETMSG_SNAPEMPTY && ((CSnapshot*)aTmpBuffer3)->Crc() != Crc) + if(Msg != NETMSG_SNAPEMPTY && pTmpBuffer3->Crc() != Crc) { if(g_Config.m_Debug) { dbg_msg("client", "snapshot crc error #%d - tick=%d wantedcrc=%d gotcrc=%d compressed_size=%d delta_tick=%d", - m_SnapCrcErrors, GameTick, Crc, ((CSnapshot*)aTmpBuffer3)->Crc(), CompleteSize, DeltaTick); + m_SnapCrcErrors, GameTick, Crc, pTmpBuffer3->Crc(), CompleteSize, DeltaTick); } m_SnapCrcErrors++; @@ -1209,13 +1210,13 @@ void CClient::ProcessPacket(CNetChunk *pPacket) m_SnapshotStorage.PurgeUntil(PurgeTick); // add new - m_SnapshotStorage.Add(GameTick, time_get(), SnapSize, (CSnapshot*)aTmpBuffer3, 1); + m_SnapshotStorage.Add(GameTick, time_get(), SnapSize, pTmpBuffer3, 1); // add snapshot to demo if(m_DemoRecorder.IsRecording()) { // write snapshot - m_DemoRecorder.RecordSnapshot(GameTick, aTmpBuffer3, SnapSize); + m_DemoRecorder.RecordSnapshot(GameTick, pTmpBuffer3, SnapSize); } // apply snapshot, cycle pointers diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index bd5bebe1..7a26704c 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -427,6 +427,7 @@ void CServer::DoSnapshot() { char aData[CSnapshot::MAX_SIZE]; + CSnapshot *pData = (CSnapshot*)aData; // Fix compiler warning for strict-aliasing char aDeltaData[CSnapshot::MAX_SIZE]; char aCompData[CSnapshot::MAX_SIZE]; int SnapshotSize; @@ -442,15 +443,15 @@ void CServer::DoSnapshot() GameServer()->OnSnap(i); // finish snapshot - SnapshotSize = m_SnapshotBuilder.Finish(aData); - Crc = ((CSnapshot*)aData)->Crc(); + SnapshotSize = m_SnapshotBuilder.Finish(pData); + Crc = pData->Crc(); // remove old snapshos // keep 3 seconds worth of snapshots m_aClients[i].m_Snapshots.PurgeUntil(m_CurrentGameTick-SERVER_TICK_SPEED*3); // save it the snapshot - m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, aData, 0); + m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, pData, 0); // find snapshot that we can preform delta against EmptySnap.Clear(); @@ -468,7 +469,7 @@ void CServer::DoSnapshot() } // create delta - DeltaSize = m_SnapshotDelta.CreateDelta(pDeltashot, (CSnapshot*)aData, aDeltaData); + DeltaSize = m_SnapshotDelta.CreateDelta(pDeltashot, pData, aDeltaData); if(DeltaSize) { @@ -554,7 +555,7 @@ void CServer::SendMap(int ClientId) { //get the name of the map without his path char * pMapShortName = &g_Config.m_SvMap[0]; - for(int i = 0; i < 127; i++) + for(int i = 0; i < str_length(g_Config.m_SvMap)-1; i++) { if(g_Config.m_SvMap[i] == '/' || g_Config.m_SvMap[i] == '\\') pMapShortName = &g_Config.m_SvMap[i+1]; diff --git a/src/engine/shared/demorec.cpp b/src/engine/shared/demorec.cpp index 48b06e9a..6c2ba07d 100644 --- a/src/engine/shared/demorec.cpp +++ b/src/engine/shared/demorec.cpp @@ -335,7 +335,7 @@ void CDemoPlayer::DoTick() static char aDecompressed[CSnapshot::MAX_SIZE]; static char aData[CSnapshot::MAX_SIZE]; int ChunkType, ChunkTick, ChunkSize; - int DataSize; + int DataSize = 0; int GotSnapshot = 0; // update ticks diff --git a/src/engine/shared/ringbuffer.cpp b/src/engine/shared/ringbuffer.cpp index 45a845ee..b84db5a3 100644 --- a/src/engine/shared/ringbuffer.cpp +++ b/src/engine/shared/ringbuffer.cpp @@ -98,7 +98,7 @@ void *CRingBufferBase::Allocate(int Size) // okey, we have our block // split the block if needed - if(pBlock->m_Size > WantedSize+sizeof(CItem)) + if(pBlock->m_Size > WantedSize+(int)sizeof(CItem)) { CItem *pNewItem = (CItem *)((char *)pBlock + WantedSize); pNewItem->m_pPrev = pBlock; diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 202ea2da..62b32a1f 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -42,7 +42,7 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void pChannels[2] = 0; pChannels[3] = 0; - CEnvPoint *pPoints; + CEnvPoint *pPoints = 0; { int Start, Num; diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index fd0caf62..784212ca 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -475,7 +475,7 @@ void CMenus::RenderDemoList(CUIRect MainView) str_copy(aTitleButton, "Open", sizeof(aTitleButton)); else str_copy(aTitleButton, "Play", sizeof(aTitleButton)); - // /!\ TODO: Add "Open" in Localization /!\ + //TODO: Add "Open" in Localization if(DoButton_Menu(&s_PlayButton, Localize(aTitleButton), 0, &PlayRect) || Activated) { if(s_SelectedItem >= 0 && s_SelectedItem < m_lDemos.size()) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 77d8f462..81d1f85b 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -585,14 +585,26 @@ void CCharacter::TickDefered() if(!StuckBefore && (StuckAfterMove || StuckAfterQuant)) { + // Hackish solution to get rid of strict-aliasing warning + union + { + float f; + unsigned u; + }StartPosX, StartPosY, StartVelX, StartVelY; + + StartPosX.f = StartPos.x; + StartPosY.f = StartPos.y; + StartVelX.f = StartVel.x; + StartVelY.f = StartVel.y; + dbg_msg("char_core", "STUCK!!! %d %d %d %f %f %f %f %x %x %x %x", StuckBefore, StuckAfterMove, StuckAfterQuant, StartPos.x, StartPos.y, StartVel.x, StartVel.y, - *((unsigned *)&StartPos.x), *((unsigned *)&StartPos.y), - *((unsigned *)&StartVel.x), *((unsigned *)&StartVel.y)); + StartPosX.u, StartPosY.u, + StartVelX.u, StartVelY.u); } int Events = m_Core.m_TriggeredEvents; |