Simplify how fire command parses third argument
Remove a useless strcpy() that truncated the argument to 19 characters.
This commit is contained in:
parent
ea43696e0d
commit
e1b3a8239c
1 changed files with 3 additions and 10 deletions
|
@ -64,7 +64,6 @@ int
|
||||||
multifire(void)
|
multifire(void)
|
||||||
{
|
{
|
||||||
static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
|
static int ef_with_guns[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD };
|
||||||
char vbuf[20];
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
double range;
|
double range;
|
||||||
int trange, range2;
|
int trange, range2;
|
||||||
|
@ -221,14 +220,8 @@ multifire(void)
|
||||||
pr("Fire aborted.\n");
|
pr("Fire aborted.\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ptr[19] = 0;
|
if (!issector(ptr)) {
|
||||||
(void)strcpy(vbuf, ptr);
|
vshipno = atoi(ptr);
|
||||||
if (issector(vbuf))
|
|
||||||
target = targ_land;
|
|
||||||
else
|
|
||||||
target = targ_ship;
|
|
||||||
if (target == targ_ship) {
|
|
||||||
vshipno = atoi(vbuf);
|
|
||||||
if (vshipno < 0 || !getship(vshipno, &vship) ||
|
if (vshipno < 0 || !getship(vshipno, &vship) ||
|
||||||
(!vship.shp_own)) {
|
(!vship.shp_own)) {
|
||||||
pr("No such ship exists!\n");
|
pr("No such ship exists!\n");
|
||||||
|
@ -244,7 +237,7 @@ multifire(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} 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");
|
pr("No such sector exists!\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue