Shell.h
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:3k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   Shell.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements the shell game object.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #ifndef _SHELL_H
  21. #define _SHELL_H
  22. #include <GameObject.h>
  23. #include <GameManager.h>
  24. #include <Tanks.h>
  25. #include <GameBoard.h>
  26. // The following pragma is here to tell the compiler we're using virtual inheritance to solve the
  27. // classic diamond problem.
  28. #pragma pointers_to_members(full_generality, virtual_inheritance)
  29. // The following pragma is here to tell the compiler not to display the following warning message:
  30. // warning C4250: 'CShell' : inherits 'CExplodingGameObject::GetImage' via dominance.
  31. //
  32. // We get this warning because GetImage is defined as a pure virtual function in the abstract
  33. // class CGameObject. CMovingGameObject inherits it but doesn't change it (keeps it pure virtual)
  34. // and CExplodingGameObject inherits it and gives it a concrete implementation.
  35. // Since CShell inherits from CExplodingGameObject and CMovingGameObject (class diamond)
  36. // the compiler tells us it chose to use the concrete implementation found in 
  37. // CExplodingGameObject.
  38. #pragma warning( disable : 4250 )
  39. class CShell: public CMovingGameObject, CExplodingGameObject
  40. {
  41. public:
  42.     CShell (UINT uXPos, UINT uYPos, UINT uDirectionIndex, UINT uParentTankID);
  43.     virtual ~CShell () {}
  44.     StateType           CalcState (DWORD dwCurTime);
  45.     ObjectHeightType    GetHeight();                
  46.     CReaction           React(CGameObject *pTo);    
  47.     GameObjectType      GetType();                  
  48.     CRect &             GetUpdateRectangle();       
  49. private:
  50.     HIMAGE              m_himgShell;
  51.     UINT                m_uParentTankID;    // ID of shooting tank
  52. }; 
  53. #include <Shell.inl>
  54. #pragma
  55. #endif