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