]> git.pond.sub.org Git - empserver/commitdiff
Disable recursive supply of land units
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 15 Feb 2009 08:15:53 +0000 (09:15 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 17 Feb 2009 18:30:35 +0000 (19:30 +0100)
Its implementation in s_commod() increases lnd_seqno even when
!actually_doit, which can cause spurious seqno oopses in callers of
lnd_could_be_supplied().  I can't be bothered to clean up this mess
right now, because recursive resupply is too dumb to be really useful
anyway: each step uses the first source it finds, without
consideration of mobility cost.

info/supply.t
src/lib/subs/supply.c

index ef4c52fa755f67f7be49c0f50f680eb3824771bf..810c75192ba398fdd050129a9d6e0bc71b14da93 100644 (file)
@@ -66,9 +66,11 @@ efficient. This uses mobility from the harbor.
 If it still can't find enough supplies, the unit will look for an owned
 unit with the 'supply' ability. (see info show for information on how to
 find out about abilities of units) In this case, the supply unit uses its
-mobility to use the supplies. After it supplies the unit, the supply unit
-will then itself try to re-supply, so that it is possible to form a chain
-of supply units reaching back to a headquarters or supply ship.
+mobility to use the supplies.
+\" Disabled due to bugs:
+\" After it supplies the unit, the supply unit
+\" will then itself try to re-supply, so that it is possible to form a chain
+\" of supply units reaching back to a headquarters or supply ship.
 .s1
 If after all this the unit can't get enough, it is out of supplies.
 .s1
index d112cea8ca1c5ea4f065f60c0525b7d4eb6b7011..5e55b5e38da67cca7f80bcb9ea12f4e0f9078a39 100644 (file)
@@ -329,6 +329,23 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
        if ((land.lnd_ship >= 0) && (sect.sct_effic < 2))
            continue;
 
+#if 0
+       /*
+        * Recursive supply is disabled for now.  It can introduce
+        * cycles into the "resupplies from" relation.  The code below
+        * attempts to break these cycles by temporarily zapping the
+        * commodity being supplied.  That puts the land file in a
+        * funny state temporarily, risking loss of supplies when
+        * something goes wrong on the way.  Worse, it increases
+        * lnd_seqno even when !actually_doit, which can lead to
+        * spurious seqno mismatch oopses in users of
+        * lnd_could_be_supplied().  I can't be bothered to clean up
+        * this mess right now, because recursive resupply is too dumb
+        * to be really useful anyway: each step uses the first source
+        * it finds, without consideration of mobility cost.  If you
+        * re-enable it, don't forget to uncomment its documentation
+        * in supply.t as well.
+        */
        if (land.lnd_item[type] - wanted < get_minimum(&land, type)) {
            struct lndstr save;
 
@@ -349,6 +366,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
            else
                putland(save.lnd_uid, &save);
        }
+#endif
 
        min = get_minimum(&land, type);
        ip = &ichr[type];