-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelicopter.h
73 lines (63 loc) · 1.9 KB
/
helicopter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef HELICOPTER_HEADER_FILE__
#define HELICOPTER_HEADER_FILE__
#include "coord.h"
#include "map.h"
#include "submarine.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define ACTION_HOVER 0 // not sure, waiting in one spot
#define ACTION_MOVING 1 // moving to destination
#define ACTION_LISTEN 2 // lower sonar
#define ACTION_RETURN_TO_BASE 3 // to be implemented later
#define ACTION_REFUELING 4 // to be implemented later
#define LISTEN_HEIGHT -20
#define MOVE_HEIGHT -50
#define HELICOPTER_RUBBER 50
#define FIRING_WAIT 120 // two minutes
#define DO_NOTHING 0
#define DO_SHOOT 1
#define DO_MOVE 2
class Helicopter : public Coord
{
public:
int MaxSpeed, DesiredSpeed;
int Depth, DesiredDepth;
int DesiredHeading;
int mood; // convoy, passive, attack
int Friend;
int ShipType, ShipClass;
int has_sonar;
MAP *map;
Helicopter *next;
Helicopter();
~Helicopter();
int Init();
void Cleanup();
int Can_Hear(Submarine *target);
Submarine *Helicopter_AI(Submarine *all_ships, Submarine *all_torpedoes);
int Handle();
int Load_Class(char *from_file);
int Load_Mission(FILE *from_file);
int Check_Status();
int Bearing_To_Destination();
double Distance_To_Destination(); // in yards
double Distance_To_Target(Submarine *target);
Submarine *Find_Target(Submarine *all_ships);
Submarine *Fire_Torpedo(Submarine *target, char *ship_file);
Submarine *Find_Closest_Friend(Submarine *ships);
private:
int TorpedoesOnBoard;
int current_action; // hovering, listening, moving, returning to base
int destination_x, destination_y;
char ClassName[CLASS_NAME_SIZE];
char ClassType[CLASS_TYPE_SIZE];
int MaxDepth, Rudder;
int hull_strength;
int firing_countdown; // make sure we can't rapid fire
float PSCS;
};
#endif // HELICOPTER_HEADER_FILE__