Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mapalgorithms.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           mapalgorithms.h  -  description
00003                              -------------------
00004     begin                : Thu Oct 5 2000
00005     copyright            : (C) 2000 by Martin Bickel
00006     email                : bickel@asc-hq.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef mapalgorithmsH
00019  #define mapalgorithmsH
00020 
00021  #include "typen.h"
00022  #include "vehicle.h"
00023  #include "libs/loki/Functor.h"
00024 
00027   class   SearchFields {
00028                 protected:
00029                     GameMap* gamemap;
00030                     MapCoordinate startPos;
00031                     bool        cancelSearch;
00032                     int         firstDistance, lastDistance;
00033                     int         dist;
00034                     virtual void testfield ( const MapCoordinate& pos ) = 0;
00035                 public:
00036                     SearchFields ( GameMap* _gamemap );
00037                     void initsearch ( const MapCoordinate& startPosition, int _firstDistance, int _lastDistance );
00038                     virtual void startsearch ( void );
00039                     virtual ~SearchFields() {};
00040                  };
00041 
00042   typedef Loki::Functor<void, TYPELIST_1(const MapCoordinate&) > FieldIterationFunctor;
00043   extern void circularFieldIterator( GameMap* gamemap, const MapCoordinate& center, int startDist, int stopDist, FieldIterationFunctor functor ); 
00044 
00045                  
00049   class tdrawgettempline  {
00050                   int freefields;
00051                   int num;
00052                   int sx, sy;
00053 
00054                   static int initialized;
00055                   static double dirs[ sidenum ];
00056                   static double offset;
00057 
00058                   void init ( void );
00059 
00060                protected:
00061                   GameMap* gamemap;
00062 
00063                public:
00064                    int tempsum;
00065                    tdrawgettempline ( int _freefields, GameMap* _gamemap );
00066 
00067                    void start ( int x1, int y1, int x2, int y2 );
00068 
00069                    virtual void putpix8 ( int x, int y );
00070                    double winkel ( int x, int y );
00071                    int winkelcomp ( double w1, double w2 );
00072                    virtual ~tdrawgettempline() {};
00073               };
00074 
00076 extern void  getnextfield(int &    x,
00077                           int &    y,
00078                           int direc);
00079 
00081 extern MapCoordinate3D  getNeighbouringFieldCoordinate( const MapCoordinate3D& pos, int direc);
00082 extern MapCoordinate    getNeighbouringFieldCoordinate( const MapCoordinate  & pos, int direc);
00083 
00084 
00088 extern int   getdirection(    int      x1,
00089                               int      y1,
00090                               int      x2,
00091                               int      y2);
00092 extern int   getdirection( const MapCoordinate& start, const MapCoordinate& dest );
00093 
00095 extern int beeline ( int x1, int y1, int x2, int y2 );
00096 
00098 extern int beeline ( const Vehicle* a, const Vehicle* b );
00099 
00101 extern int beeline ( const MapCoordinate& a, const MapCoordinate& b );
00102 
00104 class WindMovement {
00105       int wm[6];
00106    public:
00107       WindMovement ( const Vehicle* vehicle );
00108       int getDist ( int dir );
00109 };
00110 
00111 
00112 #endif
00113 

Generated on Tue Jun 24 01:27:45 2008 for Advanced Strategic Command by  doxygen 1.4.2