Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: bug in cr_entry_building (PR#1289)
Home

[Freeciv-Dev] Re: bug in cr_entry_building (PR#1289)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: bug in cr_entry_building (PR#1289)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Fri, 1 Mar 2002 06:42:39 -0800 (PST)

Raimar Falke wrote:
On Fri, Mar 01, 2002 at 05:48:14AM -0800, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:

I've logged this as a separate bug report, although most of it is related to #1283 (s/999/never/ in turns-to-build).

cr_entry_building has a bug: it checks whether the city is building B_CAPITAL before checking to see whether or not the city is building a unit or building (capitalization counts as a building). This means whatever unit gets the same ID as capitalization will be shown incorrectly.

The attached patch fixes this in the process of special-casing the "999" case as never (or in this case "-").




But really, what's up with cr_entry_building and the whole city_rep_data file? This function is declared static and never used.


Nasty preprocessor tricks:

/* This generates the function name and the tagname: */
#define FUNC_TAG(var)  cr_entry_##var, #var
                       ^^^^^^^^^

struct city_report_spec city_report_specs[] = {
...
  { 1,  0, 1, N_("Currently Building"), N_("(Stock,Target,Turns,Buy)"),
                                      N_("Currently Building"),
                                      FUNC_TAG(building) }
                                               ^^^^^^^^

Wow, that's sneaky.

But, this brings up another question: why does it work currently? Is it because B_CAPITAL is the very last building production type, and since there are fewer units than buildings it doesn't conflict with any unit? Odd...I would have expected more unit types than buildings.

It _looks_ like it should take care of all the work for a city report entry, but currently there is very similar code among the different GUIs to do this. I get the impression there is some overridding structure for automatically generating city reports here, but it's incomplete and I don't think the original intent is completely clear. Should the full system be implemented? Should individual functions be made public and used in place of the (very similar code) among the gui's?


I'm for unification with the other users. Maybe you can a base_*
version which can be customized with some flags.

Clearly I do not yet fully understand all of the uses here. I will continue to investigate.

In the meantime, this patch should still apply and should fix the bug (if present). Or you can wait for something more substantial.

jason




[Prev in Thread] Current Thread [Next in Thread]