#include "commandset.h" #include "command.h" #include using namespace Bu; CommandSet::CommandSet() { } CommandSet::~CommandSet() { for( CommandList::iterator i = lCommand.begin(); i; i++ ) { delete (*i); } } void CommandSet::addCommand( class Command *pCmd ) { lCommand.append( pCmd ); } bool CommandSet::dispatch( class GameState &gState, const Bu::StringList &lCmd ) { for( CommandList::iterator i = lCommand.begin(); i; i++ ) { if( (*i)->matches( lCmd ) ) { (*i)->exec( gState, lCmd ); return true; } } return false; }