edit: Clean up a few assignments within conditionals
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
859627c416
commit
2b4eaca8b1
1 changed files with 16 additions and 11 deletions
|
@ -67,7 +67,7 @@ edit(void)
|
||||||
char *what;
|
char *what;
|
||||||
char *key, *ptr;
|
char *key, *ptr;
|
||||||
int num;
|
int num;
|
||||||
int err;
|
int ret;
|
||||||
int arg_index = 3;
|
int arg_index = 3;
|
||||||
coord x, y;
|
coord x, y;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
@ -158,38 +158,43 @@ edit(void)
|
||||||
|
|
||||||
switch (ewhat) {
|
switch (ewhat) {
|
||||||
case 'c':
|
case 'c':
|
||||||
if ((err = edit_nat(np, key, ptr)) != RET_OK)
|
ret = edit_nat(np, key, ptr);
|
||||||
return err;
|
if (ret != RET_OK)
|
||||||
|
return ret;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
if (!check_sect_ok(&item.sect))
|
if (!check_sect_ok(&item.sect))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if ((err = edit_sect(&item.sect, key, ptr)) != RET_OK)
|
ret = edit_sect(&item.sect, key, ptr);
|
||||||
return err;
|
if (ret != RET_OK)
|
||||||
|
return ret;
|
||||||
if (!putsect(&item.sect))
|
if (!putsect(&item.sect))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (!check_ship_ok(&item.ship))
|
if (!check_ship_ok(&item.ship))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if ((err = edit_ship(&item.ship, key, ptr)) != RET_OK)
|
ret = edit_ship(&item.ship, key, ptr);
|
||||||
return err;
|
if (ret != RET_OK)
|
||||||
|
return ret;
|
||||||
if (!putship(item.ship.shp_uid, &item.ship))
|
if (!putship(item.ship.shp_uid, &item.ship))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (!check_land_ok(&item.land))
|
if (!check_land_ok(&item.land))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if ((err = edit_land(&item.land, key, ptr)) != RET_OK)
|
ret = edit_land(&item.land, key, ptr);
|
||||||
return err;
|
if (ret != RET_OK)
|
||||||
|
return ret;
|
||||||
if (!putland(item.land.lnd_uid, &item.land))
|
if (!putland(item.land.lnd_uid, &item.land))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (!check_plane_ok(&item.plane))
|
if (!check_plane_ok(&item.plane))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if ((err = edit_plane(&item.plane, key, ptr)) != RET_OK)
|
ret = edit_plane(&item.plane, key, ptr);
|
||||||
return err;
|
if (ret != RET_OK)
|
||||||
|
return ret;
|
||||||
if (!putplane(item.plane.pln_uid, &item.plane))
|
if (!putplane(item.plane.pln_uid, &item.plane))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue