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

Galaxy.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(Galaxy_h)
00031 #define Galaxy_h
00032 
00033 #include <deque>
00034 using namespace std;
00035 
00036 class Planet;
00037 class Salvage;
00038 class Wormhole;
00039 class Packet;
00040 class Creation;
00041 class TempFleet;
00042 
00046 class Galaxy {
00047 public:
00048         Galaxy() : mMaxX(0), mMaxY(0) {}
00049         virtual ~Galaxy();
00050 
00051         bool ParseNode(const TiXmlNode * node);
00052         void WriteNode(TiXmlNode * node, const Player * viewer) const;
00053         void WriteXYFile(TiXmlNode * node);
00054 
00055         Planet * GetPlanet(int posX, int posY);
00056         Planet * GetPlanet(const CargoHolder * loc);
00057         Planet * GetPlanet(const char * name);
00058         Planet * GetPlanet(int id)                                      { return (id < 1 || id > mPlanets.size()) ? NULL : mPlanets[id-1]; }
00059         void AddInvasion(Planet * planet);
00060         void ResolveInvasions();
00061 
00062         void AddSalvage(Salvage * salvage)      { mScrap.insert(mScrap.end(), salvage); }
00063         Salvage * AddSalvage(const CargoHolder & ch);
00064         Salvage * GetSalvage(long n) const;
00065         void DecaySalvage();
00066 
00067         void MovePackets(bool firstyear);
00068         void AddPacket(Packet * packet, const Planet * planet);
00069         const Packet * GetPacket(long n) const;
00070 
00071         bool Mine();
00072         void GrowPop();
00073         void DoProduction();
00074         void TechSpent(long TechGain, TechType tech);
00075         void GainSpyTech(Player * player);
00076         void DeadCheck();
00077 
00078         void RepairBases();
00079         void Instaform();
00080         
00081         void DoBombing();
00082         long GetSalvageID() const;
00083         long GetPacketID() const;
00084         long GetWormholeID() const;
00085         long GetNextPlanetID() const    { return mPlanets.size()+1; }
00086 
00087         int GetPlanetCount() const      { return mPlanets.size(); }
00088         void Build(Creation * c);
00089         void PlacePlayer(Player * player);
00090         const Planet * ClosestPlanet(const Location * loc);
00091         long MinX() const               { return mMinX; }
00092         long MinY() const               { return mMinY; }
00093         long MaxX() const               { return mMaxX; }
00094         long MaxY() const               { return mMaxY; }
00095         void LoadPlanets();
00096         void LoadScrap();
00097         void LoadPackets();
00098         void LoadWormholes();
00099         const Wormhole * GetWormhole(long id) const;
00100         void JiggleWormholes();
00101         void AdjustWormholeTraverse();
00102 
00103         CargoHolder * GetJettison(const CargoHolder * ch, CargoHolder * ch2);
00104         void CleanJettison();
00105         bool ParseSize(const TiXmlNode * node);
00106 
00107 protected:
00108         deque<Planet *> mPlanets;
00109         deque<Planet *> invasions;
00110         deque<Salvage *> mScrap;
00111         deque<Packet *> mPackets;
00112         deque<Wormhole *> mWormholes;
00113         deque<TempFleet *> mJettison;
00114         deque<long> mTechSpent;
00115 
00116         //friend void Player::DoBombing();
00117         long mMinX;
00118         long mMinY;
00119         long mMaxX;
00120         long mMaxY;
00121 };
00122 
00123 extern Galaxy * TheGalaxy;
00124 
00125 #endif // !defined(Galaxy_h)

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