BuildingLink.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef BUILDINGLINK_H
  2. #define BUILDINGLINK_H
  3. //----------------------------------------------------------------------------
  4. //
  5. // Link.h - represents a link between buildings
  6. //
  7. //---------------------------------------------------------------------------//
  8. // Copyright (C) Microsoft Corporation. All rights reserved. //
  9. //===========================================================================//
  10. #include "Elist.h"
  11. class EditorObject;
  12. class BuildingLink
  13. {
  14. public:
  15. BuildingLink( const EditorObject* pParent );
  16. BuildingLink( const BuildingLink& Link );
  17. BuildingLink& operator=( const BuildingLink& );
  18. BuildingLink( const Stuff::Vector3D& ParentPosition );
  19. bool HasChild( const EditorObject* ) const;
  20. bool HasParent( const EditorObject* ) const;
  21. int GetLinkCount() const;
  22. bool RemoveObject( const EditorObject* );
  23. const Stuff::Vector3D& GetParentPosition() const;
  24. void SetParentPosition( const Stuff::Vector3D& pos );
  25. int GetChildrenPositions( Stuff::Vector3D*, int MaxNumberOfPoints ) const;
  26. bool AddChild( const EditorObject* pObject );
  27. void SetParentAlignment( int alignment );
  28. void FixHeights();
  29. static bool TypeCanBeParent( const EditorObject* ); // type gotten from building mgr
  30. static bool CanLink( const EditorObject* pParent, const EditorObject* pChild );
  31. bool operator==( const BuildingLink& Src )const;
  32. void render();
  33. private:
  34. struct Info
  35. {
  36. long m_ID;
  37. Stuff::Vector3D pos;
  38. bool operator==( const Info& Src )const;
  39. };
  40. Info parent;
  41. EList< Info, const Info& > children;
  42. // Helper function
  43. void CopyData( const BuildingLink& );
  44. friend class EditorObjectMgr;
  45. };
  46. #endif// BUILDINGLINK_H