1 /***************************************************************************
2  *      Mechanized Assault and Exploration Reloaded Projectfile            *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18  ***************************************************************************/
19 
20 #ifndef game_logic_automjobsH
21 #define game_logic_automjobsH
22 
23 #include "utility/position.h"
24 
25 class cClient;
26 class cClientMoveJob;
27 class cVehicle;
28 
29 class cAutoMJob
30 {
31 private:
32 	cPosition lastDestination; // last destination generated by the AI.
33 	// needed to check if the move job was changed from outside the AI (i.e. by the player)
34 	cClient& client;
35 	cVehicle& vehicle; // the vehicle the auto move job belongs to
36 	bool finished;     // true when the job can be deleted
37 
38 	// the operation point of the surveyor
39 	// the surveyor tries to stay near this coordinates
40 	cPosition operationPoint;
41 	bool playerMJob; //the player has changed the move job
42 
43 private:
44 	float calcScoreDistToOtherSurveyor (const std::vector<cAutoMJob*>& jobs, const cPosition& position, float e) const;
45 
46 	float calcFactor (const cPosition& position, const std::vector<cAutoMJob*>& jobs);
47 	void planNextMove (const std::vector<cAutoMJob*>& jobs);
48 	void planLongMove (const std::vector<cAutoMJob*>& jobs);
49 	void changeOP();
50 
51 public:
52 	cAutoMJob (cClient& client, cVehicle& vehicle);
53 
54 	void doAutoMove (const std::vector<cAutoMJob*>& jobs);
55 	void stop();
isFinished()56 	bool isFinished() const { return finished; }
getVehicle()57 	cVehicle& getVehicle() { return vehicle; }
58 };
59 
60 #endif  // game_logic_automjobsH
61