MCPcopy Create free account
hub / github.com/ddnet/ddnet / OnEnterGame

Method OnEnterGame

src/engine/client/client.cpp:446–485  ·  view source on GitHub ↗

called when the map is loaded and we should init for a new round

Source from the content-addressed store, hash-verified

444
445// called when the map is loaded and we should init for a new round
446void CClient::OnEnterGame(bool Dummy)
447{
448 // reset input
449 for(int i = 0; i < 200; i++)
450 {
451 m_aInputs[Dummy][i].m_Tick = -1;
452 }
453 m_aCurrentInput[Dummy] = 0;
454
455 // reset snapshots
456 m_aapSnapshots[Dummy][SNAP_CURRENT] = nullptr;
457 m_aapSnapshots[Dummy][SNAP_PREV] = nullptr;
458 m_aSnapshotStorage[Dummy].PurgeAll();
459 m_aReceivedSnapshots[Dummy] = 0;
460 m_aSnapshotParts[Dummy] = 0;
461 m_aSnapshotIncomingDataSize[Dummy] = 0;
462 m_SnapCrcErrors = 0;
463 // Also make gameclient aware that snapshots have been purged
464 GameClient()->InvalidateSnapshot();
465
466 // reset times
467 m_aAckGameTick[Dummy] = -1;
468 m_aCurrentRecvTick[Dummy] = 0;
469 m_aPrevGameTick[Dummy] = 0;
470 m_aCurGameTick[Dummy] = 0;
471 m_aGameIntraTick[Dummy] = 0.0f;
472 m_aGameTickTime[Dummy] = 0.0f;
473 m_aGameIntraTickSincePrev[Dummy] = 0.0f;
474 m_aPredTick[Dummy] = 0;
475 m_aPredIntraTick[Dummy] = 0.0f;
476 m_aGameTime[Dummy].Init(0);
477 m_PredictedTime.Init(0);
478
479 if(!Dummy)
480 {
481 m_LastDummyConnectTime = 0.0f;
482 }
483
484 GameClient()->OnEnterGame();
485}
486
487void CClient::EnterGame(int Conn)
488{

Callers 1

DemoPlayer_PlayMethod · 0.45

Calls 3

PurgeAllMethod · 0.80
InvalidateSnapshotMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected