Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1.  
  2. #ifndef __MoveCommand_h__
  3. #define __MoveCommand_h__
  4. #include "GameCommand.h"
  5. #include "game.h"
  6. //#include "Item.h"
  7. #include "Room.h"
  8. #include <iostream>
  9. #include <cassert>
  10. ////////////////////////////////////////////////////////////////////////////////
  11. class MoveCommand : public GameCommand
  12. {
  13.     // direction
  14.     int dir;
  15.    
  16. public:
  17.    
  18.     MoveCommand(int _dir)
  19.     {
  20.         dir = _dir;
  21.     }
  22.    
  23.     virtual ~MoveCommand() {}
  24.  
  25.     void Execute()  // implementation for pure virtual function in ICommand.
  26.     {
  27.         Room *room;
  28.        
  29.         room = GetGame()->GetCurrentRoom()->GetNextRoom(dir);
  30.        
  31.         if (room != NULL) {
  32.             //cout << "You found " + item->GetName() + ".\n";
  33.             cout << "You move to the next room";
  34.         }
  35.         else {
  36.             cout << "You found nothing.\n";
  37.         }
  38.     }
  39. };
  40. ////////////////////////////////////////////////////////////////////////////////
  41. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement