static void
noise(struct sctstr *sptr, char *name, int old, int new)
{
- pr("%s of %s changed from %d to %d\n",
- name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
- if (sptr->sct_own && sptr->sct_own != player->cnum && new != old)
- wu(0, sptr->sct_own,
- "%s in %s was changed from %d to %d by an act of %s\n",
- name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
- old, new, cname(player->cnum));
- benefit(sptr->sct_own, new - old);
+ divine_sct_change(sptr, name, new != old, new - old,
+ "from %d to %d", old, new);
}
static void
case 'o':
if (arg < 0 || arg >= MAXNOC)
return RET_SYN;
- pr("Owner of %s changed from %s to %s.\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- prnatid(sect->sct_own), prnatid(arg));
+ divine_sct_change_quiet(sect, "Owner", arg != sect->sct_own,
+ "from %s to %s",
+ prnatid(sect->sct_own), prnatid(arg));
if (arg == sect->sct_own)
break;
report_god_takes("Sector ",
case 'O':
if (arg < 0 || arg >= MAXNOC)
return RET_SYN;
- pr("Old owner of %s changed from %s to %s.\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- prnatid(sect->sct_oldown), prnatid(arg));
- if (arg == sect->sct_oldown)
- break;
- if (sect->sct_own && sect->sct_own != player->cnum)
- wu(0, sect->sct_own,
- "Old owner of %s changed from %s to %s by an act of %s\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- prnatid(sect->sct_oldown), prnatid(arg),
- cname(player->cnum));
+ divine_sct_change(sect, "Old owner", arg != sect->sct_oldown, 0,
+ "from %s to %s",
+ prnatid(sect->sct_oldown), prnatid(arg));
sect->sct_oldown = arg;
break;
case 'e':
break;
case 'l':
new = LIMIT_TO(arg, 0, 127);
- pr("Loyalty of %s changed from %d to %d\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- sect->sct_loyal, new);
+ divine_sct_change_quiet(sect, "Loyalty", new != sect->sct_loyal,
+ "from %d to %d", sect->sct_loyal, new);
sect->sct_loyal = (unsigned char)new;
break;
case 'x':
new = LIMIT_TO(arg, 0, CHE_MAX);
- pr("Guerillas in %s changed from %d to %d\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- sect->sct_che, new);
+ divine_sct_change_quiet(sect, "Guerillas", new != sect->sct_che,
+ "from %d to %d", sect->sct_che, new);
sect->sct_che = new;
break;
case 'X':
if (arg < 0 || arg >= MAXNOC)
return RET_SYN;
- pr("Che target of %s changed from %s to %s.\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- prnatid(sect->sct_che_target), prnatid(arg));
+ divine_sct_change_quiet(sect, "Che target",
+ arg != sect->sct_che_target,
+ "from %s to %s",
+ prnatid(sect->sct_che_target),
+ prnatid(arg));
sect->sct_che_target = arg;
if (arg == 0)
sect->sct_che = 0;
break;
case 'p':
new = LIMIT_TO(arg, 0, PLG_EXPOSED);
- pr("Plague stage of %s changed from %d to %d\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- sect->sct_pstage, new);
+ divine_sct_change_quiet(sect, "Plague stage",
+ new != sect->sct_pstage,
+ "from %d to %d", sect->sct_pstage, new);
sect->sct_pstage = new;
break;
case 't':
new = LIMIT_TO(arg, 0, 32767);
- pr("Plague time of %s changed from %d to %d\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- sect->sct_ptime, new);
+ divine_sct_change_quiet(sect, "Plague time",
+ new != sect->sct_ptime,
+ "from %d to %d", sect->sct_ptime, new);
sect->sct_ptime = new;
break;
case 'F':
if (sect->sct_own == sect->sct_oldown)
noise(sect, "Mines", sect->sct_mines, new);
else
- pr("Mines of %s changed from %d to %d\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- sect->sct_mines, new);
+ divine_sct_change_quiet(sect, "Mines", new != sect->sct_mines,
+ "from %d to %d", sect->sct_mines, new);
sect->sct_mines = new;
break;
case 'R':
case 'L':
if (!sarg_xy(p, &newx, &newy))
return RET_SYN;
+ if (newx == sect->sct_x && newy == sect->sct_y) {
+ pr("Sector %s unchanged\n", xyas(newx, newy, player->cnum));
+ break;
+ }
getsect(newx, newy, &newsect);
pr("Sector %s duplicated to %s\n",
xyas(sect->sct_x, sect->sct_y, player->cnum),
sect->sct_own);
sect->sct_x = newx;
sect->sct_y = newy;
- ef_set_uid(EF_SECTOR, §, XYOFFSET(newx, newy));
+ ef_set_uid(EF_SECTOR, sect, XYOFFSET(newx, newy));
break;
case 'D':
if (!sarg_xy(p, &newx, &newy))
return RET_SYN;
- pr("Distribution sector of sector %s changed from %s to %s\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
- xyas(newx, newy, player->cnum));
+ divine_sct_change_quiet(sect, "Distribution sector",
+ newx != sect->sct_dist_x || newy != sect->sct_dist_y,
+ "from %s to %s",
+ xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
+ xyas(newx, newy, player->cnum));
if (newx == sect->sct_dist_x && newy == sect->sct_dist_y)
break;
if (sect->sct_own && sect->sct_own != player->cnum)
wu(0, sect->sct_own,
- "Distribution sector of sector %s changed from %s to %s"
+ "Distribution sector of %s changed from %s to %s"
" by an act of %s\n",
xyas(sect->sct_x, sect->sct_y, player->cnum),
xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum),
new = sct_typematch(p);
if (new < 0)
return RET_SYN;
- pr("Designation of sector %s changed from %c to %c\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- dchr[sect->sct_type].d_mnem, dchr[new].d_mnem);
- if (new == sect->sct_type)
- break;
- if (sect->sct_own && sect->sct_own != player->cnum)
- wu(0, sect->sct_own,
- "Designation of sector %s changed from %c to %c"
- " by an act of %s\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- dchr[sect->sct_type].d_mnem, dchr[new].d_mnem,
- cname(player->cnum));
+ divine_sct_change(sect, "Designation",
+ new != sect->sct_type, 0, "from %c to %c",
+ dchr[sect->sct_type].d_mnem, dchr[new].d_mnem);
set_coastal(sect, sect->sct_type, new);
sect->sct_type = new;
break;
new = sct_typematch(p);
if (new < 0)
return RET_SYN;
- pr("New designation of sector %s changed from %c to %c\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- dchr[sect->sct_newtype].d_mnem, dchr[new].d_mnem);
- if (new == sect->sct_newtype)
- break;
- if (sect->sct_own && sect->sct_own != player->cnum)
- wu(0, sect->sct_own,
- "New designation of sector %s changed from %c to %c"
- " by an act of %s\n",
- xyas(sect->sct_x, sect->sct_y, player->cnum),
- dchr[sect->sct_newtype].d_mnem, dchr[new].d_mnem,
- cname(player->cnum));
+ divine_sct_change(sect, "New designation",
+ new != sect->sct_newtype, 0, "from %c to %c",
+ dchr[sect->sct_newtype].d_mnem, dchr[new].d_mnem);
sect->sct_newtype = new;
break;
default:
case 'r':
ip = item_by_name(key);
arg = LIMIT_TO(arg, 0, mchr[ship->shp_type].m_item[ip->i_uid]);
+ divine_unit_change_quiet((struct empobj *)ship, ip->i_name,
+ arg != ship->shp_item[ip->i_uid],
+ "from %d to %d",
+ ship->shp_item[ip->i_uid], arg);
+ report_divine_gift(ship->shp_own, ip,
+ arg - ship->shp_item[ip->i_uid], prship(ship));
ship->shp_item[ip->i_uid] = arg;
break;
default:
case 'r':
ip = item_by_name(key);
arg = LIMIT_TO(arg, 0, lchr[land->lnd_type].l_item[ip->i_uid]);
+ divine_unit_change_quiet((struct empobj *)land, ip->i_name,
+ arg != land->lnd_item[ip->i_uid],
+ "from %d to %d",
+ land->lnd_item[ip->i_uid], arg);
+ report_divine_gift(land->lnd_own, ip,
+ arg - land->lnd_item[ip->i_uid], prland(land));
land->lnd_item[ip->i_uid] = arg;
break;
default: