(new): Simplify using new natargp().
(new): Use RET_OK instead of literal 0. (new, isok, ok): s_char purge.
This commit is contained in:
parent
402c47b66e
commit
35941f97eb
1 changed files with 10 additions and 12 deletions
|
@ -49,7 +49,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
static int isok(int x, int y);
|
static int isok(int x, int y);
|
||||||
static void ok(s_char *map, int x, int y);
|
static void ok(signed char *map, int x, int y);
|
||||||
|
|
||||||
static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
|
static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
|
||||||
|
|
||||||
|
@ -65,19 +65,17 @@ new(void)
|
||||||
natid num;
|
natid num;
|
||||||
coord x, y;
|
coord x, y;
|
||||||
int i;
|
int i;
|
||||||
s_char *p;
|
char *p;
|
||||||
int n;
|
char buf[1024];
|
||||||
s_char buf[1024];
|
|
||||||
|
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
if (natp->nat_xorg != 0 || natp->nat_yorg != 0) {
|
if (natp->nat_xorg != 0 || natp->nat_yorg != 0) {
|
||||||
pr("Must be at 0,0 to add a new country\n");
|
pr("Must be at 0,0 to add a new country\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if ((n = natarg(player->argp[1], "Country? ")) < 0)
|
if (!(natp = natargp(player->argp[1], "Country? ")))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
num = n;
|
num = natp->nat_cnum;
|
||||||
natp = getnatp(num);
|
|
||||||
if (natp->nat_stat != STAT_NEW) {
|
if (natp->nat_stat != STAT_NEW) {
|
||||||
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
pr("Country #%d (%s) isn't a new country!\n", num, cname(num));
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -202,7 +200,7 @@ new(void)
|
||||||
natp->nat_tgms = 0;
|
natp->nat_tgms = 0;
|
||||||
(void)close(open(mailbox(buf, num), O_RDWR | O_TRUNC | O_CREAT, 0660));
|
(void)close(open(mailbox(buf, num), O_RDWR | O_TRUNC | O_CREAT, 0660));
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
return 0;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nmin, ngold, noil, nur;
|
static int nmin, ngold, noil, nur;
|
||||||
|
@ -211,9 +209,9 @@ static int nfree, navail, nowned;
|
||||||
static int
|
static int
|
||||||
isok(int x, int y)
|
isok(int x, int y)
|
||||||
{
|
{
|
||||||
s_char *map;
|
signed char *map;
|
||||||
s_char *p;
|
char *p;
|
||||||
s_char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
nmin = ngold = noil = nur = 0;
|
nmin = ngold = noil = nur = 0;
|
||||||
navail = nfree = nowned = 0;
|
navail = nfree = nowned = 0;
|
||||||
|
@ -238,7 +236,7 @@ isok(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ok(s_char *map, int x, int y)
|
ok(signed char *map, int x, int y)
|
||||||
{
|
{
|
||||||
struct sctstr sect;
|
struct sctstr sect;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue