#41115: Counter getter functions Open Date: 2021-01-08 05:46 Last Update: 2021-07-04 22:48 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/41115 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=41115 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2021-07-04 22:48 Updated by: lachu Comment: Reply To kvilhaugsvik Reply To lachu Reply To kvilhaugsvik If you remove the default the compiler will complain when a new counter_target is added but not handled in the switch statement. That's bad? I understood, I should handle something like COUNTER_TYPE_LAST instead of all other cases. I did not remove default from counter_target switch. I was trying to recommend removing the default in the switch in counter_by_index() so people that add more are forced to fill it in. Thanks. Done. --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: kvilhaugsvik Type: Patches Status: Open [Owner assigned] Priority: 5 - Medium MileStone: 3.2.0 Component: General Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: These functions will be needed for building anything on counters module: struct counter *counter_by_id(int id) int counter_id(struct counter *pcount) struct counter *counter_by_rule_name(const char *name) const char *counter_rule_name(struct counter *pcount) int counter_index(struct counter *pcount) struct counter *counter_by_index(int index, enum counter_target target) -- 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/41115 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=41115