summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gamebuilder.cpp4
-rw-r--r--src/situation.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp
index 353e254..bfeffec 100644
--- a/src/gamebuilder.cpp
+++ b/src/gamebuilder.cpp
@@ -177,6 +177,8 @@ void GameBuilder::closeGlobal()
177 177
178void GameBuilder::beginCommand( const Bu::String &sValue ) 178void GameBuilder::beginCommand( const Bu::String &sValue )
179{ 179{
180 if( !bGlobal && pCurSit->getInputType() != Situation::inputCommand )
181 throw Bu::ExceptionBase("Command in non-command situation.");
180 pCurNode = pCurRoot = new AstBranch( AstNode::tScope ); 182 pCurNode = pCurRoot = new AstBranch( AstNode::tScope );
181 pCurCmd = new Command(); 183 pCurCmd = new Command();
182 pCurCmd->addLiteral( sValue ); 184 pCurCmd->addLiteral( sValue );
@@ -221,6 +223,8 @@ void GameBuilder::closeCommand()
221 223
222void GameBuilder::beginOption( const Bu::String &sValue ) 224void GameBuilder::beginOption( const Bu::String &sValue )
223{ 225{
226 if( pCurSit->getInputType() != Situation::inputOption )
227 throw Bu::ExceptionBase("Option in non-option situation.");
224 pCurNode = pCurRoot = new AstBranch( AstNode::tScope ); 228 pCurNode = pCurRoot = new AstBranch( AstNode::tScope );
225 pCurCmd = new Command(); 229 pCurCmd = new Command();
226 pCurCmd->addLiteral( sValue ); 230 pCurCmd->addLiteral( sValue );
diff --git a/src/situation.cpp b/src/situation.cpp
index 923eea7..1d3a853 100644
--- a/src/situation.cpp
+++ b/src/situation.cpp
@@ -75,5 +75,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, Situation::Mode m )
75 case Situation::modeEnter: 75 case Situation::modeEnter:
76 return f << "Enter"; 76 return f << "Enter";
77 } 77 }
78
79 return f << "**ERROR**";
78} 80}
79 81