/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* setsect.c: Give resources to a country
- *
+ *
* Known contributors to this file:
* David Muir Sharnoff
* Steve McClure, 1998
*/
-#include <stdio.h>
-#include <ctype.h>
-#include "misc.h"
-#include "player.h"
-#include "var.h"
-#include "xy.h"
-#include "sect.h"
-#include "nat.h"
-#include "news.h"
-#include "nsc.h"
-#include "item.h"
-#include "file.h"
+#include <config.h>
+
#include "commands.h"
+#include "lost.h"
+#include "news.h"
#include "optlist.h"
setsector(void)
{
struct sctstr sect;
- s_char *what;
+ char *what;
int amt, current;
- s_char *p;
+ char *p;
struct nstr_sect nstr;
- s_char buf[1024];
- s_char char0, char1;
+ char buf[1024];
+ char char0, char1;
if ((what = getstarg(player->argp[1],
- "Give What (iron, gold, oil, uranium, fertility, owner, eff., Mob., Work, Avail., oldown, mines)? ",
+ "Give What (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
buf)) == 0)
return RET_SYN;
char0 = what[0];
if (sect.sct_own != 0)
resnoise(§, 1, "Iron ore content",
(int)sect.sct_min, current);
- sect.sct_min = (u_char)current;
+ sect.sct_min = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Gold content",
(int)sect.sct_gmin, current);
- sect.sct_gmin = (u_char)current;
+ sect.sct_gmin = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Oil content",
(int)sect.sct_oil, current);
- sect.sct_oil = (u_char)current;
+ sect.sct_oil = (unsigned char)current;
putsect(§);
}
break;
wu(player->cnum, amt,
"Sector %s gained from deity intervention\n",
xyas(sect.sct_x, sect.sct_y, amt));
- makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x,
- sect.sct_y);
- makenotlost(EF_SECTOR, amt, 0, sect.sct_x, sect.sct_y);
-
sect.sct_own = (natid)amt;
putsect(§);
}
current = 100;
pr("Efficiency in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
- sect.sct_effic = (u_char)current;
+ sect.sct_effic = (unsigned char)current;
putsect(§);
}
break;
if (!snxtsct(&nstr, player->argp[2]))
return RET_SYN;
while (nxtsct(&nstr, §) > 0) {
- int mines;
-
if (!(p = getstarg(player->argp[3], "What value : ", buf))
|| (*p == '\0'))
return RET_SYN;
amt = atoi(p);
- mines = getvar(V_MINE, (s_char *)§, EF_SECTOR);
- current = mines;
+ current = sect.sct_mines;
current += amt;
if (current < 0)
current = 0;
+ if (current > MINES_MAX)
+ current = MINES_MAX;
if (sect.sct_own != 0)
- resnoise(§, 1, "Mines", (int)mines, current);
- putvar(V_MINE, current, (s_char *)§, EF_SECTOR);
+ resnoise(§, 1, "Mines", sect.sct_mines, current);
+ sect.sct_mines = current;
putsect(§);
}
break;
current = 100;
pr("Work in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
- sect.sct_work = (u_char)current;
+ sect.sct_work = (unsigned char)current;
putsect(§);
}
break;
current += amt;
if (current < 0)
current = 0;
- if (current > 120)
- current = 120;
+ if (current > 100)
+ current = 100;
if (sect.sct_own != 0)
resnoise(§, 1, "Fertility content",
(int)sect.sct_fertil, current);
- sect.sct_fertil = (u_char)current;
+ sect.sct_fertil = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Uranium content",
(int)sect.sct_uran, current);
- sect.sct_uran = (u_char)current;
+ sect.sct_uran = (unsigned char)current;
putsect(§);
}
break;
}
void
-resnoise(struct sctstr *sptr, int public_amt, s_char *name, int old,
+resnoise(struct sctstr *sptr, int public_amt, char *name, int old,
int new)
{
- s_char p[100];
+ char p[100];
- pr("%s of %s changed from %d to %d%%\n",
+ pr("%s of %s changed from %d to %d\n",
name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
if (public_amt)
(void)sprintf(p, "changed from %d to %d", old, new);