[Freeciv-Dev] (PR#949) city report fields don't sort well
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Raimar told me not to overengineer on this one, but I really can't help
myself...
The city report dialog is freeciv's best micro/macro management tool,
yet it is IMO crippled in its current state. This really needs to be
addressed.
The problem with the patches provided so far is that they only try to
treat the existing (text) fields of the city report as numerical fields,
by scanning them for numerical data. Worse still, they will only work
for one GUI (gui-gtk).
One alternative is to take the existing patches, and use them to provide
a GUI-independent comparison function. The functions provided by the
patches do essentially the same thing: provide a comparison function to
compare two strings that may or may not be integers. This function
could be used by all GUIs (at their option) to implement better sorting.
A combination of the two existing patches (using Raimar's comparison
code with Christian's GTK code) would be my preference.
This is probably a first step. But a lot more is possible, IMO.
The above design will allow sorting of simple numeric fields, and in
conjunction with Tuomas Airaksinen's patch to give the city report more
available fields (already applied), this may be sufficient. But
consider the "Surplus F/P/T" field. Under the simple design above, this
field will always be sorted by the F (food) category. While this is an
improvement on the current situation (sorting it alphabetically), it is
not what we really want. As a gamer, what _I_ would want is the ability
to have this field be sorted (in either direction) according to either
the F, P, or T fields, or (perhaps) according to their sum. (Note that
these fields can now be obtained as separate entries in the dialog, so I
can already get the behavior I want - but it is not grouped as nicely.)
When I sort the "currently building" field I would like to see it
sorted not alphabetically, but first by building type (alphabetically,
or by type; whatever) and then by turns remaining to build. When I sort
the "best defenders" field (very slick idea, Tuomas) I would like to be
able to sort by either the best unit, or the sum of the best two units,
or the sum of the best three.
With these abilities I think the city report dialog could be made both
simpler and more powerful.
Doing all of this elegantly (note that the alternative solution is far
from elegant, so the bar is pretty low) is not easy, but I think it is
possible. It is made more difficult because the different GUIs may have
very different interfaces: even gui-gtk and gui-gtk-2.0 are quite different.
I've had some thoughts on how to do this, but I'd like to get others'
opinions on it. First of all: would these capabilities be a good thing?
Secondly: how would you go about implementing it? (Or, better yet, can
you provide a patch?).
In the meantime, the simple solution can move forward.
jason
|
|