summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/NetUtil.h
blob: 0d68891175f3ac88922dca6a6a9bc49e3440a654 (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
/*  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
    ========
    Utility class to simplify sending NetData messages.
*/

#pragma once

#include <cstdint>

#include "Geometry.h"

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

class Element;
class Instruction;
class SimObject;
class Ship;
class Shot;
class System;
class Weapon;

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

class NetUtil
{
public:
    static void    SendObjDamage(SimObject* obj, double damage, Shot* shot=0);
    static void    SendObjKill(Ship* obj, const Ship* killer, int type=0, int deck=0);
    static void    SendObjHyper(Ship* obj, const char* rgn, const Point& loc, const Ship* fc1=0, const Ship* fc2=0, int ttype=0);
    static void    SendObjTarget(Ship* obj);
    static void    SendObjEmcon(Ship* obj);
    static void    SendSysDamage(Ship* obj, System* sys, double damage);
    static void    SendSysStatus(Ship* obj, System* sys);
    static void    SendWepTrigger(Weapon* wep, int count=1);
    static void    SendWepRelease(Weapon* wep, Shot* shot);
    static void    SendWepDestroy(Shot* shot);
    static void    SendChat(std::uint32_t dst, const char* name, const char* text);
    static void    SendElemRequest(const char* name);
    static void    SendElemCreate(Element* elem, int squadron, int* slots, bool alert, bool in_flight=false);
    static void    SendShipLaunch(Ship* carrier, int squadron, int slot);
    static void    SendNavData(bool add, Element* elem, int index, Instruction* navpt);
    static void    SendNavDelete(Element* elem, int index);
    static void    SendSelfDestruct(Ship* ship, double damage);
};