fix a somewhat common projectile prediction crash
This commit is contained in:
parent
12f80f20bf
commit
2c074d5598
@ -541,18 +541,21 @@ float DistanceToGround(Vector origin)
|
||||
return std::fabs(origin.z - ground_trace.endpos.z);
|
||||
}
|
||||
|
||||
static InitRoutine init([]() {
|
||||
static InitRoutine init(
|
||||
[]()
|
||||
{
|
||||
previous_positions.fill(boost::circular_buffer<Vector>(*sample_size));
|
||||
sample_size.installChangeCallback([](settings::VariableBase<int> &, int after) { previous_positions.fill(boost::circular_buffer<Vector>(after)); });
|
||||
EC::Register(
|
||||
EC::CreateMove,
|
||||
[]() {
|
||||
[]()
|
||||
{
|
||||
for (int i = 1; i < g_GlobalVars->maxClients; i++)
|
||||
{
|
||||
auto ent = ENTITY(i);
|
||||
auto &buffer = previous_positions.at(i - 1);
|
||||
|
||||
if (CE_BAD(ent) || !ent->m_bAlivePlayer())
|
||||
if (CE_BAD(LOCAL_E) || CE_BAD(ent) || !ent->m_bAlivePlayer())
|
||||
{
|
||||
buffer.clear();
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user