Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

buildings.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           buildings.h  -  description
00003                              -------------------
00004     begin                : Sat Feb 17 2001
00005     copyright            : (C) 2001 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 
00022 #ifndef buildingsH
00023  #define buildingsH
00024 
00025  #include "typen.h"
00026  #include "containerbase.h"
00027  #include "ascstring.h"
00028  #include "buildingtype.h"
00029  #include "mapalgorithms.h"
00030 
00031 class tfield;
00032 
00034 class  Building : public ContainerBase {
00035     MapCoordinate entryPosition;
00036 
00037     char         _completion;
00038 
00039     friend class tprocessminingfields;
00040   protected:
00041 
00043     int           repairedThisTurn;
00044     
00045    public:
00046     const BuildingType* typ;
00047 
00049     int         ammo[waffenanzahl];
00050 
00052     ASCString    name;
00053 
00055     int          netcontrol;
00056 
00058     int          connection;
00059 
00061     bool         visible;
00062 
00063 
00064     AiValue*      aiparam[8];
00065 
00066     Building( GameMap* map, const MapCoordinate& entryPosition, const BuildingType* type , int player, bool setupImages = true, bool chainToField = true);
00067 
00068     int lastmineddist;
00069 
00070     bool canRepair ( const ContainerBase* item ) const;
00071 
00072     static Building* newFromStream ( GameMap* gamemap, tnstream& stream, bool chainToField = true );
00073     void write ( tnstream& stream, bool includeLoadedUnits = true );
00074     void read ( tnstream& stream );
00075   private:
00076     void readData ( tnstream& stream, int version );
00077   public:
00078  
00080     void execnetcontrol ( void );
00081     // int  getmininginfo ( int res );
00082 
00083     int  putResource ( int amount,    int resourcetype, bool queryonly, int scope = 1, int player = -1 );
00084     int  getResource ( int amount,    int resourcetype, bool queryonly, int scope = 1, int player = -1 );
00085     int  getAvailableResource ( int amount,    int resourcetype, int scope = 1 ) const;
00086     Resources putResource ( const Resources& res, bool queryonly, int scope = 1, int player = -1 ) { return ContainerBase::putResource ( res, queryonly, scope, player ); };
00087     Resources getResource ( const Resources& res, bool queryonly, int scope = 1, int player = -1 ) { return ContainerBase::getResource ( res, queryonly, scope, player ); };
00088 
00089 
00091     Resources   actstorage;
00092     
00093     int getIdentification();
00094 
00095 
00097     const Surface& getPicture ( const BuildingType::LocalCoordinate& localCoordinate ) const;
00098 
00099     void paintSingleField ( Surface& s, SPoint imgpos, BuildingType::LocalCoordinate pos ) const;
00100 
00101     virtual Surface getImage() const;
00102 
00103 
00104     bool isBuilding() const { return true; };
00105     
00106     
00108     void convert ( int player );
00109 
00111     void addview();
00112 
00114     void removeview();
00115 
00117     int  getArmor() const;
00118 
00120     tfield* getEntryField() const;
00121 
00123     MapCoordinate3D getEntry ( ) const;
00124 
00126     tfield* getField( const BuildingType::LocalCoordinate& localCoordinates ) const;
00127     
00129     MapCoordinate getFieldCoordinates( const BuildingType::LocalCoordinate& localCoordinates ) const;
00130 
00131     
00133     BuildingType::LocalCoordinate getLocalCoordinate( const MapCoordinate& field ) const;
00134     
00136     MapCoordinate3D getPosition ( ) const { return getEntry(); };
00137 
00139     MapCoordinate3D getPosition3D( ) const;
00140 
00142     int  chainbuildingtofield ( const MapCoordinate& entryPos, bool setupImages = true );
00143 
00145     int  unchainbuildingfromfield ( void );
00146 
00148     int getCompletion() const { return _completion; };
00149 
00155     void setCompletion ( int completion, bool setupImages = true  );
00156 
00158     void endRound( void );
00159 
00161     ASCString getName ( ) const;
00162 
00163     int getAmmo( int type, int num, bool queryOnly );
00164     int getAmmo( int type, int num ) const;
00165     int putAmmo( int type, int num, bool queryOnly );
00166     int maxAmmo( int type ) const { return maxint; };
00167 
00168 
00170     int getHeight() const { return typ->buildingheight; };
00171     
00172     
00173     ~Building();
00174 
00175     virtual int repairableDamage();
00176 
00177      int getMemoryFootprint() const;
00178 
00179   protected:
00180      ResourceMatrix repairEfficiency;
00181      const ResourceMatrix& getRepairEfficiency ( void ) { return repairEfficiency; };
00182      virtual void postRepair ( int oldDamage );
00183      vector<MapCoordinate> getCoveredFields();
00184 };
00185 
00186 
00187 extern void doresearch ( GameMap* actmap, int player );
00188 
00189 #endif

Generated on Tue Jun 24 01:27:36 2008 for Advanced Strategic Command by  doxygen 1.4.2