チケット #41117

Savegame handling for counters

登録: 2021-01-08 06:00 最終更新: 2022-01-01 19:46

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

詳細

Save and load counter information. This require saving the order (counters_order), and the city counter values. It might make sense to save city_counters_order instead of order of global counters list - this is to be decided. Should also save boolean indicator that the freeciv revision doing the saving has hardcoded_counters. There's no need to read it yet, but it's there in the savegame for the benefit of the future freeciv revisions loading it.

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

2021-01-08 06:00 更新者: cazfi
  • 新しいチケット "Savegame handling for counters" が作成されました
2021-01-08 15:04 更新者: cazfi
  • 詳細が更新されました
2021-01-08 17:27 更新者: cazfi
  • 詳細が更新されました
2021-11-08 13:28 更新者: cazfi
コメント

Reply To cazfi

It might make sense to save city_counters_order instead of order of global counters list

I think it would get unnecessary complicated to figure out counter indices in the city counters list if we had only order of global counters list, so let's save city_counters_order.

2021-11-08 14:57 更新者: cazfi
  • 詳細が更新されました
2021-11-15 00:15 更新者: lachu
コメント

Reply To cazfi I send first patch.

2021-11-15 00:35 更新者: cazfi
コメント

Maybe you should start by saving the city counters order; "savefile.city_counters_size" and "savefile.city_counters_vector". See handling of action order ("savefile.action_size" & "savefile.action_vector") for example.

2021-11-27 02:18 更新者: lachu
2021-11-27 02:18 更新者: lachu
  • 添付ファイル 0001-Added-intial-counters-savegame-related-functions.patch (File ID: 8034) が削除されました
2021-11-27 02:18 更新者: lachu
コメント

Reply To cazfi

Maybe you should start by saving the city counters order; "savefile.city_counters_size" and "savefile.city_counters_vector". See handling of action order ("savefile.action_size" & "savefile.action_vector") for example.

I send patch, which save city counter indexes in correct order

2021-11-28 02:49 更新者: cazfi
  • 詳細が更新されました
コメント

You should save counter names to the order vector, not ids. If the counters get reordered, ids that anyway get assigned in order from 0 to MAX would not refer to the same counter as before.

2021-11-29 21:57 更新者: lachu
コメント

Reply To cazfi

You should save counter names to the order vector, not ids. If the counters get reordered, ids that anyway get assigned in order from 0 to MAX would not refer to the same counter as before.

I think we save entire ruleset, so the each-counter-related information too. Counter should not change order during gamplay, if freeciv save ruleset.

2021-11-30 15:14 更新者: cazfi
コメント

Reply To lachu

I think we save entire ruleset

No, we don't. That's the entire point of these "xxx-order" vectors.

We also can't save the ruleset, as format of those is specific to a freeciv version, and savegame loading must be backward compatible over several versions.

2021-12-08 00:18 更新者: lachu
コメント

Sorry for you must wait too long... I save counter (city) names instead of global position.

2021-12-08 00:19 更新者: lachu
コメント

Reply To cazfi

No, we don't. That's the entire point of these "xxx-order" vectors.

Read my post above.

2021-12-09 11:11 更新者: cazfi
コメント

Looks good so far. Just one code line is a bit long, so last parameter in the function call should be placed to a new line.

It also works; got this in the savegame:

city_counters_order_size=1
city_counters_order_vector="Owned"

Next step would be to save the counter value for each city. We need that even for the minimal patch to push to the repository - in it's current form it creates inconsistent savegames in that the "city_counters_order_size" claim there to be 1 counter saved for each city, but actually no counters are saved.

2021-12-09 11:27 更新者: cazfi
コメント

Reply To cazfi

Next step would be to save the counter value for each city. We need that even for the minimal patch to push to the repository - in it's current form it creates inconsistent savegames in that the "city_counters_order_size" claim there to be 1 counter saved for each city, but actually no counters are saved.

