ddnet/src/game/server/entities/flag.cpp

48 lines
969 B
C++
Raw Normal View History

2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
/*
2010-09-06 10:29:28 +00:00
#include <game/server/gamecontext.h>
#include "flag.h"
2010-09-06 10:29:28 +00:00
CFlag::CFlag(CGameWorld *pGameWorld, int Team)
: CEntity(pGameWorld, CGameWorld::ENTTYPE_FLAG)
{
2011-01-06 03:46:10 +00:00
m_Team = Team;
2010-09-06 10:29:28 +00:00
m_ProximityRadius = ms_PhysSize;
m_pCarryingCharacter = NULL;
m_GrabTick = 0;
2010-09-06 10:29:28 +00:00
Reset();
}
void CFlag::Reset()
{
2010-09-06 10:29:28 +00:00
m_pCarryingCharacter = NULL;
m_AtStand = 1;
m_Pos = m_StandPos;
m_Vel = vec2(0,0);
m_GrabTick = 0;
}
2012-01-09 23:49:31 +00:00
void CFlag::TickPaused()
{
++m_DropTick;
if(m_GrabTick)
++m_GrabTick;
}
void CFlag::Snap(int SnappingClient)
{
2011-03-04 16:08:10 +00:00
if(NetworkClipped(SnappingClient))
return;
2011-01-06 03:46:10 +00:00
CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Team, sizeof(CNetObj_Flag));
if(!pFlag)
return;
pFlag->m_X = (int)m_Pos.x;
pFlag->m_Y = (int)m_Pos.y;
2011-01-06 03:46:10 +00:00
pFlag->m_Team = m_Team;
2010-09-06 10:29:28 +00:00
}
*/