summaryrefslogtreecommitdiff
path: root/src/commandset.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-30 11:00:04 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-30 11:00:04 -0700
commit59f94f34ea25ce8613849bad43faf022b9ed5f5d (patch)
tree987aaeab8fbe4635018be1d2d31ea5c21e2edb69 /src/commandset.cpp
parent9e6dc529833d17374a73bae1f30c7970f936f7cc (diff)
downloadstage-59f94f34ea25ce8613849bad43faf022b9ed5f5d.tar.gz
stage-59f94f34ea25ce8613849bad43faf022b9ed5f5d.tar.bz2
stage-59f94f34ea25ce8613849bad43faf022b9ed5f5d.tar.xz
stage-59f94f34ea25ce8613849bad43faf022b9ed5f5d.zip
Looks like commands work, mostly.
Diffstat (limited to 'src/commandset.cpp')
-rw-r--r--src/commandset.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/commandset.cpp b/src/commandset.cpp
index ffd58a5..a125541 100644
--- a/src/commandset.cpp
+++ b/src/commandset.cpp
@@ -2,6 +2,9 @@
2 2
3#include "command.h" 3#include "command.h"
4 4
5#include <bu/sio.h>
6using namespace Bu;
7
5CommandSet::CommandSet() 8CommandSet::CommandSet()
6{ 9{
7} 10}
@@ -19,3 +22,17 @@ void CommandSet::addCommand( class Command *pCmd )
19 lCommand.append( pCmd ); 22 lCommand.append( pCmd );
20} 23}
21 24
25bool CommandSet::dispatch( class GameState &gState, const Bu::StringList &lCmd )
26{
27 for( CommandList::iterator i = lCommand.begin(); i; i++ )
28 {
29 if( (*i)->matches( lCmd ) )
30 {
31 (*i)->exec( gState, lCmd );
32 return true;
33 }
34 }
35
36 return false;
37}
38