nat_reset() is no longer used with STAT_SANCT, simplify
This commit is contained in:
parent
7739830594
commit
5232add0f5
3 changed files with 10 additions and 51 deletions
|
@ -178,8 +178,7 @@ extern void putcontact(struct natstr *np, natid them, int contact);
|
||||||
extern void agecontact(struct natstr *np);
|
extern void agecontact(struct natstr *np);
|
||||||
extern int influx(struct natstr *np);
|
extern int influx(struct natstr *np);
|
||||||
|
|
||||||
extern struct natstr *nat_reset(struct natstr *, enum nat_status,
|
extern struct natstr *nat_reset(struct natstr *, natid, enum nat_status);
|
||||||
coord, coord);
|
|
||||||
extern int check_nat_name(char *, natid);
|
extern int check_nat_name(char *, natid);
|
||||||
|
|
||||||
extern int grant_btus(struct natstr *, int);
|
extern int grant_btus(struct natstr *, int);
|
||||||
|
|
|
@ -110,9 +110,9 @@ add(void)
|
||||||
pr("Illegal status\n");
|
pr("Illegal status\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
nat_reset(natp, natp->nat_cnum, stat);
|
||||||
strcpy(natp->nat_cnam, cntryname);
|
strcpy(natp->nat_cnam, cntryname);
|
||||||
strcpy(natp->nat_pnam, pname);
|
strcpy(natp->nat_pnam, pname);
|
||||||
nat_reset(natp, stat, 0, 0);
|
|
||||||
putnat(natp);
|
putnat(natp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,80 +39,40 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "game.h"
|
|
||||||
#include "nat.h"
|
#include "nat.h"
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "tel.h"
|
#include "tel.h"
|
||||||
#include "xy.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset NATP for status STAT with origin/capital at X,Y.
|
* Initialize NATP for country #CNUM in status STAT.
|
||||||
* Wipes everything but nat_cnum, nat_cnam and nat_pnam.
|
* STAT must be STAT_UNUSED, STAT_NEW, STAT_VIS or STAT_GOD.
|
||||||
* Also wipes realms and telegrams.
|
* Also wipe realms and telegrams.
|
||||||
*/
|
*/
|
||||||
struct natstr *
|
struct natstr *
|
||||||
nat_reset(struct natstr *natp, enum nat_status stat, coord x, coord y)
|
nat_reset(struct natstr *natp, natid cnum, enum nat_status stat)
|
||||||
{
|
{
|
||||||
static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
|
|
||||||
struct realmstr newrealm;
|
struct realmstr newrealm;
|
||||||
struct range absrealm;
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
ef_blank(EF_NATION, cnum, natp);
|
||||||
natp->nat_stat = stat;
|
natp->nat_stat = stat;
|
||||||
*natp->nat_hostaddr = '\0';
|
|
||||||
*natp->nat_hostname = '\0';
|
|
||||||
*natp->nat_userid = '\0';
|
|
||||||
|
|
||||||
natp->nat_xcap = natp->nat_xorg = x;
|
|
||||||
natp->nat_ycap = natp->nat_yorg = y;
|
|
||||||
if (stat == STAT_SANCT)
|
|
||||||
xyabsrange(natp, &defrealm, &absrealm);
|
|
||||||
else
|
|
||||||
memset(&absrealm, 0, sizeof(absrealm));
|
|
||||||
for (i = 0; i < MAXNOR; i++) {
|
for (i = 0; i < MAXNOR; i++) {
|
||||||
ef_blank(EF_REALM, i + natp->nat_cnum * MAXNOR, &newrealm);
|
ef_blank(EF_REALM, i + cnum * MAXNOR, &newrealm);
|
||||||
newrealm.r_cnum = natp->nat_cnum;
|
|
||||||
newrealm.r_realm = i;
|
|
||||||
newrealm.r_xl = absrealm.lx;
|
|
||||||
newrealm.r_xh = absrealm.hx;
|
|
||||||
newrealm.r_yl = absrealm.ly;
|
|
||||||
newrealm.r_yh = absrealm.hy;
|
|
||||||
putrealm(&newrealm);
|
putrealm(&newrealm);
|
||||||
}
|
}
|
||||||
if (players_at_00) {
|
close(creat(mailbox(buf, cnum),
|
||||||
natp->nat_xorg = 0;
|
|
||||||
natp->nat_yorg = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
natp->nat_timeused = 0;
|
|
||||||
natp->nat_update = 0;
|
|
||||||
|
|
||||||
natp->nat_tgms = 0;
|
|
||||||
close(creat(mailbox(buf, natp->nat_cnum),
|
|
||||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
|
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
|
||||||
natp->nat_ann = 0; /* FIXME number of annos */
|
/* FIXME natp->nat_ann = #annos */
|
||||||
|
|
||||||
natp->nat_btu = stat == STAT_SANCT ? max_btus : 0;
|
|
||||||
natp->nat_access = 0;
|
|
||||||
game_tick_to_now(&natp->nat_access);
|
|
||||||
natp->nat_reserve = 0;
|
|
||||||
natp->nat_money = stat == STAT_SANCT ? start_cash : 0;
|
|
||||||
natp->nat_last_login = natp->nat_last_logout = 0;
|
|
||||||
natp->nat_newstim = 0;
|
|
||||||
natp->nat_annotim = 0;
|
|
||||||
natp->nat_level[NAT_HLEV] = start_happiness;
|
natp->nat_level[NAT_HLEV] = start_happiness;
|
||||||
natp->nat_level[NAT_RLEV] = start_research;
|
natp->nat_level[NAT_RLEV] = start_research;
|
||||||
natp->nat_level[NAT_TLEV] = start_technology;
|
natp->nat_level[NAT_TLEV] = start_technology;
|
||||||
natp->nat_level[NAT_ELEV] = start_education;
|
natp->nat_level[NAT_ELEV] = start_education;
|
||||||
for (i = 0; i < MAXNOC; i++)
|
for (i = 0; i < MAXNOC; i++)
|
||||||
natp->nat_relate[i] = NEUTRAL;
|
natp->nat_relate[i] = NEUTRAL;
|
||||||
memset(natp->nat_contact, 0, sizeof(natp->nat_rejects));
|
|
||||||
memset(natp->nat_rejects, 0, sizeof(natp->nat_rejects));
|
|
||||||
natp->nat_flags =
|
natp->nat_flags =
|
||||||
NF_FLASH | NF_BEEP | NF_COASTWATCH | NF_SONAR | NF_TECHLISTS;
|
NF_FLASH | NF_BEEP | NF_COASTWATCH | NF_SONAR | NF_TECHLISTS;
|
||||||
|
|
||||||
return natp;
|
return natp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue