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

viewcalculation.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           viewcalculation.h  -  description
00003                              -------------------
00004     begin                : Thu Oct 5 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 #ifndef viewcalculationH
00020  #define viewcalculationH
00021 
00022  #include "typen.h"
00023  #include "mapalgorithms.h"
00024  #include "gamemap.h"
00025 
00026   class tcomputeview : public SearchFields {
00027                 protected:
00028                       int actView;
00029                       int player;
00030                       int mode;
00031                       int height;
00032                       bool rangeJamming;
00033                       int baseJammingMultiplier; // in 1/100
00034 
00035                       int sonar,satellitenview,minenview;
00036                       int        viewdist;
00037                       int        jamdist;
00038                       virtual void  initviewcalculation( int view, int jamming, int sx, int sy, int _mode, int _height   );   // mode: +1 = add view  ;  -1 = remove view
00039                       virtual void  testfield ( const MapCoordinate& mc );
00040 
00041                 public:
00042                       tcomputeview ( GameMap* _actmap ) : SearchFields ( _actmap ), rangeJamming ( true ), baseJammingMultiplier(100) { actView = _actmap->getPlayerView(); };
00043                  };
00044 
00045   class tcomputevehicleview : public tcomputeview {
00046                            public:
00047                                tcomputevehicleview ( GameMap* gamemap ) : tcomputeview ( gamemap ) {};
00048                                void          init( const Vehicle* eht, int _mode  );   // mode: +1 = add view  ;  -1 = remove view );
00049                            };
00050 
00051   class tcomputebuildingview : public tcomputeview  {
00052                               const Building*         building;
00053                            public:
00054                               tcomputebuildingview ( GameMap* gamemap ) : tcomputeview ( gamemap ) {};
00055                               void              init( const Building*    bld, int _mode );
00056                            };
00057 
00064   extern int computeview( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false );
00065 
00074   extern int evaluatevisibilityfield ( GameMap* gamemap, tfield* fld, int player, int add, int initial );
00075 
00083   extern int  evaluateviewcalculation ( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false );
00084 
00094   extern int  evaluateviewcalculation ( GameMap* gamemap, const MapCoordinate& pos, int distance, int player_fieldcount_mask = 0, bool disableShareView = false);
00095 
00105   extern VisibilityStates calcvisibilityfield ( GameMap* gamemap, tfield* fld, int player, int add, int initial, int additionalEnemyJamming );
00106 
00107   
00108   // extern VisibilityStates fieldVisibility  ( tfield* pe, int player, GameMap* gamemap, int additionalEnemyJamming );
00109   extern int getPlayersWithSharedViewMask( int player, GameMap* gamemap );
00110   
00111   extern SigC::Signal0<void> buildingSeen;
00112 
00113   class RecalculateAreaView {
00114      MapCoordinate position;
00115      int range;
00116      GameMap* gamemap; 
00117      bool active;
00118 
00119      void removeFieldView( const MapCoordinate& pos );
00120      void addFieldView( const MapCoordinate& pos );
00121    public:
00122       RecalculateAreaView( GameMap* gamemap, const MapCoordinate& pos, int range );
00123       void removeView();
00124       void addView();
00125       ~RecalculateAreaView();
00126   };
00127 
00128 #endif

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