Update of bug #19272 (project freeciv):

                Severity:              3 - Normal => 4 - Important          
                  Status:                    None => Ready For Test         
             Assigned to:                    None => jtn                    
                 Release:                         => 2.2.7, 2.3.1           
         Planned Release:                         => 2.2.8, 2.3.2, 2.4.0,


Follow-up Comment #1:

Oh dear, that's embarrassing. Reproduced (see attached incite_test4 savefile
with the multiplayer ruleset -- try to incite Bordeaux).

So... I have a fix for this, but it's possible that you may not like the

The fix is simply to use double arithmetic rather than int in
city_incite_cost(). This calculates intermediate results much larger than the
final cost, and it's certainly plausible that these overflow with the
coefficients in the multiplayer ruleset.
For good measure, if the *final* cost ends up greater than
INCITE_IMPOSSIBLE_COST (_one BEELLEEON dollars_), then we just return
IMPOSSIBLE (not that this is likely to happen in practice).

I've verified the fix continues to give the same results in non-wrapping
cases (e.g., incite_test3 savefile).

What I've found is that, with the multiplayer ruleset at least (haven't
checked Longturn), it's rather easy to run into the "wrapping" range with
plausible scenarios -- I've run into trouble when the "correct" incite cost
exceeds about two million (the test file here is just over the edge). So, it
seems likely that some previously-positive-but-incorrect incite costs in real
games will become much bigger.

It would thus probably be a good idea to plausibility check the incite costs
if applying this fix to a running Longturn server.

(If we take a "baseline" incite cost (before other factors) to be
base_incite_cost * incite_total_factor / 100, then for the default ruleset we
start at 1000*100/100 = 1000 and it goes up and down (mostly up) from there,
but for the multiplayer ruleset we start at a cool million (10000*10000/100).
That doesn't leave much headroom for the other multiplicative factors before
running into trouble.)

(file #14791, file #14792, file #14793)

Additional Item Attachment:

File name: trunk-S2_4-S2_3-S2_2-city-incite-cost-negative.diff Size:1 KB
File name: incite_test4.sav.bz2           Size:12 KB
File name: incite_test3.sav.bz2           Size:12 KB


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to