#47292: Unit counters framework Open Date: 2023-02-02 20:25 Last Update: 2023-06-10 01:16 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/47292 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=47292 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2023-06-10 01:16 Updated by: cazfi Comment: Sorry the review took so long. (But maybe you too should concentrate primarily to those patches that are targeted to 3.2 already, S3_2 d3f is in a year) --- - There's one use of "malloc()" that should be "fc_malloc()" - In load_ruleset_game() reading the counter target entry twice (once with direct secfile_entry_lookup() and once through secfile_lookup_str_default() ) doesn't serve any function, I think. At least we don't do that for anything else. I would drop counter_type_entry - It would be better to set target correctly for 3.2 counters as soon as they are loaded, and not to all of them after ruleset has been loaded completely. It would make fixing bugs easier in this patch already, and likely becomes only more important during freeciv-3.3 development. Implement something like: ct = counter_target_by_name(counter_target_3_3(compat, counter_type), fc_strcasecmp); where counter_target_3_3() will return either counter_type back, or possibly "City" in case of compatibility mode 3.2 ruleset loading. - Should be on the same line: + } + else if (CTGT_CITY != ct) { - "ruleset in format 30" - Use freeciv version numbers instead of format number --- Didn't look at the documentation yet. If you provide multiple patches to apply, could you at least have different names for them (not overwriting each other when downloaded). Likely the simplest way is to use 'git format-patch' over the entire branch to get "0001-....patch" and "0002-....patch" --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: (None) Type: Patches Status: Open Priority: 5 - Medium MileStone: 3.3.0 Component: General Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: Add initial support for unit counters. No need to implement any counter behavior in this ticket - current counters code should be flexible enough to work (iterate over) zero counter behaviors and counter instances. --- - Add counter_target type "Unit" - Add counters_get_unit_counters_count() - Implement unit_counters_iterate(pcount) macro (mostly by copying ciyt_counters_iterate() and modifying a bit) - Add "counter_values" to unit structure Savegame part likely isn't as trivial "copy from city counters implementation" -> let's leave that to another ticket. -- 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/47292 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=47292