Incidencia #45891

Ruledit: Counters count

Abrir Fecha: 2022-10-17 20:15 Última actualización: 2023-01-04 01:17

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Hito:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
4

Details

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

Ticket History (3/20 Histories)

2022-10-17 20:15 Updated by: cazfi
  • New Ticket "Ruledit: Counters count" created
2022-11-18 00:20 Updated by: lachu
Comentario

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 Updated by: cazfi
Comentario

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 Updated by: lachu
Comentario

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 Updated by: cazfi
Comentario

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 Updated by: lachu
Comentario

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 Updated by: lachu
Comentario

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 Updated by: cazfi
Comentario

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 Updated by: lachu
Comentario

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 Updated by: lachu
Comentario

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 Updated by: cazfi
Comentario

- 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 Updated by: lachu
Comentario

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 Updated by: lachu
Comentario

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 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
2023-01-01 14:05 Updated by: cazfi
Comentario

Looks good now.

2023-01-04 01:17 Updated by: cazfi
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Attachment File List

Editar

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