summaryrefslogtreecommitdiffhomepage
path: root/editor/update.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-18 16:44:39 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-18 16:44:39 +0100
commit27dd8b268fbe37fa6eed0c0fc0f013134e5e2dc9 (patch)
tree7f04c83b09aa1d0706e832d16fa19ee31cd12f31 /editor/update.cpp
parentf82e612070b3edc963e787f121a58a2821ffa2a5 (diff)
editor/app: don't duplicate characters on load
Diffstat (limited to 'editor/update.cpp')
-rw-r--r--editor/update.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/editor/update.cpp b/editor/update.cpp
index cbe08c05..7c084a85 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -198,10 +198,13 @@ void app::update_world(float dt)
void app::update_character([[maybe_unused]] float dt)
{
- auto& w = M->world();
- auto c = w.find_entity<character>(_character_id);
- if (c)
- c->set_keys(keys[key_left], keys[key_right], keys[key_up], keys[key_down]);
+ if (_character_id)
+ {
+ auto& w = M->world();
+ auto c = w.find_entity<character>(_character_id);
+ if (c)
+ c->set_keys(keys[key_left], keys[key_right], keys[key_up], keys[key_down]);
+ }
}
void app::set_cursor()