summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/NavAI.h
blob: 32a258a2c62bf21bea1d3c9a6ec0c3c25b5f975d (plain)
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
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.

    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    Automatic Navigator
*/

#ifndef NavAI_h
#define NavAI_h

#include "Types.h"
#include "Geometry.h"
#include "System.h"
#include "ShipAI.h"
#include "Text.h"

// +--------------------------------------------------------------------+

class Farcaster;

// +--------------------------------------------------------------------+

class NavAI : public ShipAI
{
public:
    NavAI(Ship* s);
    virtual ~NavAI();

    enum { DIR_TYPE = 2000 };
    virtual int       Type() const { return DIR_TYPE; }

    virtual void      ExecFrame(double seconds);
    virtual int       Subframe()  const { return true; }
    void              Disengage();
    bool              Complete()  const { return complete; }

protected:
    // behaviors:
    virtual Steer     SeekTarget();

    // steering functions:
    virtual Point     Transform(const Point& pt);
    virtual Steer     Seek(const Point& point);
    virtual Steer     Flee(const Point& point);
    virtual Steer     Avoid(const Point& point, float radius);
    virtual Steer     AvoidTerrain();

    // accumulate behaviors:
    virtual void      Navigator();
    virtual void      FindObjective();

    virtual void      HelmControl();
    virtual void      ThrottleControl();

    bool              complete;
    int               drop_state;
    int               quantum_state;
    int               terrain_warning;
    double            brakes;
    Farcaster*        farcaster;
};

// +--------------------------------------------------------------------+


#endif  // NavAI_h