/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
int
thre(void)
{
- extern struct ichrstr *whatitem();
- struct sctstr sect;
- struct nstr_sect nstr;
- int val;
- struct ichrstr *ip;
- s_char *p;
- int thresh;
- int type;
- s_char prompt[128];
- s_char buf[128];
-
+ struct sctstr sect;
+ struct nstr_sect nstr;
+ int val;
+ struct ichrstr *ip;
+ s_char *p;
+ int thresh;
+ int type;
+ s_char prompt[128];
+ s_char buf[128];
+
if ((ip = whatitem(player->argp[1], "What commodity? ")) == 0)
return RET_SYN;
if (!snxtsct(&nstr, player->argp[2]))
return RET_SYN;
- type = V_DIST(ip->i_vtype & (~VT_TYPE));
+ type = ip->i_vtype;
if (player->argp[3] && *player->argp[3] &&
(*player->argp[3] < '0' || *player->argp[3] > '9')) {
- pr ("Threshold must be a number\n");
+ pr("Threshold must be a number\n");
return RET_SYN;
}
while (!player->aborted && nxtsct(&nstr, §)) {
if (!player->owner)
continue;
- val = getvar(type, (s_char *)§, EF_SECTOR);
+ val = sect.sct_dist[type];
if (val > 0)
sprintf(prompt, "%s %s old threshold %d new? ",
xyas(nstr.x, nstr.y, player->cnum),
if (*p == '\0' || *p == '-')
continue;
thresh = atoi(p);
- if (thresh > 10000)
- thresh = 10000;
+ if (thresh > ITEM_MAX)
+ thresh = ITEM_MAX;
if ((val > 0) && (val == thresh)) {
pr("%s threshold unchanged (left at %d)\n",
xyas(nstr.x, nstr.y, player->cnum), val);
}
if (val > 0 && (player->argp[3] != 0 && *player->argp[3] != 0))
pr("%s old threshold %d\n",
- xyas(nstr.x, nstr.y, player->cnum),
- val);
- if (putvar(type, thresh, (s_char *)§, EF_SECTOR) < 0)
- pr("No room for threshold in %s\n",
- xyas(nstr.x, nstr.y, player->cnum));
+ xyas(nstr.x, nstr.y, player->cnum), val);
+ sect.sct_dist[type] = thresh;
putsect(§);
}
return RET_OK;