diff options
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 | |||