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 "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;
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 );
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 );
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
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