00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #include <config.h>
00054
00055 #include "commands.h"
00056 #include "optlist.h"
00057 #include "server.h"
00058
00059 int
00060 zdon(void)
00061 {
00062 natid whichcnum;
00063 struct natstr *natp;
00064 char *p;
00065
00066 int checking;
00067 int wantupd;
00068 int totpop;
00069 int totwant;
00070 int dowant;
00071 char buf[1024];
00072
00073 if (update_demand != UPD_DEMAND_SCHED
00074 && update_demand != UPD_DEMAND_ASYNC) {
00075 pr("Demand updates are not enabled.\n");
00076 return RET_FAIL;
00077 }
00078 whichcnum = player->cnum;
00079 p = NULL;
00080 if (player->god) {
00081
00082 whichcnum = onearg(player->argp[1], "Which country no.? ");
00083 if ((whichcnum > 0) && (getnatp(whichcnum)))
00084 p = getstarg(player->argp[2], "Want update? [Yes|No|Check] ",
00085 buf);
00086 } else {
00087 p = getstarg(player->argp[1], "Want update? [Yes|No|Check] ", buf);
00088 }
00089 if (player->aborted)
00090 return RET_FAIL;
00091
00092 checking = 1;
00093 wantupd = 0;
00094 if (p) {
00095 if (*p == 'y' || *p == 'Y') {
00096 checking = 0;
00097 wantupd = 1;
00098 } else if (*p == 'n' || *p == 'N') {
00099 checking = 0;
00100 wantupd = 0;
00101 }
00102 }
00103
00104 if (!(natp = getnatp(whichcnum))) {
00105 pr("Unable to find country. %d\n", whichcnum);
00106 pr("Notify the Deity.\n");
00107 return RET_FAIL;
00108 }
00109 if (!checking) {
00110 if (wantupd) {
00111 if (influx(natp)) {
00112 pr("Unable to request an update as the country is in flux\n");
00113 return RET_FAIL;
00114 }
00115 pr("You (%d) now want an update.\n", whichcnum);
00116 } else {
00117 pr("You (%d) now DON'T want an update.\n", whichcnum);
00118 }
00119 natp->nat_update = wantupd;
00120 putnat(natp);
00121 }
00122
00123 dowant = demand_update_want(&totwant, &totpop, whichcnum);
00124 if (checking) {
00125 if (dowant) {
00126 pr("You want an update.\n");
00127 } else
00128 pr("You DON'T want an update, yet.\n");
00129 }
00130
00131 pr("%d of a total of %d lunatics want an update.\n", totwant, totpop);
00132
00133 if (!checking && wantupd && demandupdatecheck()) {
00134 pr("Here goes...\n");
00135 update_trigger();
00136 }
00137 return RET_OK;
00138 }