summaryrefslogtreecommitdiff
path: root/src/uqm/grpinfo.h
blob: 65286aa1b1909f63c6d492fdbccfaa3d8b497f61 (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
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef UQM_GRPINFO_H_
#define UQM_GRPINFO_H_

#include "port.h"
#include "libs/compiler.h"
#include "displist.h"
#include "libs/gfxlib.h"
		// for POINT
#include <assert.h>

#if defined(__cplusplus)
extern "C" {
#endif

// XXX: Needed to maintain savegame compatibility
#define NUM_SAVED_BATTLE_GROUPS 64

typedef HLINK HIPGROUP;

typedef struct
{
	// LINK elements; must be first
	HIPGROUP pred;
	HIPGROUP succ;

	UWORD group_counter;
	BYTE race_id;
	BYTE sys_loc;
	BYTE task;  // AKA mission
	BYTE in_system;
			// a simple != 0 flag
			// In older savegames this will be >1, because
			//   CloneShipFragment was used to spawn groups,
			//   and it set this to crew_level values
	
	BYTE dest_loc;
	BYTE orbit_pos;
			/* Also: saved prev dest_loc before intercept call,
			 *   restored to dest_loc on all-clear */
	BYTE group_id;
	POINT loc;

	FRAME melee_icon;
} IP_GROUP;

enum
{
	IN_ORBIT = 0,
	EXPLORE,
	FLEE,
	ON_STATION,

	IGNORE_FLAGSHIP = 1 << 2,
	REFORM_GROUP = 1 << 3
};
#define MAX_REVOLUTIONS 5

#define STATION_RADIUS 1600
#define ORBIT_RADIUS 2400

static inline IP_GROUP *
LockIpGroup (const QUEUE *pq, HIPGROUP h)
{
	assert (GetLinkSize (pq) == sizeof (IP_GROUP));
	return (IP_GROUP *) LockLink (pq, h);
}

#define UnlockIpGroup(pq, h)  UnlockLink (pq, h)
#define FreeIpGroup(pq, h)    FreeLink (pq, h)

extern HIPGROUP BuildGroup (QUEUE *pDstQueue, BYTE race_id);

#if defined(__cplusplus)
}
#endif

#endif /* UQM_GRPINFO_H_ */