Discussion:
[Freecol-developers] crash / scaling opportunity
Michael T. Pope
2015-05-01 11:56:48 UTC
Permalink
BR#2844 showed up a nest of interrelated bugs in European diplomacy. They
are now all fixed AFAICT, save one. European AIs are intended to look at
the trade offers you make, score each item, accept if positive, reject if
invalid or unacceptable, or try to prune out enough items to make it
worthwhile for them and make a counter offer. However ATM when a
counter offer occurs, the attempt to redisplay the NegotiationDialog
(formerly DiplomaticTradeDialog but that had become a misleading name)
crashes deep in the size calculation code.

Looking at NegotiationDialog, its main panel is defined as:

MigPanel panel = new MigPanel(new MigLayout("wrap 3",
"[200, fill][300, fill][200, fill]", ""));

Since these fixed sizes are implicated in the crash, we could try to fix two
things at once by making the dialog scalable. However just removing the
hardcoded sizes does not prevent the crash. I am unclear what else to try
at this point.

To reproduce the bug, download the second saved game on BR#2844. Start it
up, and your selected unit will be a privateer parked north of Curacao.
Trade with them, offering the muskets and lumber for 300 gold. They will
try to negotiate the price down to 200 gold, but the panel showing that
will crash, so you will never see any response to your offer, but the log
file will contain a nasty crash.

Also, if you think that the NegotiationDialog is possibly the ugliest
panel in FreeCol, you may well be right, and as I wrote most of it, you
now know why I try not to make decisions about how things should look:-).
Feel free to also improve its appearance once it stops crashing.

Cheers,
Mike Pope
Michael T. Pope
2015-05-02 12:37:28 UTC
Permalink
On Fri, 1 May 2015 21:26:48 +0930
BR#2844 showed up a nest of interrelated bugs in European diplomacy...
OK, thanks to wintertime for finding one of the crashes. The other one
went away when I moved the updateDialog() call before initializeDialog().
I took the opportunity to express the column sizes as percentages which
should improve scaling, and converted a fixed width to minimum size. What
would be nice now is if the NegotiationDialog was resizable, but I am
going to pass on that in favour of fixing the associated gold-request
confusion in BR#2815.

Cheers,
Mike Pope

Loading...