/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
*
* Known contributors to this file:
* Steve McClure, 2000
- * Markus Armbruster, 2006-2011
+ * Markus Armbruster, 2006-2016
*/
#include <config.h>
static int tran_nmap(coord, coord, char *, char *);
static int tran_nuke(void);
static int tran_plane(void);
+static int pln_weight(struct plnstr *);
int
-tran(void)
+c_transport(void)
{
char *what;
char buf[1024];
coord dstx, dsty;
int mcost;
int weight, count;
- int type, dam;
+ int dam;
struct nstr_item nstr;
struct plnstr plane;
struct sctstr sect;
while (nxtitem(&nstr, &plane)) {
if (!player->owner)
continue;
- type = plane.pln_type;
if (plane.pln_ship >= 0) {
pr("%s is stowed on ship #%d, and can't be transported\n",
prplane(&plane), plane.pln_ship);
return RET_FAIL;
}
}
- weight += plchr[type].pl_lcm + (plchr[type].pl_hcm * 2);
+ weight += pln_weight(&plane);
++count;
}
if (count == 0) {
return RET_OK;
}
+static int
+pln_weight(struct plnstr *pp)
+{
+ int w, i;
+
+ w = 0;
+ for (i = I_NONE + 1; i <= I_MAX; i++)
+ w += plchr[pp->pln_type].pl_mat[i] * ichr[i].i_lbs;
+ return w;
+}
+
/*
* Pretty tacky, but it works.
* If more commands start doing this, then