]> git.pond.sub.org Git - empserver/commitdiff
supply: Fix harmless bug in supply from ship in same sector
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 17 Aug 2013 15:57:23 +0000 (17:57 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 17 Aug 2013 15:57:23 +0000 (17:57 +0200)
Bug bites when a ship supplies the sector it's in.  First the sector
is charged zero mob for moving the stuff, and is written back.  Next,
the sector receives the stuff, and is written back, clobbering the
first write (no effect), and triggering a seqno oops.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/supply.c

index b820934f72e6459ad934ad83bd170edc4c79d011..2cff0ed6cd1d8ebdcc64e508ffc1bd9b2f48165a 100644 (file)
@@ -267,7 +267,8 @@ s_commod(struct empobj *sink, short *vec,
            if (actually_doit) {
                vec[type] += can_move;
                putship(ship.shp_uid, &ship);
-               putsect(&sect);
+               if (n)
+                   putsect(&sect);
                put_empobj(sink->ef_type, sink->uid, sink);
            }
            return 1;
@@ -281,7 +282,8 @@ s_commod(struct empobj *sink, short *vec,
            if (actually_doit) {
                vec[type] += can_move;
                putship(ship.shp_uid, &ship);
-               putsect(&sect);
+               if (n)
+                   putsect(&sect);
            }
        }
     }