00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00030 #if !defined(Wormhole_h)
00031 #define Wormhole_h
00032 #include <deque>
00033 using namespace std;
00034 class Location;
00035
00036 const long WORM_IMMOBILE = 0;
00037 const long WORM_VERYSTABLE = 1;
00038 const long WORM_STABLE = 2;
00039 const long WORM_AVERAGE = 3;
00040 const long WORM_UNSTABLE = 4;
00041 const long WORM_VERYUNSTABLE= 5;
00042 const long WORM_WILLJUMP = 100;
00043
00048 class Wormhole : public CargoHolder
00049 {
00050 public:
00051 Wormhole();
00052
00053
00054
00055 Wormhole(const Wormhole & hole);
00056 void Init();
00057
00058 virtual long GetCloak(const Player * p, bool pen) const {
00059 return (pen || mHadSeen[p->GetID()-1]) ? 0 : Rules::GetConstant("WormholeCloak", 75); }
00060 virtual long GetCargoCapacity() const { return 0; }
00061 virtual double GetMaxTachyon() const { return 1.0; }
00062 virtual long GetScanPen() const { return -1; }
00063 virtual long GetScanSpace() const { return -1; }
00064 virtual bool CanLoadBy(const Player *) const { return false; }
00065 virtual void SetCanLoadBy(const Player *) {}
00066
00067 bool ParseNode(const TiXmlNode * node);
00068 virtual TiXmlNode * WriteNode(TiXmlNode * node, const Player * viewer) const;
00069 long GetStability() const { return mStability; }
00070 const Wormhole * GetAttached() const;
00071 void SetAttached(const Wormhole * wh) { mAttached = wh; mAttachedID = wh ? wh->GetID() : 0; }
00072 void Enter(long id) const;
00073 void Exit(long id) const;
00074 void AdjustTraverse();
00075 void Jiggle();
00076 void Shift();
00077
00078 private:
00079 void AvoidPlanets();
00080 const Wormhole * mAttached;
00081 long mAttachedID;
00082 long mStability;
00083 long mMaxStability;
00084 long mMinStability;
00085 deque<bool> mHadSeen;
00086 deque<bool> mTraversed;
00087 };
00088
00089 #endif // Wormhole_h