00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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;
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 );
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 );
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
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