[Freeciv-tickets] [freeciv] #41118: Increase city owned counter as needed

Zurück zum Archiv-Index
OSDN Ticket System norep****@osdn*****
Wed Feb 16 00:33:40 JST 2022


#41118: Increase city owned counter as needed

  Open Date: 2021-01-08 06:04
Last Update: 2022-02-16 00:33

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/41118
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=41118

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-02-16 00:33 Updated by: lachu

Comment:

Reply To cazfi
Reading (not yet actually testing) the patch, functionality looks good now.

The city_counters_iterate() macro could be improved a bit
- Style: "struct counter * pcount;" - you are not multiplying by 'pcount' but making it a pointer, so no space -> "struct counter *pcount;"
- You should not make a separate call to counters_get_city_counters_count() on every iteration. Call it once before the loop, assign value to variable, and compare against that variable on each iteration. Note next point about naming the variable
- Having static variable name '_i' means that within one city_counters_iterate() there cannot be another city_counters_iterate() (that would cause '_i' of the inner one to shadow one of the outer one). You could make name of the variable derived from pcounts name instead; '_i_##pcount'
Done. Should I wrote some automatic tests? I test it by comparing counter section of two savegames made on the same turn. First before conquering two cities and second after conquering it.

---------------------------------------------------------------------
Ticket Status:

      Reporter: cazfi
         Owner: (None)
          Type: Patches
        Status: Open
      Priority: 5 - Medium
     MileStone: 3.2.0
     Component: General
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Increase city owned counters (type COUNTER_OWNED) by one every turn. Reset it to zero when city changes owner.
It's best to introduce counter iterator macros already, and use them to find counters to update. This makes it to work when number and order of counters is no longer hardcoded in the future.
Test this by checking from a savegame that counter information saved is what it should.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/41118
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=41118



More information about the Freeciv-tickets mailing list
Zurück zum Archiv-Index