OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MovingTarget.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_MOVINGTARGET_H
20 #define OPENXCOM_MOVINGTARGET_H
21 
22 #include "Target.h"
23 
24 namespace OpenXcom
25 {
26 
31 class MovingTarget : public Target
32 {
33 protected:
34  static const double GLOBE_RADIUS;
35 
36  Target *_dest;
37  double _speedLon, _speedLat, _speedRadian;
38  int _speed;
39 
41  virtual void calculateSpeed();
43  MovingTarget();
44 public:
46  virtual ~MovingTarget();
48  void load(const YAML::Node& node);
50  virtual YAML::Node save() const;
52  Target *getDestination() const;
54  virtual void setDestination(Target *dest);
56  int getSpeed() const;
58  void setSpeed(int speed);
60  bool reachedDestination() const;
62  void move();
63 };
64 
65 }
66 
67 #endif
virtual void calculateSpeed()
Calculates a new speed vector to the destination.
Definition: MovingTarget.cpp:148
void setSpeed(int speed)
Sets the moving target's speed.
Definition: MovingTarget.cpp:134
bool reachedDestination() const
Has the moving target reached its destination?
Definition: MovingTarget.cpp:176
void load(const YAML::Node &node)
Loads the moving target from YAML.
Definition: MovingTarget.cpp:56
Target * getDestination() const
Gets the moving target's destination.
Definition: MovingTarget.cpp:87
int getSpeed() const
Gets the moving target's speed.
Definition: MovingTarget.cpp:123
virtual void setDestination(Target *dest)
Sets the moving target's destination.
Definition: MovingTarget.cpp:96
virtual YAML::Node save() const
Saves the moving target to YAML.
Definition: MovingTarget.cpp:69
virtual ~MovingTarget()
Cleans up the moving target.
Definition: MovingTarget.cpp:37
MovingTarget()
Creates a moving target.
Definition: MovingTarget.cpp:30
Base class for moving targets on the globe with a certain speed and destination.
Definition: MovingTarget.h:31
void move()
Move towards the destination.
Definition: MovingTarget.cpp:188
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:35