/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* nstreval.c: evaluate compiled values
- *
+ *
* Known contributors to this file:
* Dave Pare, 1989
* Steve McClure, 1997
* PTR points to a context object of the type that was used to compile
* the value.
* Unless WANT is NSC_NOTYPE, coerce the value to promoted value type
- * WANT. VAL must be coercible. That's the case if a previous
- * nstr_coerce_val(VAL, WANT, STR) succeeded.
+ * WANT. VAL must be coercible.
*/
struct valstr *
nstr_exec_val(struct valstr *val, natid cnum, void *ptr, enum nsc_type want)
val->val_as.lng = -1;
if (CANT_HAPPEN(((struct natstr *)ptr)->ef_type != EF_NATION))
break;
- if (!opt_HIDDEN && cnum != NATID_BAD) {
+ if (opt_HIDDEN && cnum != NATID_BAD) {
natp = getnatp(cnum);
if (natp->nat_stat != STAT_GOD
&& !(getcontact(natp, idx) && getcontact(ptr, idx)))
valtype = NSC_NOTYPE;
}
+ /* coerce */
if (valtype == want)
;
else if (want == NSC_DOUBLE) {
valtype = want;
val->val_as.dbl = val->val_as.lng;
}
- } else if (want == NSC_STRING)
- CANT_REACH(); /* FIXME implement */
+ }
if (CANT_HAPPEN(valtype != want && want != NSC_NOTYPE)) {
/* make up an error value */