Advanced Strategic Command
viewcalculation.h
Go to the documentation of this file.
1 /***************************************************************************
2  viewcalculation.h - description
3  -------------------
4  begin : Thu Oct 5 2000
5  copyright : (C) 2000 by Martin Bickel
6  email : bickel@asc-hq.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 
19 #ifndef viewcalculationH
20  #define viewcalculationH
21 
22  #include "actions/context.h"
23  #include "typen.h"
24  #include "mapalgorithms.h"
25  #include "gamemap.h"
26 
27  class tcomputeview : public SearchFields {
28  protected:
29  int actView;
30  int player;
31  int mode;
32  int height;
34  int baseJammingMultiplier; // in 1/100
35 
37  int viewdist;
38  int jamdist;
39  virtual void initviewcalculation( int view, int jamming, int sx, int sy, int _mode, int _height ); // mode: +1 = add view ; -1 = remove view
40  virtual void testfield ( const MapCoordinate& mc );
41 
42  public:
43  tcomputeview ( GameMap* _actmap ) : SearchFields ( _actmap ), rangeJamming ( true ), baseJammingMultiplier(100) { actView = _actmap->getPlayerView(); };
44  };
45 
47  public:
49  void init( const Vehicle* eht, int _mode ); // mode: +1 = add view ; -1 = remove view );
50  };
51 
53  const Building* building;
54  public:
56  void init( const Building* bld, int _mode );
57  };
58 
65  extern int computeview( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
66 
75  extern int evaluatevisibilityfield ( GameMap* gamemap, MapField* fld, int player, int add, int initial );
76 
84  extern int evaluateviewcalculation ( GameMap* gamemap, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
85 
97  extern int evaluateviewcalculation ( GameMap* gamemap, const MapCoordinate& pos, int distance, int player_fieldcount_mask = 0, bool disableShareView = false, const Context* context = NULL );
98 
108  extern VisibilityStates calcvisibilityfield ( GameMap* gamemap, MapField* fld, int player, int add, int initial, int additionalEnemyJamming );
109 
110 
111  // extern VisibilityStates fieldVisibility ( tfield* pe, int player, GameMap* gamemap, int additionalEnemyJamming );
112  extern int getPlayersWithSharedViewMask( int player, GameMap* gamemap );
113 
114  extern sigc::signal<void> buildingSeen;
115 
117  MapCoordinate position;
118  int range;
119  GameMap* gamemap;
120  bool active;
121 
122  void removeFieldView( const MapCoordinate& pos );
123  void addFieldView( const MapCoordinate& pos );
124  const Context* context;
125  public:
126  RecalculateAreaView( GameMap* gamemap, const MapCoordinate& pos, int range, const Context* context );
127  void removeView();
128  void addView();
130  };
131 
132 #endif
sigc::signal< void > buildingSeen
VisibilityStates
the different states that a player's view on a field can have
Definition: typen.h:403
void init(const Vehicle *eht, int _mode)
tcomputebuildingview(GameMap *gamemap)
a single field of the map
Definition: mapfield.h:26
int getPlayerView() const
the player which is currently viewing the map.
Definition: gamemap.cpp:1007
Coordinate on the twodimensional map.
Definition: typen.h:202
Definition of THE central asc class: GameMap.
searches fields in hexagonal "circles" around a field and calls testfield for each field ...
Definition: mapalgorithms.h:28
tcomputeview(GameMap *_actmap)
VisibilityStates calcvisibilityfield(GameMap *gamemap, MapField *fld, int player, int add, int initial, int additionalEnemyJamming)
calculates the view on a given field.
int getPlayersWithSharedViewMask(int player, GameMap *gamemap)
int computeview(GameMap *gamemap, int player_fieldcount_mask=0, bool disableShareView=false, const Context *context=NULL)
completely computes the view
int evaluatevisibilityfield(GameMap *gamemap, MapField *fld, int player, int add, int initial)
evaluates the view on a given field and saves it for that field.
RecalculateAreaView(GameMap *gamemap, const MapCoordinate &pos, int range, const Context *context)
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
tcomputevehicleview(GameMap *gamemap)
virtual void initviewcalculation(int view, int jamming, int sx, int sy, int _mode, int _height)
virtual void testfield(const MapCoordinate &mc)
int baseJammingMultiplier
GameMap * gamemap
Definition: mapalgorithms.h:30
int evaluateviewcalculation(GameMap *gamemap, int player_fieldcount_mask=0, bool disableShareView=false, const Context *context=NULL)
evaluates the view on the whole map.
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182
void init(const Building *bld, int _mode)