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

mapfield.h

Go to the documentation of this file.
00001 
00002 /***************************************************************************
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  ***************************************************************************/
00010 
00011 
00012 #ifndef mapfieldH
00013  #define mapfieldH
00014 
00015  #include <vector>
00016 
00017  #include "typen.h"
00018  #include "vehicle.h"
00019  #include "basestrm.h"
00020  #include "explosivemines.h"
00021  
00022 
00023 
00025 class  tfield {
00026     GameMap* gamemap;
00027     void init();
00028   protected:
00029     tfield (  );
00030     friend class GameMap;
00031   public:
00032     tfield ( GameMap* gamemap_ );
00033     void operator= ( const tfield& f );
00034 
00035     void setMap ( GameMap* gamemap_ ) { gamemap = gamemap_; };
00036 
00038     TerrainType::Weather* typ;
00039 
00041     char         fuel, material;
00042 
00044     Uint16       visible;
00045 
00047     int          viewbonus;
00048 
00049 
00051 
00052     union  {
00053       struct {
00054         char         temp;
00055         char         temp2;
00056       }a;
00057       Uint16 tempw;
00058     };
00059     int          temp3;
00060     int          temp4;
00062 
00063     Vehicle*     vehicle;
00064     Building*    building;
00065 
00066     struct Resourceview {
00067       Resourceview ( void );
00068       void setview( int player, int material, int fuel );
00069       void resetview( int player );
00070       char    visible;      // BM
00071       char    fuelvisible[8];
00072       char    materialvisible[8];
00073     };
00074 
00076     Resourceview*  resourceview;
00077 
00078     typedef list<Mine> MineContainer;
00079     MineContainer mines;
00080 
00082     Mine& getMine ( int n );
00083 
00084 
00085     typedef vector< ::Object> ObjectContainer;
00086     ObjectContainer objects;
00087 
00094     bool addobject ( const ObjectType* obj, int dir = -1, bool force = false );
00095 
00097     void removeobject ( const ObjectType* obj, bool force = false );
00098 
00100     void sortobjects ( void );
00101 
00103     Object* checkforobject ( const ObjectType*  o );
00104 
00105 
00107     TerrainBits  bdt;
00108 
00110     int connection;
00111 
00112 
00114     void deleteeverything ( void );
00115 
00117     void setparams ( void );
00118 
00120     int getdefensebonus ( void );
00121 
00123     int getattackbonus  ( void );
00124 
00126     int getweather ( void );
00127     void setweather( int weather );
00128 
00129     ASCString getName();
00130     
00132     int getjamming ( void );
00133     int getmovemalus ( const Vehicle* veh );
00134     int getmovemalus ( int type );
00135 
00137     int mineattacks ( const Vehicle* veh );
00138 
00140     int mineowner ( void );
00141 
00143     bool unitHere ( const Vehicle* veh );
00144 
00146     ContainerBase* getContainer();
00147 
00149     bool  putmine ( int col, int typ, int strength );
00150 
00154     void  removemine ( int num ); 
00155 
00156     void endRound( int turn );
00157 
00159     struct View {
00160       int view;
00161       int jamming;
00162       char mine, satellite, sonar, direct;
00163     } view[8];
00164 
00169    void setVisibility ( VisibilityStates valtoset, int actplayer );
00170 
00171    VisibilityStates getVisibility( int actplayer ) {
00172        return VisibilityStates((visible >> (2*actplayer)) & 3);
00173    };
00174 
00175    static void resetView( GameMap* gamemap, int playersToReset );
00176 
00177     int getx();
00178     int gety();
00179 
00180     int getMemoryFootprint() const;
00181 
00182     ~tfield();
00183   private:
00184     TerrainType::MoveMalus __movemalus;
00185 };
00186 
00187 
00188 
00189 
00190 
00191 #endif
00192 

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