int orig(void) { char *p; coord x, y; char buf[1024]; int cnum; struct natstr *np; p = getstarg(player->argp[1], "New origin (sector or country) : ", buf); if (!p || !*p) return RET_SYN; if (!isalpha(*p) && strchr(p, ',')) { /* sector */ if (!sarg_xy(p, &x, &y)) { pr("Bad sector designation.\n"); return RET_SYN; } } else if (*p == '~') { /* reset */ if (!player->god) { pr("Only deities can reset their origin.\n"); return RET_FAIL; } x = y = 0; } else { /* country */ cnum = natarg(p, NULL); if (!(np = getnatp(cnum))) return RET_SYN; if (!player->god && relations_with(cnum, player->cnum) != ALLIED) { pr("Country %s is not allied with you!\n", np->nat_cnam); return RET_FAIL; } x = np->nat_xorg; y = np->nat_yorg; } pr("Origin at %s (old system) is now at 0,0 (new system).\n", xyas(x, y, player->cnum)); np = getnatp(player->cnum); np->nat_xorg = x; np->nat_yorg = y; putnat(np); return RET_OK; }
int tele(void) { natid to; struct natstr *natp; char buf[MAXTELSIZE + 1]; /* UTF-8 */ int n; if (*player->argp[0] == 'a') { if (getele("everybody", buf) <= 0) { pr("Announcement aborted\n"); return RET_FAIL; } pr("\n"); to = 0; if (typed_wu(player->cnum, to, buf, TEL_ANNOUNCE) < 0) logerror("tele: typed_wu failed to #%d", to); } else if (*player->argp[0] == 'p') { if (getele("your Gracious Deity", buf) <= 0) { pr("Prayer aborted\n"); return RET_FAIL; } pr("\n"); if (typed_wu(player->cnum, 0, buf, TEL_NORM) < 0) logerror("tele: typed_wu failed to #0"); } else { int kk; kk = 1; do { if ((n = natarg(player->argp[kk], "for which country? ")) < 0) return RET_SYN; to = n; if (kk == 1) { if (player->argp[2]) { if (getele("multiple recipients", buf) < 0) { pr("Telegram aborted\n"); return RET_FAIL; } } else { if (getele(cname(to), buf) < 0) { pr("Telegram aborted\n"); return RET_FAIL; } } pr("\n"); } natp = getnatp(to); if (natp->nat_stat < STAT_SANCT) { pr("%s has no \"telegram privileges\".\n", cname(to)); kk++; continue; } if (!player->god && (getrejects(player->cnum, natp) & REJ_TELE)) { pr("%s is rejecting your telegrams.\n", cname(to)); return RET_SYN; } if (typed_wu(player->cnum, to, buf, TEL_NORM) < 0) { logerror("tele: typed_wu failed to #%d", n); return RET_FAIL; } if (!player->god && natp->nat_stat != STAT_GOD && player->cnum != to) nreport(player->cnum, N_SENT_TEL, to, 1); if (opt_HIDDEN) { setcont(to, player->cnum, FOUND_TELE); } kk++; } while (player->argp[kk] != NULL); } return RET_OK; }
int zdon(void) { int whichcnum; struct natstr *natp; char *p; int checking; int wantupd; int totpop; int totwant; int dowant; char buf[1024]; if (update_demand != UPD_DEMAND_SCHED && update_demand != UPD_DEMAND_ASYNC) { pr("Demand updates are not enabled.\n"); return RET_FAIL; } p = getstarg(player->argp[1], "Want update? [Yes|No|Check] ", buf); if (!p) return RET_SYN; if (*p == 'y' || *p == 'Y') { checking = 0; wantupd = 1; } else if (*p == 'n' || *p == 'N') { checking = 0; wantupd = 0; } else { checking = 1; wantupd = 0; } if (player->god) { whichcnum = natarg(player->argp[2], "for which country? "); if (whichcnum < 0) return RET_SYN; } else whichcnum = player->cnum; if (!(natp = getnatp(whichcnum))) { pr("Unable to find country. %d\n", whichcnum); pr("Notify the Deity.\n"); return RET_FAIL; } if (!checking) { if (wantupd) { if (influx(natp)) { pr("Unable to request an update as the country is in flux\n"); return RET_FAIL; } pr("You (%d) now want an update.\n", whichcnum); } else { pr("You (%d) now DON'T want an update.\n", whichcnum); } natp->nat_update = wantupd; putnat(natp); } dowant = demand_update_want(&totwant, &totpop, whichcnum); if (checking) { if (dowant) { pr("You want an update.\n"); } else pr("You DON'T want an update, yet.\n"); } pr("%d of a total of %d lunatics want an update.\n", totwant, totpop); if (!checking && wantupd && demandupdatecheck()) { pr("Here goes...\n"); update_trigger(); } return RET_OK; }