Ticket #45891

Ruledit: Counters count

Eröffnet am: 2022-10-17 20:15 Letztes Update: 2023-01-04 01:17

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
4

Details

Ruledit should show number of counters in the ruleset in the statistics.

Ticket-Verlauf (3/20 Historien)

2022-10-17 20:15 Aktualisiert von: cazfi
  • New Ticket "Ruledit: Counters count" created
2022-11-18 00:20 Aktualisiert von: lachu
Kommentar

Reply To cazfi

Ruledit should show number of counters in the ruleset in the statistics.

First patch suggestion was made. Only one think not clear to me is: ruledit_disabled . Why this is introduced? Should counters have the same field as (for example) multipliers?

2022-11-28 11:34 Aktualisiert von: cazfi
Kommentar

Reply To lachu

Only one think not clear to me is: ruledit_disabled . Why this is introduced?

It allows "removing" ruleset item without very complex rearrangements in the memory. That is; item in an array just gets marked as "ruledit_disabled" and later items in the array remain where they are, instead of all the later items moving to fill the hole. It would be practically impossible to update all the references to those later items.

2022-11-30 22:24 Aktualisiert von: lachu
Kommentar

Reply To cazfi

Reply To lachu

Only one think not clear to me is: ruledit_disabled . Why this is introduced?

It allows "removing" ruleset item without very complex rearrangements in the memory. That is; item in an array just gets marked as "ruledit_disabled" and later items in the array remain where they are, instead of all the later items moving to fill the hole. It would be practically impossible to update all the references to those later items.

Hi. Should I introduce ruledit_enable in counter's struct? I introduced routine to remove counter in #45892 and there is small amount of entries in counter's array. Also, we do not have to keep specialized counter array (for city' counter, for example), because for ruledit we do not need it - there is no gameplay active, so we not need cache or mateinformation for city generation purposes.

I think adding bool ruledit_enabled is not necessary for counters.

2022-11-30 22:51 Aktualisiert von: cazfi
Kommentar

Reply To lachu

Hi. Should I introduce ruledit_enable in counter's struct? I introduced routine to remove counter in #45892 and there is small amount of entries in counter's array.

So, what happens, e.g, to requirements of the "Counter" type, pointing to a later counter than the removed one, when a counter is removed?

2022-12-05 00:09 Aktualisiert von: lachu
Kommentar

Reply To cazfi

Reply To lachu

Hi. Should I introduce ruledit_enable in counter's struct? I introduced routine to remove counter in #45892 and there is small amount of entries in counter's array.

So, what happens, e.g, to requirements of the "Counter" type, pointing to a later counter than the removed one, when a counter is removed?

Yes. You are right. I have other question. How freeciv track reference count, so I am sure that I can reuse counter index?

2022-12-10 04:51 Aktualisiert von: lachu
Kommentar

Ok. I figure out is_counter_needed is necessary, which I implemented. If counter is not needed, I can mark it as disabled and free one's memory.

2022-12-25 09:12 Aktualisiert von: cazfi
Kommentar

In addition to already mentioned city_counters_re_active_iterate() change (implementation of the macros, and using them):
- Place this to the middle column (currently leftmost has one row more than others, should add that row to middle one before the rightmost one)
- Use postfix 'count++;' instead of prefix '++count;'

2022-12-31 04:40 Aktualisiert von: lachu
Kommentar

2022-12-31 04:35 Updated by: lachu

File 0001-OSDN-Ticket-45891-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 11245) is attached

Suggested changes was apply by this patch.

2022-12-31 05:27 Aktualisiert von: lachu
Kommentar

2022-12-31 05:25 Updated by: lachu

File 0001-OSDN-Ticket-45891-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 11246) is attached

I do not known if should I send this patch here or on editing ruleset ticket. It brings ruledit_disabled entity and add new macro-iterator for ruledit purposes. But.. After all, this code (counting counter) should look like this. Also, when counter is disabled, it should not be counted. right?

2022-12-31 17:48 Aktualisiert von: cazfi
Kommentar

- Does not apply to current HEAD (counters.c)
- While we currently have only city counters, there's no point in making things specific for them when generic counters support would be as easy (or easier!):

- Drop the "city_" -prefix from the iterator macro name
- Make it to iterate over all counters (up to game.control.num_counters)

- There's trailing space in the macro. You may want to check your git/terminal settings to make sure 'git diff' shows these to you on easily noticed color.
- What you are including "support.h" for, to counters.h? Don't see rest of the change to the file requiring anything from there. If it does, add "/* utility */" header for the include group

2022-12-31 20:53 Aktualisiert von: lachu
Kommentar

Reply To cazfi

- Does not apply to current HEAD (counters.c)
- While we currently have only city counters, there's no point in making things specific for them when generic counters support would be as easy (or easier!):
- Drop the "city_" -prefix from the iterator macro name
- Make it to iterate over all counters (up to game.control.num_counters)
- There's trailing space in the macro. You may want to check your git/terminal settings to make sure 'git diff' shows these to you on easily noticed color.
- What you are including "support.h" for, to counters.h? Don't see rest of the change to the file requiring anything from there. If it does, add "/* utility */" header for the include group

I included support.h for boolean type.

2022-12-31 23:22 Aktualisiert von: lachu
Kommentar

Reply To cazfi

- Does not apply to current HEAD (counters.c)
- While we currently have only city counters, there's no point in making things specific for them when generic counters support would be as easy (or easier!):
- Drop the "city_" -prefix from the iterator macro name
- Make it to iterate over all counters (up to game.control.num_counters)
- There's trailing space in the macro. You may want to check your git/terminal settings to make sure 'git diff' shows these to you on easily noticed color.
- What you are including "support.h" for, to counters.h? Don't see rest of the change to the file requiring anything from there. If it does, add "/* utility */" header for the include group

2022-12-31 23:22 Updated by: lachu

File 0001-OSDN-Ticket-45891-S-awomir-Lach-slawek-lach.art.pl.patch (File ID: 11265) is attached
2023-01-01 14:04 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
2023-01-01 14:05 Aktualisiert von: cazfi
Kommentar

Looks good now.

2023-01-04 01:17 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Dateianhangliste

Bearbeiten

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Anmelden