Remove option TRADESHIPS, customize table ship-chr instead

Trade ships are now enabled when a ship type with capability trade
exists.  No such type exists by default; to enable trade ships,
deities have to customize table ship-chr.

Before, trade ship types were ignored when option TRADESHIPS was
disabled.  Except for xdump ship-chr, which happily dumped unusable
trade ship types.
This commit is contained in:
Markus Armbruster 2011-05-22 16:49:17 +02:00
parent c4254764bf
commit 352bc320d2
19 changed files with 32 additions and 41 deletions

View file

@ -33,7 +33,7 @@
* Ken Stevens
* Steve McClure
* Ron Koenderink, 2005-2006
* Markus Armbruster, 2005-2010
* Markus Armbruster, 2005-2011
*/
#include <config.h>
@ -44,6 +44,7 @@
#include "ship.h"
#include "version.h"
static int have_trade_ships(void);
static void show_custom(void);
static void show_opts(int val);
static char *prwrap(char *, char *, int *);
@ -156,7 +157,7 @@ vers(void)
-(etu_per_update / sect_mob_neg_factor));
pr("\n");
pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
if (opt_TRADESHIPS) {
if (have_trade_ships()) {
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
trade_1_dist, trade_1 * 100.0);
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",
@ -231,6 +232,18 @@ vers(void)
return RET_OK;
}
static int
have_trade_ships(void)
{
int i;
for (i = ef_nelem(EF_SHIP_CHR) - 1; i >= 0; i--) {
if (mchr[i].m_flags & M_TRADE)
return 1;
}
return 0;
}
static void
show_custom(void)
{