チケット #45891

Ruledit: Counters count

登録: 2022-10-17 20:15 最終更新: 2023-01-04 01:17

報告者:
担当者:
チケットの種類:
状況:
完了
コンポーネント:
マイルストーン:
優先度:
5 - 中
重要度:
5 - 中
解決法:
修正済み
ファイル:
4

詳細

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

チケットの履歴 (20 件中 3 件表示)

2022-10-17 20:15 更新者: cazfi
  • 新しいチケット "Ruledit: Counters count" が作成されました
2022-11-18 00:20 更新者: lachu
コメント

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 更新者: 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.

2022-11-30 22:24 更新者: lachu
コメント

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 更新者: 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?

2022-12-05 00:09 更新者: lachu
コメント

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 更新者: lachu
コメント

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 更新者: cazfi
コメント

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 更新者: lachu
コメント

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 更新者: lachu
コメント

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 更新者: 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 20:53 更新者: lachu
コメント

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 更新者: lachu
コメント

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 更新者: cazfi
  • 担当者(未割り当て) から cazfi に更新されました
  • 解決法なし から 受領 に更新されました
2023-01-01 14:05 更新者: cazfi
コメント

Looks good now.

2023-01-04 01:17 更新者: cazfi
  • 状況オープン から 完了 に更新されました
  • 解決法受領 から 修正済み に更新されました

添付ファイルリスト

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする