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

アーカイブの一覧に戻る
OSDN Ticket System norep****@osdn*****
Tue Feb 15 01:30:46 JST 2022


#41118: Increase city owned counter as needed

  Open Date: 2021-01-07 23:04
Last Update: 2022-02-14 18:30

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-14 18:30 Updated by: cazfi

Comment:

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'

---------------------------------------------------------------------
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
アーカイブの一覧に戻る