(meta_type): Add its entry.
(setnum, nstr_promote, nstr_exec_val): Deal with it. nstr_exec_val()
implements opt_HIDDEN by mapping unknown values to -1.
(natstr, nat_ca): Use it for member nat_relate. This also halves its
size. Fixes very minor leak: before, player could see relations to
all countries, regardless of contact.
(nation_relations): Add entry for -1.
time_t nat_newstim; /* date news last read */
time_t nat_annotim; /* date annos last read */
float nat_level[4]; /* technology, etc */
- short nat_relate[MAXNOC];
+ unsigned char nat_relate[MAXNOC];
unsigned char nat_contact[MAXNOC];
unsigned char nat_rejects[MAXNOC];
signed char nat_priorities[PRI_MAX+1]; /* budget priority */
NSC_INT, /* int */
NSC_XCOORD, /* coord that needs x conversion */
NSC_YCOORD, /* coord that needs y conversion */
+ NSC_HIDDEN, /* unsigned char in struct natstr that
+ may need hiding */
NSC_TIME, /* time_t */
NSC_FLOAT, /* float */
NSC_STRINGY, /* char[], zero-terminated string */
((signed char *)memb_ptr)[idx] = (signed char)dbl;
break;
case NSC_UCHAR:
+ case NSC_HIDDEN:
old = ((unsigned char *)memb_ptr)[idx];
((unsigned char *)memb_ptr)[idx] = (unsigned char)dbl;
break;
EF_BAD},
{NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
EF_BAD},
- {NSC_SHORT, 0, MAXNOC, fldoff(natstr, nat_relate), "relations",
+ {NSC_HIDDEN, 0, MAXNOC, fldoff(natstr, nat_relate), "relations",
EF_NATION_RELATIONS},
/* should show mortals whether there's contact (obvious from relations?) */
{NSC_UCHAR, NSC_DEITY, MAXNOC, fldoff(natstr, nat_contact), "contacts",
{NSC_INT, "d"},
{NSC_XCOORD, "d"},
{NSC_YCOORD, "d"},
+ {NSC_HIDDEN, "d"},
{NSC_TIME, "d"},
{NSC_FLOAT, "g"},
{NSC_STRINGY,"c"},
};
struct symbol nation_relations[] = {
+ {-1, "unknown"},
{AT_WAR, "at-war"},
{SITZKRIEG, "sitzkrieg"},
{MOBILIZATION, "mobilization"},
#include "file.h"
#include "match.h"
#include "nsc.h"
+#include "optlist.h"
#include "prototypes.h"
static char *nstr_parse_val(char *, struct valstr *);
case NSC_INT:
case NSC_XCOORD:
case NSC_YCOORD:
+ case NSC_HIDDEN:
case NSC_TIME:
valtype = NSC_LONG;
break;
}
if (val->val_cat == NSC_VAL) {
- /* coord literals don't occur, conversion not implemented */
+ /* unimplemented conversions; don't currently occur here */
CANT_HAPPEN(val->val_type == NSC_XCOORD
- || val->val_type == NSC_YCOORD);
+ || val->val_type == NSC_YCOORD
+ || val->val_type == NSC_HIDDEN);
val->val_type = to;
}
char *memb_ptr;
nsc_type valtype;
int idx;
+ struct natstr *natp;
switch (val->val_cat) {
default:
case NSC_YCOORD:
val->val_as.lng = yrel(getnatp(cnum), ((short *)memb_ptr)[idx]);
break;
+ case NSC_HIDDEN:
+ val->val_as.lng = -1;
+ if (CANT_HAPPEN(((struct natstr *)ptr)->ef_type != EF_NATION))
+ break;
+ natp = getnatp(cnum);
+ if (!opt_HIDDEN
+ || natp->nat_stat == STAT_GOD
+ || (getcontact(natp, idx) && getcontact(ptr, idx)))
+ val->val_as.lng = ((unsigned char *)memb_ptr)[idx];
+ break;
case NSC_FLOAT:
val->val_as.dbl = ((float *)memb_ptr)[idx];
valtype = NSC_DOUBLE;