(move): test command checked start sector for space and some other
things instead of end sector. (move): test command now skips code dealing with return of goods to start sector. (want_to_abandon): Simplify.
This commit is contained in:
parent
a508a4c6e7
commit
681a803ef6
1 changed files with 43 additions and 34 deletions
|
@ -133,7 +133,11 @@ move(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (amount > amt_src) {
|
if (amount > amt_src) {
|
||||||
if (istest) {
|
if (istest) {
|
||||||
pr("Note: there are actually only %d %s in %s,\nbut the test will be made for %d %s as you requested.\n", amt_src, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum), amount, ip->i_name);
|
pr("Note: there are actually only %d %s in %s,\n"
|
||||||
|
"but the test will be made for %d %s as you requested.\n",
|
||||||
|
amt_src, ip->i_name,
|
||||||
|
xyas(sect.sct_x, sect.sct_y, player->cnum),
|
||||||
|
amount, ip->i_name);
|
||||||
} else {
|
} else {
|
||||||
amount = amt_src;
|
amount = amt_src;
|
||||||
pr("Only moving %d.\n", amount);
|
pr("Only moving %d.\n", amount);
|
||||||
|
@ -152,8 +156,9 @@ move(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
packing = sect.sct_effic >= 60 ? dchr[sect.sct_type].d_pkg : IPKG;
|
packing = sect.sct_effic >= 60 ? dchr[sect.sct_type].d_pkg : IPKG;
|
||||||
weight = (double)amount * ip->i_lbs / ip->i_pkg[packing];
|
weight = (double)amount * ip->i_lbs / ip->i_pkg[packing];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First remove commodities from source sector
|
* First remove stuff from source sector
|
||||||
*/
|
*/
|
||||||
if (!istest) {
|
if (!istest) {
|
||||||
getsect(x, y, &start);
|
getsect(x, y, &start);
|
||||||
|
@ -189,7 +194,10 @@ move(void)
|
||||||
left = commdamage(amount, dam, ip->i_vtype);
|
left = commdamage(amount, dam, ip->i_vtype);
|
||||||
if (left < amount) {
|
if (left < amount) {
|
||||||
if (left) {
|
if (left) {
|
||||||
pr("%d of the %s you were moving were destroyed!\nOnly %d %s made it to %s\n", amount - left, ip->i_name, left, ip->i_name, xyas(endsect.sct_x, endsect.sct_y, player->cnum));
|
pr("%d of the %s you were moving were destroyed!\n"
|
||||||
|
"Only %d %s made it to %s\n",
|
||||||
|
amount - left, ip->i_name, left, ip->i_name,
|
||||||
|
xyas(endsect.sct_x, endsect.sct_y, player->cnum));
|
||||||
} else {
|
} else {
|
||||||
pr("All of the %s you were moving were destroyed!\n",
|
pr("All of the %s you were moving were destroyed!\n",
|
||||||
ip->i_name);
|
ip->i_name);
|
||||||
|
@ -209,20 +217,22 @@ move(void)
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
sect.sct_mobil = (u_char)mob;
|
sect.sct_mobil = (u_char)mob;
|
||||||
left = mob;
|
left = mob;
|
||||||
} else if (!istest) {
|
} else {
|
||||||
/*
|
if (!istest) {
|
||||||
* decrement mobility appropriately.
|
/*
|
||||||
*/
|
* Decrement mobility appropriately.
|
||||||
getsect(x, y, &start);
|
*/
|
||||||
mob = start.sct_mobil;
|
getsect(x, y, &start);
|
||||||
if (mob < mcost) {
|
mob = start.sct_mobil;
|
||||||
if (mob > 0)
|
if (mob < mcost) {
|
||||||
mob = 0;
|
if (mob > 0)
|
||||||
} else
|
mob = 0;
|
||||||
mob -= mcost;
|
} else
|
||||||
start.sct_mobil = (u_char)mob;
|
mob -= mcost;
|
||||||
left = start.sct_mobil;
|
start.sct_mobil = (u_char)mob;
|
||||||
putsect(&start);
|
left = start.sct_mobil;
|
||||||
|
putsect(&start);
|
||||||
|
}
|
||||||
getsect(endsect.sct_x, endsect.sct_y, §);
|
getsect(endsect.sct_x, endsect.sct_y, §);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,9 +258,11 @@ move(void)
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!istest)
|
if (istest)
|
||||||
pr("%d mob left in %s\n", left,
|
return RET_OK;
|
||||||
xyas(start.sct_x, start.sct_y, player->cnum));
|
|
||||||
|
pr("%d mob left in %s\n", left,
|
||||||
|
xyas(start.sct_x, start.sct_y, player->cnum));
|
||||||
|
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
getsect(x, y, &start);
|
getsect(x, y, &start);
|
||||||
|
@ -259,10 +271,12 @@ move(void)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the sector that things are going to is no longer
|
/*
|
||||||
owned by the player, and was the starting sector,
|
* If the sector that things are going to is no longer owned by
|
||||||
try to find somewhere to dump the stuff. If nowhere
|
* the player, and it was the starting sector, try to find
|
||||||
to dump it, it disappears. */
|
* somewhere to dump the stuff. If nowhere to dump it, it
|
||||||
|
* disappears.
|
||||||
|
*/
|
||||||
if (sect.sct_own != player->cnum && sect.sct_x == x && sect.sct_y == y) {
|
if (sect.sct_own != player->cnum && sect.sct_x == x && sect.sct_y == y) {
|
||||||
pr("Can't return the goods, since the starting point is no longer\n");
|
pr("Can't return the goods, since the starting point is no longer\n");
|
||||||
pr("owned by you.\n");
|
pr("owned by you.\n");
|
||||||
|
@ -303,8 +317,6 @@ move(void)
|
||||||
amount = ITEM_MAX - amt_dst;
|
amount = ITEM_MAX - amt_dst;
|
||||||
pr("Only room for %d, the rest were lost.\n", amount);
|
pr("Only room for %d, the rest were lost.\n", amount);
|
||||||
}
|
}
|
||||||
if (istest)
|
|
||||||
return RET_OK;
|
|
||||||
sect.sct_item[vtype] = amount + amt_dst;
|
sect.sct_item[vtype] = amount + amt_dst;
|
||||||
/*
|
/*
|
||||||
* Now add commodities to destination sector,
|
* Now add commodities to destination sector,
|
||||||
|
@ -350,20 +362,17 @@ want_to_abandon(struct sctstr *sp, i_type vtype, int amnt, struct lndstr *lp)
|
||||||
{
|
{
|
||||||
char prompt[80];
|
char prompt[80];
|
||||||
|
|
||||||
/* First, would we be abandoning it? If not, just return that it's
|
/*
|
||||||
ok to move out */
|
* First, would we be abandoning it? If not, just return that
|
||||||
|
* it's ok to move out.
|
||||||
|
*/
|
||||||
if (!would_abandon(sp, vtype, amnt, lp))
|
if (!would_abandon(sp, vtype, amnt, lp))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
sprintf(prompt, "Do you really want to abandon %s [yn]? ",
|
sprintf(prompt, "Do you really want to abandon %s [yn]? ",
|
||||||
xyas(sp->sct_x, sp->sct_y, player->cnum));
|
xyas(sp->sct_x, sp->sct_y, player->cnum));
|
||||||
|
|
||||||
/* now, if they say yes that it's ok, just return 1 */
|
return askyn(prompt);
|
||||||
if (askyn(prompt))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* Nope, not ok */
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue