/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* Steve McClure, 1998
*/
-#ifndef _PLANE_H_
-#define _PLANE_H_
+#ifndef PLANE_H
+#define PLANE_H
+#include <time.h>
#include "queue.h"
-#include "sect.h"
+#include "types.h"
+#define PLN_TYPE_MAX 46
#define PLANE_MINEFF 10
-/*
- * some routines assume that from pln_x to pln_wing remains
- * exactly equivalent with shp_x to shp_fleet
- */
struct plnstr {
- /* initial part must match struct genitem */
+ /* initial part must match struct empobj */
short ef_type;
- natid pln_own; /* owning country */
short pln_uid; /* plane unit id */
+ natid pln_own; /* owning country */
coord pln_x; /* plane x-y */
coord pln_y;
- s_char pln_type; /* index in plchr[] */
- s_char pln_effic; /* actually "training" */
- s_char pln_mobil; /* plane mobility */
+ signed char pln_type; /* index in plchr[] */
+ signed char pln_effic; /* actually "training" */
+ signed char pln_mobil; /* plane mobility */
+ unsigned char pln_off; /* repairs stopped? */
short pln_tech; /* plane's tech level */
- s_char pln_wing; /* like fleet */
+ char pln_wing; /* like fleet */
coord pln_opx; /* Op sector coords */
coord pln_opy; /* Op sector coords */
short pln_mission; /* mission code */
short pln_radius; /* mission radius */
- /* end of part matching struct genitem */
- u_char pln_range; /* total distance, not radius */
- u_char pln_range_max; /* max range for this plane */
+ /* end of part matching struct empobj */
+ unsigned char pln_range; /* total distance, not radius */
+ unsigned char pln_range_max; /* max range for this plane */
short pln_ship; /* pointer to carrier */
short pln_land; /* pointer to carrier */
int pln_att; /* plane air-air attack/defense values */
int pln_acc;
int pln_load;
int pln_fuel; /* (unused) */
- s_char pln_harden; /* for missiles */
- s_char pln_nuketype; /* type of nuclear armament (if any) */
- s_char pln_flags; /* State of the plane */
- time_t pln_access; /* Last time mob was updated (MOB_ACCESS) */
+ signed char pln_harden; /* for missiles */
+ signed char pln_nuketype; /* type of nuclear armament (if any) */
+ signed char pln_flags; /* State of the plane */
+ short pln_access; /* Last tick mob was updated (MOB_ACCESS) */
time_t pln_timestamp; /* Last time this plane was touched */
float pln_theta; /* position in orbital sine wave */
};
int pl_fuel; /* fuel consumption */
int pl_stealth; /* how stealthy is it? */
int pl_flags; /* description of capability */
+ signed char pl_type; /* index in plchr[] */
};
#define P_B bit(0) /* bombing factor only for bombing */
struct plnstr plane; /* struct plane */
};
-#define getplane(n, p) \
- ef_read(EF_PLANE, n, p)
-#define putplane(n, p) \
- ef_write(EF_PLANE, n, p)
-#define getplanep(n) \
- (struct plnstr *) ef_ptr(EF_PLANE, n)
+#define getplane(n, p) ef_read(EF_PLANE, (n), (p))
+#define putplane(n, p) ef_write(EF_PLANE, (n), (p))
+#define getplanep(n) ((struct plnstr *)ef_ptr(EF_PLANE, (n)))
-extern struct plchrstr plchr[];
-extern int pln_maxno;
+extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
struct shiplist {
short uid;
};
#define PLN_ATTDEF(b, t) (b + ((b?1:0) * ((t/20)>10?10:(t/20))))
-#define PLN_ACC(b, t) (b * (1.0 - (sqrt((double)t) / 50.)))
-#define PLN_RAN(b, t) (t ? (b + (logx((double)t, (double)2.0))) : b)
-#define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \
- logx((double)t, (double)50.0))) : b)
+#define PLN_ACC(b, t) (b * (1.0 - (sqrt(t) / 50.)))
+#define PLN_RAN(b, t) (t ? (b + (logx(t, 2.0))) : b)
+#define PLN_LOAD(b, t) (t ? (b * (logx(t, 50.0) < 1.0 ? 1.0 : \
+ logx(t, 50.0))) : b)
/* Work required for building 100% */
#define PLN_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
/* src/lib/subs/aircombat.c */
-extern void ac_planedamage(struct plist *, natid, int, natid, int,
- int, s_char *);
-extern void ac_intercept(struct emp_qelem *, struct emp_qelem *,
- struct emp_qelem *, natid, coord, coord);
extern void ac_combat_headers(natid, natid);
extern void ac_airtoair(struct emp_qelem *, struct emp_qelem *);
-extern void ac_doflak(struct emp_qelem *, struct sctstr *);
-extern void ac_shipflak(struct emp_qelem *, coord, coord);
-extern void ac_landflak(struct emp_qelem *, coord, coord);
-extern void ac_fireflak(struct emp_qelem *, natid, natid, int);
-extern int ac_flak_dam(int);
+extern int ac_flak_dam(int, int, int);
extern void ac_encounter(struct emp_qelem *, struct emp_qelem *, coord,
- coord, s_char *, int, int,
+ coord, char *, int, int,
struct emp_qelem *, struct emp_qelem *);
extern int ac_isflying(struct plnstr *, struct emp_qelem *);
-extern int do_evade(struct emp_qelem *, struct emp_qelem *);
extern void sam_intercept(struct emp_qelem *, struct emp_qelem *,
natid, natid, coord, coord, int);
-extern int all_missiles(struct emp_qelem *);
-extern int can_fly(int);
/* src/lib/subs/aswplnsubs.c */
extern int on_shiplist(short, struct shiplist *);
extern void free_shiplist(struct shiplist **);
extern void print_shiplist(struct shiplist *);
-#endif /* _PLANE_H_ */
+#endif