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:
parent
c4254764bf
commit
352bc320d2
19 changed files with 32 additions and 41 deletions
|
@ -129,11 +129,8 @@ buil(void)
|
|||
break;
|
||||
case 's':
|
||||
type = ef_elt_byname(EF_SHIP_CHR, p);
|
||||
if (type >= 0) {
|
||||
if (type >= 0)
|
||||
rqtech = mchr[type].m_tech;
|
||||
if ((mchr[type].m_flags & M_TRADE) && !opt_TRADESHIPS)
|
||||
type = -1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
type = ef_elt_byname(EF_LAND_CHR, p);
|
||||
|
|
|
@ -131,12 +131,7 @@ orde(void)
|
|||
if (!*p || !strcmp(p, "-")) {
|
||||
pr("A one-way order has been accepted.\n");
|
||||
} else if (!strncmp(p, "s", 1)) {
|
||||
if (opt_TRADESHIPS) {
|
||||
if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
|
||||
pr("You can't auto-scuttle that ship!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
} else {
|
||||
if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
|
||||
pr("You can't auto-scuttle that ship!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
|
|
|
@ -47,10 +47,6 @@ payo(void)
|
|||
int dist;
|
||||
float cash = 0.0;
|
||||
|
||||
if (!opt_TRADESHIPS) {
|
||||
pr("Tradeships are not enabled.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
if (!snxtitem(&ni, EF_SHIP, player->argp[1], NULL))
|
||||
return RET_SYN;
|
||||
|
||||
|
|
|
@ -143,8 +143,7 @@ scra(void)
|
|||
prship(&item.ship));
|
||||
continue;
|
||||
}
|
||||
if (opt_TRADESHIPS
|
||||
&& (mchr[item.ship.shp_type].m_flags & M_TRADE)) {
|
||||
if (mchr[item.ship.shp_type].m_flags & M_TRADE) {
|
||||
pr("WARNING: You only collect money from trade ships if you \"scuttle\" them!\n");
|
||||
sprintf(prompt,
|
||||
"Are you really sure that you want to scrap %s (n)? ",
|
||||
|
|
|
@ -125,7 +125,7 @@ scut(void)
|
|||
|
||||
if (type == EF_SHIP) {
|
||||
mp = &mchr[(int)item.ship.shp_type];
|
||||
if (opt_TRADESHIPS && (mp->m_flags & M_TRADE)) {
|
||||
if (mp->m_flags & M_TRADE) {
|
||||
if (!scuttle_tradeship(&item.ship, 1))
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue