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

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   Bonus.inl
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Contents: Inline functions implementations.
  11. *                                                                             
  12. *   Authors: Eran Yariv - 28484475                                           
  13. *            Moshe Zur  - 24070856                                           
  14. *                                                                            
  15. *                                                                            
  16. *   Date: 23/09/98                                                           
  17. *                                                                            
  18. ******************************************************************************/
  19. inline 
  20. CBonus::~CBonus()
  21. {}
  22. inline StateType           
  23. CBonus::CalcState (DWORD dwCurTime)
  24. {
  25.     if ((BONUS_NONE == m_Type) ||               // Either the bonus is taken already or,
  26.         (m_uLifeSpan < dwCurTime - m_uStartTime))   // it's life span is exhausted
  27.         return STATE_DEAD;
  28.     return STATE_ALIVE;
  29. }
  30. inline ObjectHeightType    
  31. CBonus::GetHeight()
  32. {
  33.     return LOWER_LEVEL;
  34. }
  35. inline HIMAGE
  36. CBonus::GetImage()
  37. {
  38.     m_GlobalImageManager.UpdateImage (m_hImage, m_bImageChanged);
  39.     return m_hImage;
  40. }
  41. inline CReaction           
  42. CBonus::React(CGameObject *pTo)
  43. {
  44.     if (TANK == pTo->GetType() && CollidesWith(pTo)) { // The first tank gets it all:
  45.         BonusType OldType = m_Type;
  46.         m_Type = BONUS_NONE;
  47.         return CReaction(0, TERR_EMPTY, OldType);
  48.     }
  49.     return CReaction(); // By default bonus type is BONUS_NONE
  50. }
  51. inline GameObjectType      
  52. CBonus::GetType()
  53. {
  54.     return BONUS;
  55. }
  56. inline BonusType           
  57. CBonus::GetBonusType ()
  58. {
  59.     return m_Type;
  60. }
  61. inline void
  62. CBonus::Kill ()
  63. {
  64.     m_Type = BONUS_NONE;    // Notify dead state
  65. }