]> git.pond.sub.org Git - empserver/commitdiff
Simplify how fire command parses third argument
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 15 Mar 2008 07:26:35 +0000 (08:26 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 17 Mar 2008 18:08:34 +0000 (19:08 +0100)
Remove a useless strcpy() that truncated the argument to 19
characters.

src/lib/commands/mfir.c

index 3389d79bc1a58955005e3295b80d9d57c3634279..58e2cb41b414cb080429ebfe3a8e175c994bbece 100644 (file)
@@ -64,7 +64,6 @@ int
 multifire(void)
 {
     static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
-    char vbuf[20];
     char *ptr;
     double range;
     int trange, range2;
@@ -221,14 +220,8 @@ multifire(void)
            pr("Fire aborted.\n");
            continue;
        }
-       ptr[19] = 0;
-       (void)strcpy(vbuf, ptr);
-       if (issector(vbuf))
-           target = targ_land;
-       else
-           target = targ_ship;
-       if (target == targ_ship) {
-           vshipno = atoi(vbuf);
+       if (!issector(ptr)) {
+           vshipno = atoi(ptr);
            if (vshipno < 0 || !getship(vshipno, &vship) ||
                (!vship.shp_own)) {
                pr("No such ship exists!\n");
@@ -244,7 +237,7 @@ multifire(void)
                continue;
            }
        } else {
-           if (!sarg_xy(vbuf, &x, &y) || !getsect(x, y, &vsect)) {
+           if (!sarg_xy(ptr, &x, &y) || !getsect(x, y, &vsect)) {
                pr("No such sector exists!\n");
                continue;
            }