contact: Change in_contact()'s first parameter to natid
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
c8e7548f24
commit
d35303d426
9 changed files with 19 additions and 20 deletions
|
@ -182,7 +182,7 @@ extern char *natstate(struct natstr *np);
|
||||||
extern int getrel(struct natstr *np, natid them);
|
extern int getrel(struct natstr *np, natid them);
|
||||||
extern int relations_with(natid, natid);
|
extern int relations_with(natid, natid);
|
||||||
extern int getrejects(natid them, struct natstr *np);
|
extern int getrejects(natid them, struct natstr *np);
|
||||||
extern int in_contact(struct natstr *np, natid them);
|
extern int in_contact(natid, natid);
|
||||||
extern void putrel(struct natstr *np, natid them, int relate);
|
extern void putrel(struct natstr *np, natid them, int relate);
|
||||||
extern void putreject(struct natstr *np, natid them, int how, int what);
|
extern void putreject(struct natstr *np, natid them, int how, int what);
|
||||||
extern void agecontact(struct natstr *np);
|
extern void agecontact(struct natstr *np);
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
int
|
int
|
||||||
decl(void)
|
decl(void)
|
||||||
{
|
{
|
||||||
struct natstr nat, *natp;
|
struct natstr nat;
|
||||||
int rel;
|
int rel;
|
||||||
int who;
|
int who;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
|
@ -80,14 +80,13 @@ decl(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
|
||||||
natp = getnatp(who);
|
|
||||||
while (nxtitem(&ni, &nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (nat.nat_stat == STAT_UNUSED)
|
if (nat.nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (who == (natid)ni.cur)
|
if (who == (natid)ni.cur)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !in_contact(natp, ni.cur)) {
|
if (!player->god && !in_contact(who, ni.cur)) {
|
||||||
pr("You haven't contacted country #%d yet\n", ni.cur);
|
pr("You haven't contacted country #%d yet\n", ni.cur);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,8 @@ news(void)
|
||||||
nws.nws_ntm = 1;
|
nws.nws_ntm = 1;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god &&
|
if (!player->god &&
|
||||||
!(in_contact(getnatp(player->cnum), nws.nws_ano) &&
|
!(in_contact(player->cnum, nws.nws_ano) &&
|
||||||
in_contact(getnatp(player->cnum), nws.nws_vno)))
|
in_contact(player->cnum, nws.nws_vno)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
page_has_news[rpt[nws.nws_vrb].r_newspage] = 1;
|
page_has_news[rpt[nws.nws_vrb].r_newspage] = 1;
|
||||||
|
|
|
@ -69,9 +69,9 @@ rela(void)
|
||||||
if (np->nat_stat < STAT_SANCT)
|
if (np->nat_stat < STAT_SANCT)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !in_contact(natp, cn))
|
if (!player->god && !in_contact(as, cn))
|
||||||
continue;
|
continue;
|
||||||
if (!player->god && !in_contact(getnatp(player->cnum), cn))
|
if (!player->god && !in_contact(player->cnum, cn))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pr("%3d) %-20.20s ", cn, cname(cn));
|
pr("%3d) %-20.20s ", cn, cname(cn));
|
||||||
|
|
|
@ -58,7 +58,7 @@ repo(void)
|
||||||
if (nat.nat_stat == STAT_UNUSED)
|
if (nat.nat_stat == STAT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !in_contact(natp, ni.cur))
|
if (!player->god && !in_contact(player->cnum, ni.cur))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!player->god && nat.nat_stat != STAT_ACTIVE)
|
if (!player->god && nat.nat_stat != STAT_ACTIVE)
|
||||||
|
|
|
@ -110,9 +110,9 @@ agecontact(struct natstr *np)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
in_contact(struct natstr *np, natid them)
|
in_contact(natid us, natid them)
|
||||||
{
|
{
|
||||||
return getcontactp(np->nat_cnum)->con_contact[them];
|
return getcontactp(us)->con_contact[them];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1989
|
* Dave Pare, 1989
|
||||||
* Steve McClure, 1997
|
* Steve McClure, 1997
|
||||||
* Markus Armbruster, 2004-2015
|
* Markus Armbruster, 2004-2016
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -178,13 +178,13 @@ nstr_eval(struct valstr *val, natid cnum, void *ptr, enum nsc_type want)
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
if (CANT_HAPPEN(hidden && valtype != NSC_LONG))
|
if (CANT_HAPPEN(hidden && valtype != NSC_LONG))
|
||||||
break; /* not implemented */
|
break; /* not implemented */
|
||||||
if (CANT_HAPPEN(((struct natstr *)ptr)->ef_type != EF_NATION))
|
natp = ptr;
|
||||||
|
if (CANT_HAPPEN(natp->ef_type != EF_NATION))
|
||||||
break; /* only defined for nation selectors */
|
break; /* only defined for nation selectors */
|
||||||
if (!opt_HIDDEN || cnum == NATID_BAD)
|
if (!opt_HIDDEN || cnum == NATID_BAD
|
||||||
|
|| getnatp(cnum)->nat_stat == STAT_GOD)
|
||||||
break;
|
break;
|
||||||
natp = getnatp(cnum);
|
if (!in_contact(cnum, idx) || !in_contact(natp->nat_cnum, idx))
|
||||||
if (natp->nat_stat != STAT_GOD
|
|
||||||
&& !(in_contact(natp, idx) && in_contact(ptr, idx)))
|
|
||||||
val->val_as.lng = -1;
|
val->val_as.lng = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* natarg.c: Return countr # given country name or country #
|
* natarg.c: Return countr # given country name or country #
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2006-2009
|
* Markus Armbruster, 2006-2016
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -96,7 +96,7 @@ natarg(char *arg, char *prompt)
|
||||||
return -1;
|
return -1;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god
|
if (!player->god
|
||||||
&& !in_contact(getnatp(player->cnum), np->nat_cnum)) {
|
&& !in_contact(player->cnum, np->nat_cnum)) {
|
||||||
if (np->nat_stat != STAT_GOD) {
|
if (np->nat_stat != STAT_GOD) {
|
||||||
pr("Country '%s' has not been contacted.\n", arg);
|
pr("Country '%s' has not been contacted.\n", arg);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -252,7 +252,7 @@ share_incr(double res[], double tech[])
|
||||||
if (other->nat_stat != STAT_ACTIVE)
|
if (other->nat_stat != STAT_ACTIVE)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!in_contact(np, j))
|
if (!in_contact(i, j))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue