]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/map.c
commands: Rename the command functions
[empserver] / src / lib / commands / map.c
index ae995c2957b735795af39f22dbcd559c03776b89..7d812792a0f9d3040250004bb0b3c46cd9cb9712 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
+ *     Marc Olzheim, 2004
+ *     Markus Armbruster, 2005-2011
  */
 
 #include <config.h>
 
 #include "commands.h"
-#include "land.h"
 #include "map.h"
-#include "optlist.h"
-#include "ship.h"
 
 int
-map(void)
+c_map(void)
 {
     int unit_type = EF_BAD;
     int bmap = 0;
-    char *str;
+    char *str, *prompt;
     char buf[1024];
-    char prompt[128];
+    char prompt_buf[128];
 
     if (**player->argp != 'm') {
        if (**player->argp == 'b')
@@ -73,18 +72,15 @@ map(void)
        }
     }
 
-    if (player->argp[1] == NULL) {
-       if (unit_type == EF_BAD) {
-           str = getstring("(sects)? ", buf);
-       } else {
-           sprintf(prompt, "(sects, %s)? ", ef_nameof(unit_type));
-           str = getstring(prompt, buf);
-       }
-
-       if (!str || !*str)
-           return RET_SYN;
-    } else
-       str = player->argp[1];
+    if (unit_type == EF_BAD)
+       prompt = "(sects)? ";
+    else {
+       sprintf(prompt_buf, "(sects, %s)? ", ef_nameof(unit_type));
+       prompt = prompt_buf;
+    }
+    str = getstarg(player->argp[1], prompt, buf);
+    if (!str || !*str)
+       return RET_SYN;
 
     if (unit_type == EF_BAD)
        unit_type = EF_SHIP;