From: Markus Armbruster Date: Sat, 10 May 2008 06:40:48 +0000 (+0200) Subject: Fix edit l, s, u, p not to wipe out concurrent updates X-Git-Tag: hvy-metal-2.1^0 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=2ebcc9079f14351631b6c062179d1e7dde7e33cd Fix edit l, s, u, p not to wipe out concurrent updates Make edit() bail out if the edited object changed while edit() slept for input. (cherry picked from commit a1f4dc95920e579432dfbd0e7664558f8c3ca1fc) --- diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 0b3108c0a..a55a78567 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -191,12 +191,16 @@ edit(void) return err; break; case 'l': + if (!check_sect_ok(§)) + return RET_FAIL; if ((err = doland(thing, arg, ptr, §)) != RET_OK) return err; if (!putsect(§)) return RET_FAIL; break; case 's': + if (!check_ship_ok(&ship)) + return RET_FAIL; if ((err = doship(thing, arg, ptr, &ship)) != RET_OK) return err; if (!ef_ensure_space(EF_SHIP, ship.shp_uid, 50)) @@ -205,6 +209,8 @@ edit(void) return RET_FAIL; break; case 'u': + if (!check_land_ok(&land)) + return RET_FAIL; if ((err = dounit(thing, arg, ptr, &land)) != RET_OK) return err; if (!ef_ensure_space(EF_LAND, land.lnd_uid, 50)) @@ -213,6 +219,8 @@ edit(void) return RET_FAIL; break; case 'p': + if (!check_plane_ok(&plane)) + return RET_FAIL; if ((err = doplane(thing, arg, ptr, &plane)) != RET_OK) return err; if (!ef_ensure_space(EF_PLANE, plane.pln_uid, 50))