diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 11:00:04 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 11:00:04 -0700 |
commit | 59f94f34ea25ce8613849bad43faf022b9ed5f5d (patch) | |
tree | 987aaeab8fbe4635018be1d2d31ea5c21e2edb69 /src/commandset.cpp | |
parent | 9e6dc529833d17374a73bae1f30c7970f936f7cc (diff) | |
download | stage-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.cpp | 17 |
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> | ||
6 | using namespace Bu; | ||
7 | |||
5 | CommandSet::CommandSet() | 8 | CommandSet::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 | ||
25 | bool 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 | |||