packigc.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: packIGC.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Header for the CpackIGC class. This file was initially created by
  10. ** the ATL wizard.
  11. **
  12. ** History:
  13. */
  14. // packIGC.h : Declaration of the CpackIGC
  15. #ifndef __PACKIGC_H_
  16. #define __PACKIGC_H_
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CpackIGC
  19. class CpackIGC : public IpackIGC
  20. {
  21. public:
  22. CpackIGC(void);
  23. ~CpackIGC(void);
  24. // IbaseIGC
  25. virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize);
  26. virtual void Terminate(void);
  27. virtual ObjectType GetObjectType(void) const
  28. {
  29. return OT_pack;
  30. }
  31. virtual ImissionIGC* GetMission(void) const
  32. {
  33. return m_pMission;
  34. }
  35. // IpartIGC
  36. virtual EquipmentType GetEquipmentType(void) const
  37. {
  38. return ET_Pack;
  39. }
  40. virtual IpartTypeIGC* GetPartType(void) const
  41. {
  42. return m_partType;
  43. }
  44. virtual IshipIGC* GetShip(void) const
  45. {
  46. return m_pship;
  47. }
  48. virtual void SetShip(IshipIGC* newVal, Mount mount);
  49. virtual Mount GetMountID(void) const
  50. {
  51. return m_mountID;
  52. }
  53. virtual void SetMountID(Mount newVal);
  54. virtual bool fActive(void) const
  55. {
  56. return false;
  57. }
  58. virtual void Activate(void)
  59. {
  60. }
  61. virtual void Deactivate(void)
  62. {
  63. }
  64. virtual float GetMass(void) const
  65. {
  66. return 0.0f;
  67. }
  68. virtual Money GetPrice(void) const
  69. {
  70. return 0;
  71. }
  72. virtual float GetMountedFraction(void) const
  73. {
  74. return 1.0f;
  75. }
  76. virtual void SetMountedFraction(float f)
  77. {
  78. }
  79. virtual void Arm(void)
  80. {
  81. }
  82. // IpackIGC
  83. virtual PackType GetPackType(void) const
  84. {
  85. return m_typeData->packType;
  86. }
  87. virtual void SetAmount(short a)
  88. {
  89. if (m_pship)
  90. {
  91. const IhullTypeIGC* pht = m_pship->GetHullType();
  92. short maxAmount;
  93. if (m_typeData->packType == c_packAmmo)
  94. {
  95. maxAmount = pht->GetMaxAmmo();
  96. }
  97. else
  98. {
  99. assert (m_typeData->packType == c_packFuel);
  100. maxAmount = short(pht->GetMaxFuel());
  101. }
  102. if (a > maxAmount)
  103. a = maxAmount;
  104. }
  105. m_amount = a;
  106. }
  107. virtual short GetAmount(void) const
  108. {
  109. return m_amount;
  110. }
  111. private:
  112. ImissionIGC* m_pMission;
  113. const DataPackTypeIGC* m_typeData;
  114. IpartTypeIGC* m_partType;
  115. IshipIGC* m_pship;
  116. short m_amount;
  117. Mount m_mountID;
  118. };
  119. #endif //__PACKIGC_H_