It's probably cleanest to save them in a new "counters" section, as vectors where first element is the city id (in case of city counters), and rest are counter values:

c0000=100,1,...
c0001=101,1,...
c0002=102,2,...

I'm open to different savegame format, if someone has a better idea.

2021-12-10 01:19 更新者: lachu
コメント

Reply To cazfi

Looks good so far. Just one code line is a bit long, so last parameter in the function call should be placed to a new line. It also works; got this in the savegame: city_counters_order_size=1
city_counters_order_vector="Owned" Next step would be to save the counter value for each city. We need that even for the minimal patch to push to the repository - in it's current form it creates inconsistent savegames in that the "city_counters_order_size" claim there to be 1 counter saved for each city, but actually no counters are saved.

Split function invocation patch added:

0001-save-city-counter-name-and-order.patch(2KB)
Separate line with long-function-invocation
2021-12-10 01:22 更新者: lachu
コメント

Reply To cazfi

Reply To cazfi

Next step would be to save the counter value for each city. We need that even for the minimal patch to push to the repository - in it's current form it creates inconsistent savegames in that the "city_counters_order_size" claim there to be 1 counter saved for each city, but actually no counters are saved.

It's probably cleanest to save them in a new "counters" section, as vectors where first element is the city id (in case of city counters), and rest are counter values: c0000=100,1,...
c0001=101,1,...
c0002=102,2,...
I'm open to different savegame format, if someone has a better idea.

I see (in sg_save_player_cities), there are information about city saves as plr(player_number).cty(city_number_related_to_player) is saved. What about making similar? It could be more readable form.

2021-12-19 05:07 更新者: lachu
コメント

Reply To cazfi

Reply To cazfi

Next step would be to save the counter value for each city. We need that even for the minimal patch to push to the repository - in it's current form it creates inconsistent savegames in that the "city_counters_order_size" claim there to be 1 counter saved for each city, but actually no counters are saved.

It's probably cleanest to save them in a new "counters" section, as vectors where first element is the city id (in case of city counters), and rest are counter values: c0000=100,1,...
c0001=101,1,...
c0002=102,2,...
I'm open to different savegame format, if someone has a better idea.

Done in way you suggest.

2021-12-19 21:16 更新者: cazfi
コメント

From CodingStyle:

- Use the postfix operator instead of the prefix operator when either will
work. That is, write "a++" instead of "++a".

Otherwise looks good.

2021-12-19 21:22 更新者: cazfi
コメント

Splitting this ticket to saving part (which is almost done), and a separate ticket to do the loading part -> #43426

There's no need for both of them to get pushed in to the repository at the same time, so splitting allows us to get this saving part in as soon as it's ready.

--

I think we should also implement the "Should also save boolean indicator that the freeciv revision doing the saving has hardcoded_counters." -part from the original description. Should probably go to "game" -section, i.e., "game.hardcoded_counters", always saved as TRUE.

2021-12-24 00:53 更新者: lachu
コメント

Reply To cazfi

Splitting this ticket to saving part (which is almost done), and a separate ticket to do the loading part -> #43426 There's no need for both of them to get pushed in to the repository at the same time, so splitting allows us to get this saving part in as soon as it's ready. -- I think we should also implement the "Should also save boolean indicator that the freeciv revision doing the saving has hardcoded_counters." -part from the original description. Should probably go to "game" -section, i.e., "game.hardcoded_counters", always saved as TRUE.

Done

2021-12-30 00:17 更新者: cazfi
  • 担当者(未割り当て) から cazfi に更新されました
  • 解決法なし から 受領 に更新されました
2022-01-01 19:46 更新者: cazfi
  • 状況オープン から 完了 に更新されました
  • 解決法受領 から 修正済み に更新されました

添付ファイルリスト

編集

ログインしていません。ログインしていない状態では、コメントに記載者の記録が残りません。 » ログインする