Clean up output destinations in navigation code
shp_nav() and shp_nav_one_sector() printed both to their actor argument and to ship owner. shp_nav_one_sector()'s use of xyas() looked particularly suspicious: it passed actor, then printed the result to the ship owner. Fortunately, actor and ship owner are the same, since even deities can't navigate foreign ships. Normalize to actor for consistency. While there, rename shp_mess() to shp_stays().
This commit is contained in:
parent
3aca5a701a
commit
db04ba4355
1 changed files with 13 additions and 14 deletions
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
static int shp_check_one_mines(struct ulist *);
|
static int shp_check_one_mines(struct ulist *);
|
||||||
static int shp_hit_mine(struct shpstr *);
|
static int shp_hit_mine(struct shpstr *);
|
||||||
static void shp_mess(char *, struct ulist *);
|
static void shp_stays(natid, char *, struct ulist *);
|
||||||
|
|
||||||
void
|
void
|
||||||
shp_sel(struct nstr_item *ni, struct emp_qelem *list)
|
shp_sel(struct nstr_item *ni, struct emp_qelem *list)
|
||||||
|
@ -122,32 +122,32 @@ shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
||||||
}
|
}
|
||||||
if (opt_SAIL) {
|
if (opt_SAIL) {
|
||||||
if (*ship.shp_path && !update_running) {
|
if (*ship.shp_path && !update_running) {
|
||||||
shp_mess("has a sail path", mlp);
|
shp_stays(actor, "has a sail path", mlp);
|
||||||
mpr(actor, "Use `sail <#> -' to reset\n");
|
mpr(actor, "Use `sail <#> -' to reset\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* check crew - uws don't count */
|
/* check crew - uws don't count */
|
||||||
if (ship.shp_item[I_MILIT] == 0 && ship.shp_item[I_CIVIL] == 0) {
|
if (ship.shp_item[I_MILIT] == 0 && ship.shp_item[I_CIVIL] == 0) {
|
||||||
shp_mess("is crewless", mlp);
|
shp_stays(actor, "is crewless", mlp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!getsect(ship.shp_x, ship.shp_y, §)) {
|
if (!getsect(ship.shp_x, ship.shp_y, §)) {
|
||||||
shp_mess("was sucked into the sky by a strange looking spaceship", mlp); /* heh -KHS */
|
shp_stays(actor, "was sucked into the sky by a strange looking spaceship", mlp); /* heh -KHS */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (shp_check_nav(§, &ship)) {
|
switch (shp_check_nav(§, &ship)) {
|
||||||
case CN_CONSTRUCTION:
|
case CN_CONSTRUCTION:
|
||||||
shp_mess("is caught in a construction zone", mlp);
|
shp_stays(actor, "is caught in a construction zone", mlp);
|
||||||
continue;
|
continue;
|
||||||
case CN_LANDLOCKED:
|
case CN_LANDLOCKED:
|
||||||
shp_mess("is landlocked", mlp);
|
shp_stays(actor, "is landlocked", mlp);
|
||||||
continue;
|
continue;
|
||||||
case CN_NAVIGABLE:
|
case CN_NAVIGABLE:
|
||||||
break;
|
break;
|
||||||
case CN_ERROR:
|
case CN_ERROR:
|
||||||
default:
|
default:
|
||||||
shp_mess("was just swallowed by a big green worm", mlp);
|
shp_stays(actor, "was just swallowed by a big green worm", mlp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -280,12 +280,11 @@ shp_check_mines(struct emp_qelem *ship_list)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shp_mess(char *str, struct ulist *mlp)
|
shp_stays(natid actor, char *str, struct ulist *mlp)
|
||||||
{
|
{
|
||||||
mpr(mlp->unit.ship.shp_own, "%s %s & stays in %s\n",
|
mpr(actor, "%s %s & stays in %s\n",
|
||||||
prship(&mlp->unit.ship),
|
prship(&mlp->unit.ship), str,
|
||||||
str, xyas(mlp->unit.ship.shp_x, mlp->unit.ship.shp_y,
|
xyas(mlp->unit.ship.shp_x, mlp->unit.ship.shp_y, actor));
|
||||||
mlp->unit.ship.shp_own));
|
|
||||||
mlp->unit.ship.shp_mobil = (int)mlp->mobil;
|
mlp->unit.ship.shp_mobil = (int)mlp->mobil;
|
||||||
putship(mlp->unit.ship.shp_uid, &mlp->unit.ship);
|
putship(mlp->unit.ship.shp_uid, &mlp->unit.ship);
|
||||||
emp_remque((struct emp_qelem *)mlp);
|
emp_remque((struct emp_qelem *)mlp);
|
||||||
|
@ -766,13 +765,13 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
mpr(actor, "%s\n", dp);
|
mpr(actor, "%s\n", dp);
|
||||||
return 2;
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
shp_mess(dp, mlp);
|
shp_stays(actor, dp, mlp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mlp->mobil <= 0.0) {
|
if (mlp->mobil <= 0.0) {
|
||||||
shp_mess("is out of mobility", mlp);
|
shp_stays(actor, "is out of mobility", mlp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mobcost = shp_mobcost(&mlp->unit.ship);
|
mobcost = shp_mobcost(&mlp->unit.ship);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue