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

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   ObjectsArray.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements an array of game objects sharing the same
  11. *                       z-order. Used by the GameObjectsList class.
  12. *                       
  13. *                                                                             
  14. *   Authors: Eran Yariv - 28484475                                           
  15. *            Moshe Zur  - 24070856                                           
  16. *                                                                            
  17. *                                                                            
  18. *   Date: 23/09/98                                                           
  19. *                                                                            
  20. ******************************************************************************/
  21. #ifndef _OBJECTS_ARRAY_H_
  22. #define _OBJECTS_ARRAY_H_
  23. #include "GameObject.h"
  24. typedef CGameObject**     ARR_POS;
  25. class CObjectsArray
  26. {
  27. public:
  28.     CObjectsArray ();
  29.     virtual ~CObjectsArray();
  30.     void Init (UINT uSize);
  31.     BOOL Add(CGameObject *);
  32.     BOOL Remove(CGameObject *);
  33.     ARR_POS GetHeadPosition();
  34.     CGameObject* GetNext(ARR_POS&);
  35.     BOOL IsEmpty();
  36.     int GetObjectsCount() const;
  37.     void Empty();                   // Deletes all pointer in array
  38. private:
  39.     UINT m_uSize;                   // Total number of entries
  40.     CGameObject** m_Array;          // Allocated array
  41.                                     
  42.     ARR_POS m_lplpTop;              // Pointer to next empty entry
  43.     ARR_POS m_lplpLast;             // Pointer to last available entry (&m_Array[m_uSize-1])
  44. };
  45. #include "ObjectsArray.inl"
  46. #endif