// reset velocity so the client doesn't predict stuff
m_Core.m_Vel = vec2(0.f, 0.f);
(edited)double
, 0.0f is of type float
CEntity *CGameWorld::FindFirst(int Type)
{
// i am checking that array exist, so it should be initialized or at least contain nullptr's
if (!m_apFirstEntityTypes)
return 0;
// segfaults here, how this is possible?
if (!m_apFirstEntityTypes[Type])
return 0;
return Type < 0 || Type >= NUM_ENTTYPES ? 0 : m_apFirstEntityTypes[Type];
}
cppc++
CEntity *CGameWorld::FindFirst(int Type)
{
if(Type < 0 || Type >= NUM_ENTTYPES)
return 0;
return m_apFirstEntityTypes[Type];
}
(edited)c++
CEntity *pEnt = GameWorld()->FindFirst(ENTTYPE_XY);
if (pEnt)
{
// do something with it here in safety
}
for (CEngineerWall* pWall = (CEngineerWall*)GameWorld()->FindFirst(CGameWorld::ENTTYPE_ENGINEER_WALL); pWall; pWall = (CEngineerWall*)pWall->TypeNext())
{
if (pWall->m_Owner != m_pPlayer->GetCID()) continue;
GameServer()->m_World.DestroyEntity(pWall);
}
this is the previous frame