- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Documents and Settings/jegan/Desktop/projectX/ActivateEnemyCommand.cpp

Go to the documentation of this file.

    00001 #include "Command.h"
    00002 #include "Control.h"
    00003 #include "List.h"
    00004 #include "Level.h"
    00005 #include "Object.h"
    00006 #include "Enemy.h"
    00007
    00008 using namespace std;
    00009
    00010 const std::string ActivateEnemyCommand::_id = "activateEnemy";
    00011
    00012 ActivateEnemyCommand::ActivateEnemyCommand(Enemy *enemy)
    00013 :_enemy(enemy->id())
    00014 {
    00015
    00016 }
    00017
    00018 ActivateEnemyCommand::ActivateEnemyCommand(List *command)
    00019 {
    00020         command = command->rest();
    00021         _enemy = command->firstString();
    00022 }
    00023
    00024 void ActivateEnemyCommand::execute()
    00025 {
    00026         ((Enemy *)Level::instance()->getObject(_enemy))->activate();
    00027 }
    00028
    00029 std::string ActivateEnemyCommand::getString()
    00030 {
    00031         List *command = new List();
    00032         command->snoc(new Atom(_id));
    00033         command->snoc(new Atom(_enemy));
    00034         string commandString = command->getString();
    00035         delete command;
    00036
    00037         return commandString;
    00038 }