Advanced Strategic Command
reactionfire.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 #if defined(karteneditor)
22  #error the mapeditor should not need to use reactionfire.h !
23 #endif
24 
25 
26 #ifndef reactionfireH
27 #define reactionfireH
28 
29 #include "typen.h"
30 #include "astar2.h"
31 #include "actions/context.h"
32 
34 
35 
37  public:
38  virtual int checkfield ( const MapCoordinate3D& pos, Vehicle* &eht, const Context& context ) = 0;
39  virtual void init ( Vehicle* eht, const AStar3D::Path& fieldlist ) = 0;
40  virtual int finalCheck ( int currentPlayer, const Context& context ) = 0;
41  virtual ~treactionfire() {};
42  };
43 
44 
46  private:
47  void initLimits();
48  void findOffensiveUnits( Vehicle* vehicle, int height, int x1, int y1, int x2, int y2 );
49 
50  GameMap* gamemap;
51  protected:
52  int attack( Vehicle* attacker, Vehicle* target, const Context& context );
53 
54  static int maxshootdist[8]; // f?r jede Hhenstufe eine
55  void addunit ( Vehicle* vehicle );
56  void removeunit ( Vehicle* vehicle );
57 
58  typedef map<const Vehicle*,int> VisibleUnits;
60 
61  public:
62 
64  void init ( Vehicle* eht, const AStar3D::Path& fieldlist );
65  void init ( Vehicle* eht, const MapCoordinate3D& pos );
66  int checkfield ( const MapCoordinate3D& pos, Vehicle* &eht, const Context& context );
67  virtual int finalCheck ( int currentPlayer, const Context& context );
69  };
70 
71 
72 
73 
74 #endif
virtual int finalCheck(int currentPlayer, const Context &context)=0
int checkfield(const MapCoordinate3D &pos, Vehicle *&eht, const Context &context)
virtual int checkfield(const MapCoordinate3D &pos, Vehicle *&eht, const Context &context)=0
virtual ~treactionfire()
Definition: reactionfire.h:41
virtual void init(Vehicle *eht, const AStar3D::Path &fieldlist)=0
void removeunit(Vehicle *vehicle)
virtual int finalCheck(int currentPlayer, const Context &context)
void addunit(Vehicle *vehicle)
map< const Vehicle *, int > VisibleUnits
Definition: reactionfire.h:58
int attack(Vehicle *attacker, Vehicle *target, const Context &context)
deque< PathPoint > Path
Definition: astar2.h:48
Coordinate on the map including height.
Definition: typen.h:238
tsearchreactionfireingunits(GameMap *gamemap)
void init(Vehicle *eht, const AStar3D::Path &fieldlist)
Interface for the A* pathfinding algorithm.
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182