summaryrefslogtreecommitdiffhomepage
path: root/Stars45/RadioMessage.h
blob: b3285f03dc36ab0ea0679252e0bf123ee8e7807e (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*  Starshatter OpenSource Distribution
    Copyright (c) 1997-2004, Destroyer Studios LLC.
    All Rights Reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name "Destroyer Studios" nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.

    SUBSYSTEM:    Stars.exe
    FILE:         RadioMessage.h
    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    RadioMessage (radio comms) class declaration
*/

#ifndef RadioMessage_h
#define RadioMessage_h

#include "Types.h"
#include "Geometry.h"
#include "SimObject.h"
#include "Instruction.h"
#include "List.h"
#include "Text.h"

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

class Element;
class Ship;
class SimObject;

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

class RadioMessage
{
public:
    enum  ACTION
    {
        NONE        = 0,

        DOCK_WITH   = Instruction::DOCK,
        RTB         = Instruction::RTB,
        QUANTUM_TO  = Instruction::NUM_ACTIONS,
        FARCAST_TO,

        // protocol:
        ACK,
        NACK,

        // target mgt:
        ATTACK,
        ESCORT,
        BRACKET,
        IDENTIFY,

        // combat mgt:
        COVER_ME,
        WEP_FREE,
        WEP_HOLD,
        FORM_UP,       // alias for wep_hold
        SAY_POSITION,

        // sensor mgt:
        LAUNCH_PROBE,
        GO_EMCON1,
        GO_EMCON2,
        GO_EMCON3,

        // formation mgt:
        GO_DIAMOND,
        GO_SPREAD,
        GO_BOX,
        GO_TRAIL,

        // mission mgt:
        MOVE_PATROL,
        SKIP_NAVPOINT,
        RESUME_MISSION,

        // misc announcements:
        CALL_ENGAGING,
        FOX_1,
        FOX_2,
        FOX_3,
        SPLASH_1,
        SPLASH_2,
        SPLASH_3,
        SPLASH_4,
        SPLASH_5,   // target destroyed
        SPLASH_6,   // enemy destroyed
        SPLASH_7,   // confirmed kill
        DISTRESS,
        BREAK_ORBIT,
        MAKE_ORBIT,
        QUANTUM_JUMP,

        // friendly fire:
        WARN_ACCIDENT,
        WARN_TARGETED,
        DECLARE_ROGUE,

        // support:
        PICTURE,
        REQUEST_PICTURE,
        REQUEST_SUPPORT,

        // traffic control:
        CALL_INBOUND,
        CALL_APPROACH,
        CALL_CLEARANCE,
        CALL_FINALS,
        CALL_WAVE_OFF,

        NUM_ACTIONS
    };

    RadioMessage(Ship*    dst, const Ship* sender, int action);
    RadioMessage(Element* dst, const Ship* sender, int action);
    RadioMessage(const RadioMessage& rm);
    virtual ~RadioMessage();

    // accessors:
    static const char*   ActionName(int a);

    const Ship*       Sender()          const { return sender;        }
    Ship*             DestinationShip() const { return dst_ship;      }
    Element*          DestinationElem() const { return dst_elem;      }
    int               Action()          const { return action;        }
    List<SimObject>&  TargetList()            { return target_list;   }
    const Point&      Location()        const { return location;      }
    const Text&       Info()            const { return info;          }
    int               Channel()         const { return channel;       }

    // mutators:
    void              SetDestinationShip(Ship* s)      { dst_ship = s;  }
    void              SetDestinationElem(Element* e)   { dst_elem = e;  }
    void              AddTarget(SimObject* s);
    void              SetLocation(const Point& l)      { location  = l; }
    void              SetInfo(Text msg)                { info = msg;    }
    void              SetChannel(int c)                { channel = c;   }

protected:
    const Ship*       sender;
    Ship*             dst_ship;
    Element*          dst_elem;
    int               action;
    List<SimObject>   target_list;
    Point             location;
    Text              info;
    int               channel;
};

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

#endif  // RadioMessage_h