summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-02-06 01:45:17 -0700
committerMike Buland <eichlan@xagasoft.com>2012-02-06 01:45:17 -0700
commitb93bfc4380264322680a0a79f7b05e3db05257b6 (patch)
treea661d9074ee7208f83121aeecf65fe7038559968 /src
parent19e2b8cae9c66a6c971fa088642bec739067c7ad (diff)
downloadstage-b93bfc4380264322680a0a79f7b05e3db05257b6.tar.gz
stage-b93bfc4380264322680a0a79f7b05e3db05257b6.tar.bz2
stage-b93bfc4380264322680a0a79f7b05e3db05257b6.tar.xz
stage-b93bfc4380264322680a0a79f7b05e3db05257b6.zip
Correct errors for improper input.0.03
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