From b93bfc4380264322680a0a79f7b05e3db05257b6 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 6 Feb 2012 01:45:17 -0700 Subject: Correct errors for improper input. --- src/gamebuilder.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gamebuilder.cpp') 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() void GameBuilder::beginCommand( const Bu::String &sValue ) { + if( !bGlobal && pCurSit->getInputType() != Situation::inputCommand ) + throw Bu::ExceptionBase("Command in non-command situation."); pCurNode = pCurRoot = new AstBranch( AstNode::tScope ); pCurCmd = new Command(); pCurCmd->addLiteral( sValue ); @@ -221,6 +223,8 @@ void GameBuilder::closeCommand() void GameBuilder::beginOption( const Bu::String &sValue ) { + if( pCurSit->getInputType() != Situation::inputOption ) + throw Bu::ExceptionBase("Option in non-option situation."); pCurNode = pCurRoot = new AstBranch( AstNode::tScope ); pCurCmd = new Command(); pCurCmd->addLiteral( sValue ); -- cgit v1.2.3