00001 #include "Command.h" 00002 #include "Person.h" 00003 #include "List.h" 00004 #include "Level.h" 00005 #include "Player.h" 00006 00007 #include <iostream> 00008 00009 using namespace std; 00010 00011 const std::string SecondaryShootCommand::_id = "secondaryShoot"; 00012 00013 SecondaryShootCommand::SecondaryShootCommand(Player *player) 00014 :_player(player) 00015 { 00016 } 00017 00018 SecondaryShootCommand::SecondaryShootCommand(List *command) 00019 { 00020 command = command->rest(); 00021 _player = (Player *)Level::instance()->getObject(command->firstString()); 00022 } 00023 00024 void SecondaryShootCommand::execute() 00025 { 00026 _player->shootSecondary(); 00027 } 00028 00029 std::string SecondaryShootCommand::getString() 00030 { 00031 List *command = new List(); 00032 command->snoc(new Atom(_id)); 00033 command->snoc(new Atom(_player->id())); 00034 00035 string commandString = command->getString(); 00036 delete command; 00037 00038 return commandString; 00039 }
1.4.6-NO