diff options
author | Aki <please@ignore.pl> | 2022-12-31 18:59:56 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-31 18:59:56 +0100 |
commit | 94adce2bfbd1fd2c2351f48f8fd0b9665e742bc0 (patch) | |
tree | 6aab4d4a0971c9aa9d0f5f10e0652e801bdf4238 /sim | |
parent | 2c6e2d631760f962e58fef7048ec0c7d3ecaa387 (diff) | |
download | kurator-94adce2bfbd1fd2c2351f48f8fd0b9665e742bc0.zip kurator-94adce2bfbd1fd2c2351f48f8fd0b9665e742bc0.tar.gz kurator-94adce2bfbd1fd2c2351f48f8fd0b9665e742bc0.tar.bz2 |
Added a check for AIState and Transform of the owner
Diffstat (limited to 'sim')
-rw-r--r-- | sim/src/TurretControl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp index 19dbe21..57fae4a 100644 --- a/sim/src/TurretControl.cpp +++ b/sim/src/TurretControl.cpp @@ -26,7 +26,9 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co registry.destroy(entity); continue; } - const auto& [state, transform] = registry.get<AIState, Transform>(control.owner); // no checks + if (!registry.all_of<AIState, Transform>(control.owner)) + continue; + const auto& [state, transform] = registry.get<AIState, Transform>(control.owner); if (!registry.valid(state.target)) continue; const auto& target = registry.get<Transform>(state.target); |