00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if defined(karteneditor)
00022 #error the mapeditor should not need to use reactionfire.h !
00023 #endif
00024
00025
00026 #ifndef reactionfireH
00027 #define reactionfireH
00028
00029 #include "typen.h"
00030 #include "astar2.h"
00031
00032 class MapDisplayInterface;
00033
00034
00035 struct treactionfire_replayinfo {
00036 int x1 ;
00037 int y1 ;
00038 int x2 ;
00039 int y2 ;
00040 int ad1 ;
00041 int ad2 ;
00042 int dd1 ;
00043 int dd2 ;
00044 int wpnum;
00045 };
00046
00047
00048
00049 class treactionfire {
00050 public:
00051 virtual int checkfield ( const MapCoordinate3D& pos, Vehicle* &eht, MapDisplayInterface* md ) = 0;
00052 virtual void init ( Vehicle* eht, const AStar3D::Path& fieldlist ) = 0;
00053 virtual int finalCheck ( MapDisplayInterface* md, int currentPlayer ) = 0;
00054 virtual ~treactionfire() {};
00055 };
00056
00057 class treactionfirereplay : public treactionfire {
00058 protected:
00059 int num;
00060 dynamic_array<treactionfire_replayinfo*> replay;
00061 Vehicle* unit;
00062 public:
00063 treactionfirereplay ( void );
00064 ~treactionfirereplay ( );
00065 virtual int checkfield ( const MapCoordinate3D& pos, Vehicle* &eht, MapDisplayInterface* md );
00066 virtual void init ( Vehicle* eht, const AStar3D::Path& fieldlist );
00067 virtual int finalCheck ( MapDisplayInterface* md, int currentPlayer ) { return 0; };
00068 };
00069
00070 class tsearchreactionfireingunits : public treactionfire {
00071 private:
00072 void initLimits();
00073 void findOffensiveUnits( Vehicle* vehicle, int height, int x1, int y1, int x2, int y2 );
00074
00075 protected:
00076 int attack( Vehicle* attacker, Vehicle* target, MapDisplayInterface* md );
00077
00078 static int maxshootdist[8];
00079 void addunit ( Vehicle* vehicle );
00080 void removeunit ( Vehicle* vehicle );
00081
00082 typedef map<const Vehicle*,int> VisibleUnits;
00083 VisibleUnits visibleUnits;
00084
00085 public:
00086
00087 tsearchreactionfireingunits( void );
00088 void init ( Vehicle* eht, const AStar3D::Path& fieldlist );
00089 void init ( Vehicle* eht, const MapCoordinate3D& pos );
00090 int checkfield ( const MapCoordinate3D& pos, Vehicle* &eht, MapDisplayInterface* md );
00091 virtual int finalCheck ( MapDisplayInterface* md, int currentPlayer );
00092 ~tsearchreactionfireingunits();
00093 };
00094
00095
00096
00097
00098 #endif