00001 // $Id: stobj_8h-source.html,v 1.2 2002/06/20 17:09:51 mkrohn5 Exp $ 00002 00003 // Stellar Object Header File 00004 // Written by: Jai Shaw, 00005 // Marco Krohn, <marco.krohn@gmx.de> 00006 00007 // Copyright (C) 1996 - 1999, Jai Shaw, <Jai@towersoft.com.au> 00008 // 2000 - 2002, Marco Krohn, <marco.krohn@gmx.de> 00009 // 00010 // This program is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU General Public License as published by 00012 // the Free Software Foundation; either version 2, or (at your option) 00013 // any later version. 00014 // 00015 // This program is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 00020 #ifndef __STOBJ_INCLUDED 00021 #define __STOBJ_INCLUDED 00022 00023 #include "gamelogic/action.h" 00024 #include "gamelogic/galaxy.h" 00025 #include "common/global.h" 00026 #include "common/link.h" 00027 #include "common/point.h" 00028 #include "gamelogic/waypoint.h" 00029 00030 #include <string> 00031 00032 class TDataPackageList; 00033 class TGalaxy; 00034 class TStellarObject; 00035 class TWaypoint; 00036 00037 00038 00039 00040 00041 //---------------------------------------- Misc. Functions ---------------------------------------- 00042 00050 ostream& operator<<( ostream& Stream, const TStellarObject& StellarObject ); 00051 00052 00053 00054 00055 00056 //---------------------------------------- class TStellarObject ---------------------------------------- 00057 00071 class TStellarObject : public TActionObject 00072 { 00073 friend class TGalaxy; 00074 00075 public: 00076 TStellarObject(); 00077 TStellarObject( const TPoint& Point ); 00081 virtual ~TStellarObject(); 00082 00087 void addWaypoint( const TWaypoint& waypoint ); 00098 void Attach( TStellarObject* pDest ); 00102 virtual bool canPerformAction(const TAction& action); 00106 virtual bool canBeObjectInAction(const TAction& action); 00111 void Detach(); 00115 TGalaxy* getGalaxy() const; 00119 const string& getName() const; 00123 const TPoint& getPos() const; 00128 virtual int2 getType() const; 00132 virtual const string& getTypeName() const; 00136 const TWaypointList* getWaypointList() const; 00141 bool hasWaypoint() const; 00162 bool insertWaypoint( const TWaypoint& waypoint, int2 insertPosition ); 00172 virtual bool load( TDataPackageList* in ); 00178 bool operator==( const TStellarObject& Src ) const; 00184 bool operator<( const TStellarObject& Src ) const; 00195 bool removeWaypoint( int2 waypointNumber ); 00208 bool replaceWaypoint( const TWaypoint& Waypoint, int2 waypointNumber ); 00217 virtual bool save( TDataPackageList* out ) const; 00222 void setName( const string& sName ); 00229 void setPos( const TPoint& Pos ); 00236 ostream& Write( ostream& Stream ) const; // output 00237 00238 private: 00243 TLink<TGalaxy> Galaxy; 00247 TWaypoint WP; 00252 TWaypointList fWaypointList; 00256 double dSpeed; 00260 string sName; 00261 00272 void setParent( TGalaxy* pGalaxy ); 00273 }; 00274 00275 00276 00277 00278 00279 #endif // __STOBJ_INCLUDED