(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 */
|
||||
extern int comtch(register s_char *, struct cmndstr *, int);
|
||||
/* natarg.c */
|
||||
extern int natarg(s_char *, s_char *);
|
||||
extern int natarg(char *, char *);
|
||||
/* neigh.c */
|
||||
extern int neigh(coord, coord, natid);
|
||||
/* nreport.c */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* natarg.c: Return countr # given country name or country #
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* (List known contributors to this file)
|
||||
* Markus Armbruster, 2006
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -42,40 +42,29 @@
|
|||
#include "optlist.h"
|
||||
|
||||
int
|
||||
natarg(s_char *arg, s_char *prompt)
|
||||
natarg(char *arg, char *prompt)
|
||||
{
|
||||
s_char buf[1024];
|
||||
char buf[1024];
|
||||
int n;
|
||||
struct natstr *np;
|
||||
int byname = 0;
|
||||
|
||||
arg = getstarg(arg, prompt, buf);
|
||||
if (arg == 0 || *arg == 0)
|
||||
return -1;
|
||||
if (isdigit(*arg))
|
||||
n = atoi(arg);
|
||||
else {
|
||||
else
|
||||
n = cnumb(arg);
|
||||
if (opt_HIDDEN) {
|
||||
byname = 1;
|
||||
}
|
||||
}
|
||||
if (n < 0 || n >= MAXNOC) {
|
||||
pr("No such country exists.\n");
|
||||
n = -1;
|
||||
np = getnatp(n);
|
||||
if (!np) {
|
||||
pr("Country '%s' doesn't exist.\n", arg);
|
||||
return -1;
|
||||
}
|
||||
if (opt_HIDDEN) {
|
||||
if (!player->god && !getcontact(getnatp(player->cnum), n)) {
|
||||
if ((np = getnatp(n)) == 0)
|
||||
return -1;
|
||||
if (np->nat_stat != STAT_GOD) {
|
||||
if (byname) {
|
||||
pr("No such country exists.\n");
|
||||
n = -1;
|
||||
} else {
|
||||
pr("Country has not been contacted.\n");
|
||||
n = -2;
|
||||
}
|
||||
pr("Country '%s' has not been contacted.\n", arg);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue