fixed editor zooming if gui is not active
[twcon.git] / src / game / server / entities / flag.cpp
blobd279e4dfe346cd8dd921692b39971069bbc5bc9e
1 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2 /* If you are missing that file, acquire a complete release at teeworlds.com. */
3 #include <game/server/gamecontext.h>
4 #include "flag.h"
6 CFlag::CFlag(CGameWorld *pGameWorld, int Team)
7 : CEntity(pGameWorld, CGameWorld::ENTTYPE_FLAG)
9 m_Team = Team;
10 m_ProximityRadius = ms_PhysSize;
11 m_pCarryingCharacter = NULL;
12 m_GrabTick = 0;
14 Reset();
17 void CFlag::Reset()
19 m_pCarryingCharacter = NULL;
20 m_AtStand = 1;
21 m_Pos = m_StandPos;
22 m_Vel = vec2(0,0);
23 m_GrabTick = 0;
26 void CFlag::Snap(int SnappingClient)
28 if(NetworkClipped(SnappingClient))
29 return;
31 CNetObj_Flag *pFlag = (CNetObj_Flag *)Server()->SnapNewItem(NETOBJTYPE_FLAG, m_Team, sizeof(CNetObj_Flag));
32 if(!pFlag)
33 return;
35 pFlag->m_X = (int)m_Pos.x;
36 pFlag->m_Y = (int)m_Pos.y;
37 pFlag->m_Team = m_Team;