00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __GALAXY_INCLUDED
00019 #define __GALAXY_INCLUDED
00020
00021 #include <iostream>
00022 #include <string>
00023 #include <vector>
00024
00025 #include "common/defs.h"
00026 #include "common/link.h"
00027 #include "common/point.h"
00028 #include "gamelogic/stolist.h"
00029
00030 class TDataPackageList;
00031 class TObjectID;
00032 class TStellarObject;
00033
00034
00035
00036
00037
00038
00039
00060 class TGalaxy : public TLinkable
00061 {
00062 public:
00074 TGalaxy( const string& name="", const TPoint& Size=0,
00075 bool wrapX=false, bool wrapY=false, bool wrapZ =false);
00079 ~TGalaxy();
00080
00089 bool addStellarObject( TStellarObject* obj );
00093 int2 getDimension() const;
00102 double getDistance( const TPoint& one,
00103 const TPoint& two ) const;
00112 double getDistance( const TStellarObject* one,
00113 const TStellarObject* two ) const;
00121 TPoint getDistanceVector( const TPoint& from,
00122 const TPoint& to ) const;
00132 TPoint getDistanceVector( const TStellarObject* from,
00133 const TStellarObject* to ) const;
00137 const string& getName() const;
00141 const TPoint& getSize() const;
00146 const TStellarObjectList& getStellarObjectList() const;
00150 int4 getTotalNumber() const;
00155 virtual int2 getType() const;
00161 virtual const string& getTypeName() const;
00169 virtual bool load( TDataPackageList* in );
00176 bool remove( TStellarObject* obj );
00184 virtual bool save( TDataPackageList* out ) const;
00196 bool transform( TPoint& point ) const;
00197
00198 private:
00200 string fName;
00202 TPoint fSize;
00204 TStellarObjectList fStObj;
00206 bool fWrapX;
00208 bool fWrapY;
00210 bool fWrapZ;
00211
00215 void removeAll();
00223 bool transformCoordinate( double& x, double max, bool wrap ) const;
00224 };
00225
00226
00227
00228
00229
00230 #endif // __GALAXY_INCLUDED