Simplify map(): use getstarg() instead of getstring()
This commit is contained in:
parent
96d1039c24
commit
12a0279a80
1 changed files with 13 additions and 14 deletions
|
@ -29,6 +29,8 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
|
* Marc Olzheim, 2004
|
||||||
|
* Markus Armbruster, 2005-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -44,9 +46,9 @@ map(void)
|
||||||
{
|
{
|
||||||
int unit_type = EF_BAD;
|
int unit_type = EF_BAD;
|
||||||
int bmap = 0;
|
int bmap = 0;
|
||||||
char *str;
|
char *str, *prompt;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char prompt[128];
|
char prompt_buf[128];
|
||||||
|
|
||||||
if (**player->argp != 'm') {
|
if (**player->argp != 'm') {
|
||||||
if (**player->argp == 'b')
|
if (**player->argp == 'b')
|
||||||
|
@ -73,18 +75,15 @@ map(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->argp[1] || !*player->argp[1]) {
|
if (unit_type == EF_BAD)
|
||||||
if (unit_type == EF_BAD) {
|
prompt = "(sects)? ";
|
||||||
str = getstring("(sects)? ", buf);
|
else {
|
||||||
} else {
|
sprintf(prompt_buf, "(sects, %s)? ", ef_nameof(unit_type));
|
||||||
sprintf(prompt, "(sects, %s)? ", ef_nameof(unit_type));
|
prompt = prompt_buf;
|
||||||
str = getstring(prompt, buf);
|
}
|
||||||
}
|
str = getstarg(player->argp[1], prompt, buf);
|
||||||
|
if (!str || !*str)
|
||||||
if (!str || !*str)
|
return RET_SYN;
|
||||||
return RET_SYN;
|
|
||||||
} else
|
|
||||||
str = player->argp[1];
|
|
||||||
|
|
||||||
if (unit_type == EF_BAD)
|
if (unit_type == EF_BAD)
|
||||||
unit_type = EF_SHIP;
|
unit_type = EF_SHIP;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue