diff --git a/Core/CLI/src/cli_svs.cpp b/Core/CLI/src/cli_svs.cpp index 7275b377ba..d7411d0779 100644 --- a/Core/CLI/src/cli_svs.cpp +++ b/Core/CLI/src/cli_svs.cpp @@ -47,6 +47,10 @@ bool CommandLineInterface::DoSVS(const std::vector& args) } else { + if (thisAgent->svs->is_in_substate()) { + m_Result << "Cannot disable Spatial Visual System while in a substate."; + return false; + } thisAgent->svs->set_enabled(false); m_Result << "Spatial Visual System disabled."; } @@ -72,6 +76,10 @@ bool CommandLineInterface::DoSVS(const std::vector& args) } else { + if (thisAgent->svs->is_in_substate()) { + m_Result << "Cannot disable Spatial Visual System in substates while in a substate."; + return false; + } thisAgent->svs->set_enabled_in_substates(false); m_Result << "Spatial Visual System disabled in substates."; } diff --git a/Core/SVS/src/svs.h b/Core/SVS/src/svs.h index a25bec6cb4..677c920244 100644 --- a/Core/SVS/src/svs.h +++ b/Core/SVS/src/svs.h @@ -191,6 +191,11 @@ class svs : public svs_interface, public cliproxy return ""; } + bool is_in_substate() + { + return state_stack.size() > 1; + } + // dirty bit is true only if there has been a new command // from soar or from SendSVSInput // (no need to recheck filters) diff --git a/Core/SVS/src/svs_interface.h b/Core/SVS/src/svs_interface.h index 1d5217ae9a..551fb1a65d 100644 --- a/Core/SVS/src/svs_interface.h +++ b/Core/SVS/src/svs_interface.h @@ -19,6 +19,10 @@ class svs_interface virtual void set_enabled(bool newSetting) = 0; virtual bool is_enabled_in_substates() = 0; virtual void set_enabled_in_substates(bool newSetting) = 0; + /** + * Indicates that the current top of the state stack is for a subgoal/substate + */ + virtual bool is_in_substate() = 0; }; svs_interface* make_svs(agent* a);