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 "actions/context.h"
00023  #include "typen.h"
00024  #include "mapalgorithms.h"
00025  #include "gamemap.h"
00026 
00027   class tcomputeview : public SearchFields {
00028                 protected:
00029                       int actView;
00030                       int player;
00031                       int mode;
00032                       int height;
00033                       bool rangeJamming;
00034                       int baseJammingMultiplier; // in 1/100
00035 
00036                       int sonar,satellitenview,minenview;
00037                       int        viewdist;
00038                       int        jamdist;
00039                       virtual void  initviewcalculation( int view, int jamming, int sx, int sy, int _mode, int _height   );   // mode: +1 = add view  ;  -1 = remove view
00040                       virtual void  testfield ( const MapCoordinate& mc );
00041 
00042                 public:
00043                       tcomputeview ( GameMap* _actmap ) : SearchFields ( _actmap ), rangeJamming ( true ), baseJammingMultiplier(100) { actView = _actmap->getPlayerView(); };
00044                  };
00045 
00046   class tcomputevehicleview : public tcomputeview {
00047                            public:
00048                                tcomputevehicleview ( GameMap* gamemap ) : tcomputeview ( gamemap ) {};
00049                                void          init( const Vehicle* eht, int _mode  );   // mode: +1 = add view  ;  -1 = remove view );
00050                            };
00051 
00052   class tcomputebuildingview : public tcomputeview  {
00053                               const Building*         building;
00054                            public:
00055                               tcomputebuildingview ( GameMap* gamemap ) : tcomputeview ( gamemap ) {};
00056                               void              init( const Building*    bld, int _mode );
00057                            };
00058 
00065   extern int computeview( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
00066 
00075   extern int evaluatevisibilityfield ( GameMap* gamemap, MapField* fld, int player, int add, int initial );
00076 
00084   extern int  evaluateviewcalculation ( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
00085 
00097   extern int  evaluateviewcalculation ( GameMap* gamemap, const MapCoordinate& pos, int distance, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
00098 
00108   extern VisibilityStates calcvisibilityfield ( GameMap* gamemap, MapField* fld, int player, int add, int initial, int additionalEnemyJamming );
00109 
00110   
00111   // extern VisibilityStates fieldVisibility  ( tfield* pe, int player, GameMap* gamemap, int additionalEnemyJamming );
00112   extern int getPlayersWithSharedViewMask( int player, GameMap* gamemap );
00113   
00114   extern SigC::Signal0<void> buildingSeen;
00115 
00116   class RecalculateAreaView {
00117      MapCoordinate position;
00118      int range;
00119      GameMap* gamemap; 
00120      bool active;
00121 
00122      void removeFieldView( const MapCoordinate& pos );
00123      void addFieldView( const MapCoordinate& pos );
00124      const Context* context;
00125    public:
00126       RecalculateAreaView( GameMap* gamemap, const MapCoordinate& pos, int range, const Context* context );
00127       void removeView();
00128       void addView();
00129       ~RecalculateAreaView();
00130   };
00131 
00132 #endif

Generated on Mon May 21 01:26:39 2012 for Advanced Strategic Command by  doxygen 1.5.1