X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fui.cpp;fp=src%2Fui%2Fui.cpp;h=6a2e2ee167042720101bab5f7d1062d3c2cc610f;hb=916cba3b7b9dea6459febb90d24565cf4c0a8b2a;hp=dd113ca2b620d8fd763934459e9e4b1f088c15ce;hpb=ad9838311295e5104202fe83828b484745f86e92;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index dd113ca..6a2e2ee 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -43,6 +43,12 @@ PlayerController::PlayerController(World &world, Player &player) player.GetEntity().SetController(*this); } +PlayerController::~PlayerController() { + if (&player.GetEntity().GetController() == this) { + player.GetEntity().UnsetController(); + } +} + void PlayerController::SetMovement(const glm::vec3 &m) noexcept { if (dot(m, m) > 1.0f) { move_dir = normalize(m);