Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List

Wormhole.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2003 - 2005 Elliott Kleinrock, Dan Neely, Kurt W. Over, Damon Domjan
00003 
00004 This file is part of FreeStars, a free clone of the Stars! game.
00005 
00006 FreeStars is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 FreeStars is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with FreeStars; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 The full GPL Copyright notice should be in the file COPYING.txt
00021 
00022 Contact:
00023 Email Elliott at 9jm0tjj02@sneakemail.com
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;    // will never shift
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;  // will jump next year
00043 
00048 class Wormhole : public CargoHolder
00049 {
00050 public:
00051         Wormhole();
00052 //      Wormhole(const Location & end)
00053 //              : CargoHolder(), mStability(WORM_VERYSTABLE), mMaxStability(WORM_VERYSTABLE), mMinStability(WORM_VERYUNSTABLE)
00054 //              {  Init(); SetLocation(end); mID = TheGalaxy->GetWormholeID(); }
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;     // the most stable this wormhole can get (WORM_VERYSTABLE is default)
00084         long mMinStability;     // the most unstable this wormhole can get (WORM_VERYUNSTABLE is default)
00085         deque<bool> mHadSeen;
00086         deque<bool> mTraversed;
00087 };
00088 
00089 #endif // Wormhole_h

Generated on Mon Aug 8 21:33:45 2005 for Freestars by  doxygen 1.4.2-20050421