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

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   gameObjectsList.h
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements the global game objects lists.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #ifndef _GAME_OBJECTS_LIST_H
  21. #define _GAME_OBJECTS_LIST_H
  22. #include <afxmt.h>
  23. #include <ObjectsArray.h>
  24. typedef struct { BYTE ind; ARR_POS pos; }     LIST_POS;
  25. class CGameObjectsList
  26. {
  27. public:
  28.     CGameObjectsList ();
  29.     virtual ~CGameObjectsList ();
  30.     void KillList ();
  31.     void AddObject (CGameObject *);
  32.     void RemoveObject (CGameObject *);
  33.     CReaction GetGameReaction (CGameObject *);
  34.     int GetObjectsCount () const;
  35.     LIST_POS GetHeadPosition ();
  36.     CGameObject *GetNext (LIST_POS&);
  37.     BOOL IsObjectValid (CGameObject *);     // Checks the pointer points to a living object
  38.     
  39.     void Freeze();                          // Freeze the list from being changed (add || remove)
  40.     void Thaw();                            // Undo freeze
  41. private:
  42.     CObjectsArray m_aArrays[4];             // One array for each z-depth level
  43.     CCriticalSection m_CS;                  // Sync mechanism
  44. };
  45. // Inline sections:
  46. #include <GameObjectsList.inl>
  47. #endif