00001 // $Id: shipdesign_8h-source.html,v 1.2 2002/06/20 17:09:51 mkrohn5 Exp $ 00002 // 00003 // Ship Design Header File 00004 // Written by: Ralf Laue <ralf.laue@gmx.de> 00005 // 00006 // Copyright (C) 2001 Ralf Laue <ralf.laue@gmx.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 1, or (at your option) 00011 // any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 00018 #ifndef __SHIPDESIGN_INCLUDED 00019 #define __SHIPDESIGN_INCLUDED 00020 00021 #include "common/defs.h" 00022 #include "common/link.h" 00023 #include "common/plist.h" 00024 #include "gamelogic/item.h" 00025 #include "gamelogic/substance.h" 00026 #include <string> 00027 #include <map> 00028 class TItemPack; 00029 00030 00031 00032 /***************************** class TShipDesign *******************************/ 00033 00034 00035 00079 class TShipDesign : public TLinkable 00080 { 00081 public: 00083 typedef TPList<TItemPack>::iterator tEquipmentIterator; 00085 typedef TPList<TItemPack>::const_iterator tEquipmentConstIterator; 00091 TShipDesign(); 00097 TShipDesign( const TShipDesign& OldDesign ); 00100 virtual ~TShipDesign(); 00105 virtual int2 getType() const; 00110 virtual const string& getTypeName() const; 00115 virtual void setDesignName( const string& Name ); 00118 virtual const string& getDesignName() const; 00124 int4 getUsageNumber() const; 00131 virtual bool isChangeable() const; 00141 virtual void AbleToLand( bool CanLand ); 00146 virtual bool isAtmospheric() const; 00154 virtual void setAtmosphericFactor( double Factor ); 00159 virtual double getAtmosphericFactor() const; 00164 virtual void setHullMass( const int4 Mass ); 00168 virtual int4 getHullMass() const; 00173 virtual int4 getTotalMass() const; 00178 virtual void setHullVolume( const int2 Volume ); 00183 virtual int2 getHullVolume() const; 00188 virtual int2 getFreeVolume() const; 00194 virtual void setHullSurface( const int2 Surface ); 00199 int2 getHullSurface() const; 00205 virtual int2 getFreeSurface() const; 00210 virtual void setHullCost( const TSubstanceSet& HullCost ); 00217 virtual void getHullCost( TSubstanceSet* ReturnCost ) const; 00223 virtual void getDesignCost( TSubstanceSet* ReturnCost ) const; 00229 virtual void setMaxHullHP( const int2 HitPoints ); 00233 virtual int2 getMaxHullHP() const; 00252 virtual int2 AddItem( TItem* Item, const int2 AddAmount = 1 ); 00262 virtual int2 RemoveItem( TItem *Item, const int2 RemoveAmount); 00281 virtual void getItemList( TPList<TItemPack>* ReturnList, const int2 ItemType = -1) const; 00289 virtual bool load( TDataPackageList* in ); 00297 virtual bool save( TDataPackageList* out ) const; 00299 virtual TShipDesign& operator=( const TShipDesign& Design ); 00300 00301 private: 00303 string fDesignName; 00306 bool fAtmospheric; 00308 double fAtmosphericFactor; 00310 int4 fHullMass; 00312 int4 fHullVolume; 00314 int4 fHullSurface; 00316 TSubstanceSet fHullCost; 00318 int4 fMaxHullHP; 00320 TPEList<TItemPack> fEquipment; 00321 }; 00322 00323 00324 00325 00326 00327 /****************************** class TItemPack ********************************/ 00328 00341 class TItemPack 00342 { 00343 public: 00347 TItemPack(); 00352 TItemPack( const TItemPack& OldItemPack ); 00355 ~TItemPack(); 00359 void setItem( TItem* Item ); 00363 TItem* getItem() const; 00367 void setItemAmount( int2 ItemAmount ); 00371 int2 getItemAmount() const; 00376 bool operator==( const TItemPack& ItemPack ) const; 00378 TItemPack& operator=( const TItemPack& ItemPack ); 00388 bool load( TDataPackageList* in, const string& sIdentifier, bool bUnique=true ); 00398 bool save( TDataPackageList* out, const string& sIdentifier, bool bUnique=true ) const; 00399 protected: 00401 TLink<TItem> fItemLink; 00403 int2 fItemAmount; 00404 }; // class TItemPack 00405 00406 00407 00408 #endif // __SHIPDESIGN_INCLUDED 00409