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

Method SnapLaserObject

src/game/server/gamecontext.cpp:490–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490bool CGameContext::SnapLaserObject(const CSnapContext &Context, int SnapId, const vec2 &To, const vec2 &From, int StartTick, int Owner, int LaserType, int Subtype, int SwitchNumber) const
491{
492 if(Context.GetClientVersion() >= VERSION_DDNET_MULTI_LASER)
493 {
494 CNetObj_DDNetLaser *pObj = Server()->SnapNewItem<CNetObj_DDNetLaser>(SnapId);
495 if(!pObj)
496 return false;
497
498 pObj->m_ToX = (int)To.x;
499 pObj->m_ToY = (int)To.y;
500 pObj->m_FromX = (int)From.x;
501 pObj->m_FromY = (int)From.y;
502 pObj->m_StartTick = StartTick;
503 pObj->m_Owner = Owner;
504 pObj->m_Type = LaserType;
505 pObj->m_Subtype = Subtype;
506 pObj->m_SwitchNumber = SwitchNumber;
507 pObj->m_Flags = 0;
508 }
509 else
510 {
511 CNetObj_Laser *pObj = Server()->SnapNewItem<CNetObj_Laser>(SnapId);
512 if(!pObj)
513 return false;
514
515 pObj->m_X = (int)To.x;
516 pObj->m_Y = (int)To.y;
517 pObj->m_FromX = (int)From.x;
518 pObj->m_FromY = (int)From.y;
519 pObj->m_StartTick = StartTick;
520 }
521
522 return true;
523}
524
525bool CGameContext::SnapPickup(const CSnapContext &Context, int SnapId, const vec2 &Pos, int Type, int SubType, int SwitchNumber, int Flags) const
526{

Callers 7

SnapMethod · 0.80
SnapMethod · 0.80
SnapMethod · 0.80
SnapMethod · 0.80
SnapMethod · 0.80
SnapMethod · 0.80
SnapMethod · 0.80

Calls 2

ServerClass · 0.50
GetClientVersionMethod · 0.45

Tested by

no test coverage detected