/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* scut.c: Scuttle ships, planes or land units
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2012
+ * Markus Armbruster, 2004-2014
*/
#include <config.h>
#include "optlist.h"
#include "unit.h"
+static int scuttle_tradeship(struct shpstr *);
+
int
scut(void)
{
if (type == EF_SHIP) {
mp = &mchr[(int)item.ship.shp_type];
if (mp->m_flags & M_TRADE) {
- if (!scuttle_tradeship(&item.ship, 1))
+ if (!scuttle_tradeship(&item.ship))
continue;
}
} else if (type == EF_LAND) {
return RET_OK;
}
-int
-scuttle_tradeship(struct shpstr *sp, int interactive)
+static int
+scuttle_tradeship(struct shpstr *sp)
{
float cash = 0;
float ally_cash = 0;
struct mchrstr *mp;
struct natstr *np;
char buf[512];
- struct natstr *natp;
mp = &mchr[(int)sp->shp_type];
getsect(sp->shp_x, sp->shp_y, §);
dist = mapdist(sp->shp_x, sp->shp_y,
sp->shp_orig_x, sp->shp_orig_y);
/* Don't disclose distance to to pirates */
- if (sp->shp_own == sp->shp_orig_own)
- mpr(sp->shp_own, "%s has gone %d sects\n", prship(sp), dist);
+ if (player->cnum == sp->shp_orig_own)
+ pr("%s has gone %d sects\n", prship(sp), dist);
if (dist < trade_1_dist)
cash = 0;
else if (dist < trade_2_dist)
}
if (!cash && (dist < 0 || sp->shp_own == sp->shp_orig_own)) {
- if (interactive) {
- pr("You won't get any money if you scuttle in %s!",
- xyas(sp->shp_x, sp->shp_y, player->cnum));
- sprintf(buf, "Are you sure you want to scuttle %s? ", prship(sp));
- return confirm(buf);
- } else
- return 0;
+ pr("You won't get any money if you scuttle in %s!",
+ xyas(sp->shp_x, sp->shp_y, player->cnum));
+ sprintf(buf, "Are you sure you want to scuttle %s? ", prship(sp));
+ return confirm(buf);
}
- if (interactive) {
- player->dolcost -= cash;
- } else {
- natp = getnatp(sp->shp_own);
- natp->nat_money += cash;
- putnat(natp);
- wu(0, sp->shp_own, "You just made $%d.\n", (int)cash);
- }
+ player->dolcost -= cash;
if (ally_cash) {
np = getnatp(sect.sct_own);