(natarg): Don't attempt to hide names of countries not yet contacted
with HIDDEN. (natarg): Clearer error messages.
This commit is contained in:
parent
8e5d576fff
commit
6a5d398c6d
2 changed files with 11 additions and 22 deletions
|
@ -545,7 +545,7 @@ extern int msl_launch_mindam(struct emp_qelem *, coord, coord, int,
|
||||||
/* mtch.c */
|
/* mtch.c */
|
||||||
extern int comtch(register s_char *, struct cmndstr *, int);
|
extern int comtch(register s_char *, struct cmndstr *, int);
|
||||||
/* natarg.c */
|
/* natarg.c */
|
||||||
extern int natarg(s_char *, s_char *);
|
extern int natarg(char *, char *);
|
||||||
/* neigh.c */
|
/* neigh.c */
|
||||||
extern int neigh(coord, coord, natid);
|
extern int neigh(coord, coord, natid);
|
||||||
/* nreport.c */
|
/* nreport.c */
|
||||||
|
|
|
@ -28,7 +28,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:
|
||||||
* (List known contributors to this file)
|
* Markus Armbruster, 2006
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -42,40 +42,29 @@
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
natarg(s_char *arg, s_char *prompt)
|
natarg(char *arg, char *prompt)
|
||||||
{
|
{
|
||||||
s_char buf[1024];
|
char buf[1024];
|
||||||
int n;
|
int n;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
int byname = 0;
|
|
||||||
|
|
||||||
arg = getstarg(arg, prompt, buf);
|
arg = getstarg(arg, prompt, buf);
|
||||||
if (arg == 0 || *arg == 0)
|
if (arg == 0 || *arg == 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (isdigit(*arg))
|
if (isdigit(*arg))
|
||||||
n = atoi(arg);
|
n = atoi(arg);
|
||||||
else {
|
else
|
||||||
n = cnumb(arg);
|
n = cnumb(arg);
|
||||||
if (opt_HIDDEN) {
|
np = getnatp(n);
|
||||||
byname = 1;
|
if (!np) {
|
||||||
}
|
pr("Country '%s' doesn't exist.\n", arg);
|
||||||
}
|
return -1;
|
||||||
if (n < 0 || n >= MAXNOC) {
|
|
||||||
pr("No such country exists.\n");
|
|
||||||
n = -1;
|
|
||||||
}
|
}
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
if (!player->god && !getcontact(getnatp(player->cnum), n)) {
|
if (!player->god && !getcontact(getnatp(player->cnum), n)) {
|
||||||
if ((np = getnatp(n)) == 0)
|
|
||||||
return -1;
|
|
||||||
if (np->nat_stat != STAT_GOD) {
|
if (np->nat_stat != STAT_GOD) {
|
||||||
if (byname) {
|
pr("Country '%s' has not been contacted.\n", arg);
|
||||||
pr("No such country exists.\n");
|
return -2;
|
||||||
n = -1;
|
|
||||||
} else {
|
|
||||||
pr("Country has not been contacted.\n");
|
|
||||||
n = -2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue