File: helicopter.h

package info (click to toggle)
openssn 1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,340 kB
  • sloc: cpp: 10,973; makefile: 80
file content (75 lines) | stat: -rw-r--r-- 1,843 bytes parent folder | download | duplicates (3)
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
74
75
#ifndef HELICOPTER_HEADER_FILE__
#define HELICOPTER_HEADER_FILE__

#include "coord.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 mintes

#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 TorpedoesOnBoard;
   int current_action;   // hovering, listening, moving, returning to base
   int mood;     // convoy, passive, attack
   int Friend;
   int destination_x, destination_y;
   int ShipType, ShipClass;
   char ClassName[CLASS_NAME_SIZE];
   char ClassType[CLASS_TYPE_SIZE];
   int MaxDepth, Rudder;
   int hull_strength;
   int has_sonar;
   int firing_countdown;  // make sure we can't rapid fire
   float PSCS;
   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);
};



#endif