diff --git a/inc/control.h b/inc/control.h index b472903..640f727 100644 --- a/inc/control.h +++ b/inc/control.h @@ -220,6 +220,10 @@ public: } } + edict_t *getIssuer() { + return m_ent; + } + // global heloer for sending message to correct channel template void msg (const char *fmt, Args &&...args); diff --git a/src/linkage.cpp b/src/linkage.cpp index be758a0..d94d501 100644 --- a/src/linkage.cpp +++ b/src/linkage.cpp @@ -244,6 +244,11 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) { graph.setEditor (nullptr); } + // clear issuer for the menus and commands + if (ent == ctrl.getIssuer ()) { + ctrl.setIssuer (nullptr); + } + if (game.is (GameFlags::Metamod)) { RETURN_META (MRES_IGNORED); } @@ -344,6 +349,10 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) { // send message on new map util.setNeedForWelcome (false); + // clear local entity + game.setLocalEntity (nullptr); + + // reset graph state graph.reset (); // clear all the bots