Reorder function definitions.
This commit is contained in:
parent
0e11700d12
commit
abc14df544
1 changed files with 76 additions and 76 deletions
|
@ -55,82 +55,6 @@ union item_u {
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
|
||||||
scuttle_tradeship(struct shpstr *sp, int interactive)
|
|
||||||
{
|
|
||||||
float cash = 0;
|
|
||||||
float ally_cash = 0;
|
|
||||||
int dist;
|
|
||||||
struct sctstr sect;
|
|
||||||
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, §);
|
|
||||||
if (sect.sct_own && sect.sct_type == SCT_HARBR) {
|
|
||||||
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) {
|
|
||||||
if (interactive)
|
|
||||||
pr("%s has gone %d sects\n", prship(sp), dist);
|
|
||||||
else
|
|
||||||
wu(0, sp->shp_own, "%s has gone %d sects\n",
|
|
||||||
prship(sp), dist);
|
|
||||||
}
|
|
||||||
if (dist < trade_1_dist)
|
|
||||||
cash = 0;
|
|
||||||
else if (dist < trade_2_dist)
|
|
||||||
cash = (1.0 + trade_1 * ((float)dist));
|
|
||||||
else if (dist < trade_3_dist)
|
|
||||||
cash = (1.0 + trade_2 * ((float)dist));
|
|
||||||
else
|
|
||||||
cash = (1.0 + trade_3 * ((float)dist));
|
|
||||||
cash *= mp->m_cost;
|
|
||||||
cash *= (((float)sp->shp_effic) / 100.0);
|
|
||||||
|
|
||||||
if (sect.sct_own != sp->shp_own) {
|
|
||||||
ally_cash = cash * trade_ally_cut;
|
|
||||||
cash *= (1.0 + trade_ally_bonus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!interactive && cash) {
|
|
||||||
natp = getnatp(sp->shp_own);
|
|
||||||
natp->nat_money += cash;
|
|
||||||
putnat(natp);
|
|
||||||
wu(0, sp->shp_own, "You just made $%d.\n", (int)cash);
|
|
||||||
} else if (!cash && !interactive) {
|
|
||||||
wu(0, sp->shp_own, "Unfortunately, you make $0 on this trade.\n");
|
|
||||||
} else if (cash && interactive) {
|
|
||||||
player->dolcost -= cash;
|
|
||||||
} else if (interactive && sp->shp_own == sp->shp_orig_own) {
|
|
||||||
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 (ally_cash) {
|
|
||||||
np = getnatp(sect.sct_own);
|
|
||||||
np->nat_money += ally_cash;
|
|
||||||
putnat(np);
|
|
||||||
wu(0, sect.sct_own,
|
|
||||||
"Trade with %s nets you $%d at %s\n",
|
|
||||||
cname(sp->shp_own),
|
|
||||||
(int)ally_cash, xyas(sect.sct_x, sect.sct_y, sect.sct_own));
|
|
||||||
if (sp->shp_own != sp->shp_orig_own)
|
|
||||||
nreport(sp->shp_own, N_PIRATE_TRADE, sp->shp_orig_own, 1);
|
|
||||||
else
|
|
||||||
nreport(sp->shp_own, N_TRADE, sect.sct_own, 1);
|
|
||||||
} else if (sp->shp_own != sp->shp_orig_own)
|
|
||||||
nreport(sp->shp_own, N_PIRATE_KEEP, sp->shp_orig_own, 1);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
scut(void)
|
scut(void)
|
||||||
{
|
{
|
||||||
|
@ -252,6 +176,82 @@ scut(void)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
scuttle_tradeship(struct shpstr *sp, int interactive)
|
||||||
|
{
|
||||||
|
float cash = 0;
|
||||||
|
float ally_cash = 0;
|
||||||
|
int dist;
|
||||||
|
struct sctstr sect;
|
||||||
|
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, §);
|
||||||
|
if (sect.sct_own && sect.sct_type == SCT_HARBR) {
|
||||||
|
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) {
|
||||||
|
if (interactive)
|
||||||
|
pr("%s has gone %d sects\n", prship(sp), dist);
|
||||||
|
else
|
||||||
|
wu(0, sp->shp_own, "%s has gone %d sects\n",
|
||||||
|
prship(sp), dist);
|
||||||
|
}
|
||||||
|
if (dist < trade_1_dist)
|
||||||
|
cash = 0;
|
||||||
|
else if (dist < trade_2_dist)
|
||||||
|
cash = (1.0 + trade_1 * ((float)dist));
|
||||||
|
else if (dist < trade_3_dist)
|
||||||
|
cash = (1.0 + trade_2 * ((float)dist));
|
||||||
|
else
|
||||||
|
cash = (1.0 + trade_3 * ((float)dist));
|
||||||
|
cash *= mp->m_cost;
|
||||||
|
cash *= (((float)sp->shp_effic) / 100.0);
|
||||||
|
|
||||||
|
if (sect.sct_own != sp->shp_own) {
|
||||||
|
ally_cash = cash * trade_ally_cut;
|
||||||
|
cash *= (1.0 + trade_ally_bonus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!interactive && cash) {
|
||||||
|
natp = getnatp(sp->shp_own);
|
||||||
|
natp->nat_money += cash;
|
||||||
|
putnat(natp);
|
||||||
|
wu(0, sp->shp_own, "You just made $%d.\n", (int)cash);
|
||||||
|
} else if (!cash && !interactive) {
|
||||||
|
wu(0, sp->shp_own, "Unfortunately, you make $0 on this trade.\n");
|
||||||
|
} else if (cash && interactive) {
|
||||||
|
player->dolcost -= cash;
|
||||||
|
} else if (interactive && sp->shp_own == sp->shp_orig_own) {
|
||||||
|
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 (ally_cash) {
|
||||||
|
np = getnatp(sect.sct_own);
|
||||||
|
np->nat_money += ally_cash;
|
||||||
|
putnat(np);
|
||||||
|
wu(0, sect.sct_own,
|
||||||
|
"Trade with %s nets you $%d at %s\n",
|
||||||
|
cname(sp->shp_own),
|
||||||
|
(int)ally_cash, xyas(sect.sct_x, sect.sct_y, sect.sct_own));
|
||||||
|
if (sp->shp_own != sp->shp_orig_own)
|
||||||
|
nreport(sp->shp_own, N_PIRATE_TRADE, sp->shp_orig_own, 1);
|
||||||
|
else
|
||||||
|
nreport(sp->shp_own, N_TRADE, sect.sct_own, 1);
|
||||||
|
} else if (sp->shp_own != sp->shp_orig_own)
|
||||||
|
nreport(sp->shp_own, N_PIRATE_KEEP, sp->shp_orig_own, 1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
scuttle_ship(struct shpstr *sp)
|
scuttle_ship(struct shpstr *sp)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue