チケット #47828

Counters: "User City Counter"

登録: 2023-04-10 10:30 最終更新: 2024-02-24 11:48

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

詳細

New city counter behavior: "User City Counter".

Depends on #47827

This counter type gets adjusted by new lua methods. E.g. (there might be better API):
- Counter:increase(City)
- Counter:zero(City)

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

2023-04-10 10:30 更新者: cazfi
  • 新しいチケット "Counters: "User City Counter"" が作成されました
2023-06-23 01:34 更新者: lachu
  • 添付ファイル 0002-OSDN-47828-Implementation.patch (File ID: 12687) が付加されました
2023-06-23 01:34 更新者: lachu
  • 添付ファイル 0002-OSDN-47828-Implementation.patch (File ID: 12687) が削除されました
2023-06-23 01:37 更新者: lachu
コメント

Reply To cazfi

New city counter behavior: "User City Counter". Depends on #47827 This counter type gets adjusted by new lua methods. E.g. (there might be better API):
- Counter:increase(City)
- Counter:zero(City)

0001-OSDN-47828-Implementation.patch(2KB)
Implementation part

0002-OSDN-47828-TEST.patch(1KB)

Test patch

Test patch add love king effect depending on building ruler have built in city. When city was conquered, effect was zeroed. Mooders can enhance this behavior by limiting improvements type, which will increase counter.

2023-06-23 21:15 更新者: lachu
コメント

Reply To cazfi

New city counter behavior: "User City Counter". Depends on #47827 This counter type gets adjusted by new lua methods. E.g. (there might be better API):
- Counter:increase(City)
- Counter:zero(City)

0002-OSDN-47828-Implementation-2.patch(5KB)
Move increase/zero counter value to server + sends update to clients once changed

This version of implementation was quite better.

2023-06-23 21:21 Updated by: lachu

File 0001-OSDN-47828-Check.patch (File ID: 12702) is attached

Sanity checks, if needed. I am trying answer my own question, if we need to is_user_counter function in lua?

(編集済, 2023-06-23 21:22 更新者: lachu)
2023-08-25 04:04 更新者: lachu
コメント

Reply To cazfi

New city counter behavior: "User City Counter". Depends on #47827 This counter type gets adjusted by new lua methods. E.g. (there might be better API):
- Counter:increase(City)
- Counter:zero(City)

Implementation-3(5KB)
New version of implementation.
2024-01-02 05:50 更新者: cazfi
コメント
+void api_counter_increase(lua_State *L,Counter *c, City *city)

Add space between comma and "Counter". There are several cases like this in the patch

fc_assert_ret_msg(CB_USER == c->type, "Lua: cannot change non-user counter");

This should not be an asserting engine (C-code) behavior, as the lua-script can very well trigger it. Should have a regular check, and error message, against illegal lua-script input.

+#endif

-> #endif /* FCAPI_GAME_COUNTERS_H */

api_server_counters.c should be added to Meson based build too.

2024-01-13 02:55 更新者: lachu
コメント

Reply To cazfi

{{{ +void api_counter_increase(lua_State *L,Counter *c, City *city) }}} Add space between comma and "Counter". There are several cases like this in the patch {{{ fc_assert_ret_msg(CB_USER == c->type, "Lua: cannot change non-user counter"); }}} This should not be an asserting engine (C-code) behavior, as the lua-script can very well trigger it. Should have a regular check, and error message, against illegal lua-script input. {{{ +#endif }}}

0001-OSDN-47828-S-awomir-Lach-slawek-lach.art.pl.patch(5KB)
Repair coding style

-> #endif /* FCAPI_GAME_COUNTERS_H */ api_server_counters.c should be added to Meson based build too.

2024-01-13 03:01 更新者: lachu
コメント

Reply To cazfi

{{{ +void api_counter_increase(lua_State *L,Counter *c, City *city) }}} Add space between comma and "Counter". There are several cases like this in the patch {{{ fc_assert_ret_msg(CB_USER == c->type, "Lua: cannot change non-user counter"); }}} This should not be an asserting engine (C-code) behavior, as the lua-script can very well trigger it. Should have a regular check, and error message, against illegal lua-script input. {{{ +#endif }}} -> #endif /* FCAPI_GAME_COUNTERS_H */ api_server_counters.c should be added to Meson based build too.

0001-OSDN-47828-S-awomir-Lach-slawek-lach.art.pl.patch(5KB)
Fulfill @cazfi request
2024-01-13 05:10 更新者: cazfi
コメント

meson build (though I assume autotools build to have the same warnings):

[206/645] Compiling C object libfc_server.a.p/meson-generated_tolua_server_gen.c.o
FAILED: libfc_server.a.p/meson-generated_tolua_server_gen.c.o 
ccache cc -Ilibfc_server.a.p -I. -I../src -I../src/dependencies/luasql/src -I../src/dependencies/tinycthread -I../src/dependencies/tolua-5.2/include -I../src/dependencies/cvercmp -I../src/utility -I../src/common -I../src/common/networking -I../src/common/scriptcore -I../src/common/aicore -I../src/server -I../src/server/advisors -I../src/server/scripting -I../src/server/generator -I../src/server/ruleset -I../src/server/savegame -I../src/ai -I../src/ai/classic -I/usr/include/lua5.4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O0 -g -Wno-nonnull-compare -Wnested-externs -Wall -Wmissing-declarations -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wshadow -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wimplicit-fallthrough -Wshadow -DHAVE_CONFIG_H -fPIC -MD -MQ libfc_server.a.p/meson-generated_tolua_server_gen.c.o -MF libfc_server.a.p/meson-generated_tolua_server_gen.c.o.d -o libfc_server.a.p/meson-generated_tolua_server_gen.c.o -c libfc_server.a.p/tolua_server_gen.c
libfc_server.a.p/tolua_server_gen.c: In function ‘tolua_tolua_server_Counter_increase00’:
libfc_server.a.p/tolua_server_gen.c:212:3: error: implicit declaration of function ‘api_counter_increase’ [-Werror=implicit-function-declaration]
  212 |   api_counter_increase(L,c,city);
      |   ^~~~~~~~~~~~~~~~~~~~
libfc_server.a.p/tolua_server_gen.c:212:3: error: nested extern declaration of ‘api_counter_increase’ [-Werror=nested-externs]
libfc_server.a.p/tolua_server_gen.c: In function ‘tolua_tolua_server_Counter_zero00’:
libfc_server.a.p/tolua_server_gen.c:241:3: error: implicit declaration of function ‘api_counter_zero’ [-Werror=implicit-function-declaration]
  241 |   api_counter_zero(L,c,city);
      |   ^~~~~~~~~~~~~~~~
libfc_server.a.p/tolua_server_gen.c:241:3: error: nested extern declaration of ‘api_counter_zero’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
[226/645] Compiling C object libfc_server.a.p/server_scripting_api_server_counters.c.o
FAILED: libfc_server.a.p/server_scripting_api_server_counters.c.o 
ccache cc -Ilibfc_server.a.p -I. -I../src -I../src/dependencies/luasql/src -I../src/dependencies/tinycthread -I../src/dependencies/tolua-5.2/include -I../src/dependencies/cvercmp -I../src/utility -I../src/common -I../src/common/networking -I../src/common/scriptcore -I../src/common/aicore -I../src/server -I../src/server/advisors -I../src/server/scripting -I../src/server/generator -I../src/server/ruleset -I../src/server/savegame -I../src/ai -I../src/ai/classic -I/usr/include/lua5.4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O0 -g -Wno-nonnull-compare -Wnested-externs -Wall -Wmissing-declarations -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wshadow -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wimplicit-fallthrough -Wshadow -DHAVE_CONFIG_H -fPIC -MD -MQ libfc_server.a.p/server_scripting_api_server_counters.c.o -MF libfc_server.a.p/server_scripting_api_server_counters.c.o.d -o libfc_server.a.p/server_scripting_api_server_counters.c.o -c ../src/server/scripting/api_server_counters.c
../src/server/scripting/api_server_counters.c: In function ‘api_counter_increase’:
../src/server/scripting/api_server_counters.c:40:5: error: implicit declaration of function ‘fc_print’; did you mean ‘fc_isprint’? [-Werror=implicit-function-declaration]
   40 |     fc_print("[CB_USER == c->type] Lua: cannot change non-user counter");
      |     ^~~~~~~~
      |     fc_isprint
../src/server/scripting/api_server_counters.c:40:5: error: nested extern declaration of ‘fc_print’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
[239/645] Compiling C object libfc_server.a.p/server_savegame_savegame3.c.o
ninja: build stopped: subcommand failed.

2024-01-13 21:20 更新者: lachu
コメント

Reply To cazfi

meson build (though I assume autotools build to have the same warnings): {{{ 206/645 Compiling C object libfc_server.a.p/meson-generated_tolua_server_gen.c.o FAILED: libfc_server.a.p/meson-generated_tolua_server_gen.c.o ccache cc -Ilibfc_server.a.p -I. -I../src -I../src/dependencies/luasql/src -I../src/dependencies/tinycthread -I../src/dependencies/tolua-5.2/include -I../src/dependencies/cvercmp -I../src/utility -I../src/common -I../src/common/networking -I../src/common/scriptcore -I../src/common/aicore -I../src/server -I../src/server/advisors -I../src/server/scripting -I../src/server/generator -I../src/server/ruleset -I../src/server/savegame -I../src/ai -I../src/ai/classic -I/usr/include/lua5.4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O0 -g -Wno-nonnull-compare -Wnested-externs -Wall -Wmissing-declarations -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wshadow -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wimplicit-fallthrough -Wshadow -DHAVE_CONFIG_H -fPIC -MD -MQ libfc_server.a.p/meson-generated_tolua_server_gen.c.o -MF libfc_server.a.p/meson-generated_tolua_server_gen.c.o.d -o libfc_server.a.p/meson-generated_tolua_server_gen.c.o -c libfc_server.a.p/tolua_server_gen.c libfc_server.a.p/tolua_server_gen.c: In function ‘tolua_tolua_server_Counter_increase00’: libfc_server.a.p/tolua_server_gen.c:212:3: error: implicit declaration of function ‘api_counter_increase’ -Werror=implicit-function-declaration 212 | api_counter_increase(L,c,city); | ~ libfc_server.a.p/tolua_server_gen.c:212:3: error: nested extern declaration of ‘api_counter_increase’ -Werror=nested-externs libfc_server.a.p/tolua_server_gen.c: In function ‘tolua_tolua_server_Counter_zero00’: libfc_server.a.p/tolua_server_gen.c:241:3: error: implicit declaration of function ‘api_counter_zero’ -Werror=implicit-function-declaration 241 | api_counter_zero(L,c,city); | ~ libfc_server.a.p/tolua_server_gen.c:241:3: error: nested extern declaration of ‘api_counter_zero’ -Werror=nested-externs cc1: all warnings being treated as errors 226/645 Compiling C object libfc_server.a.p/server_scripting_api_server_counters.c.o FAILED: libfc_server.a.p/server_scripting_api_server_counters.c.o ccache cc -Ilibfc_server.a.p -I. -I../src -I../src/dependencies/luasql/src -I../src/dependencies/tinycthread -I../src/dependencies/tolua-5.2/include -I../src/dependencies/cvercmp -I../src/utility -I../src/common -I../src/common/networking -I../src/common/scriptcore -I../src/common/aicore -I../src/server -I../src/server/advisors -I../src/server/scripting -I../src/server/generator -I../src/server/ruleset -I../src/server/savegame -I../src/ai -I../src/ai/classic -I/usr/include/lua5.4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O0 -g -Wno-nonnull-compare -Wnested-externs -Wall -Wmissing-declarations -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wformat -Wformat-security -Wshadow -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wimplicit-fallthrough -Wshadow -DHAVE_CONFIG_H -fPIC -MD -MQ libfc_server.a.p/server_scripting_api_server_counters.c.o -MF libfc_server.a.p/server_scripting_api_server_counters.c.o.d -o libfc_server.a.p/server_scripting_api_server_counters.c.o -c ../src/server/scripting/api_server_counters.c ../src/server/scripting/api_server_counters.c: In function ‘api_counter_increase’: ../src/server/scripting/api_server_counters.c:40:5: error: implicit declaration of function ‘fc_print’; did you mean ‘fc_isprint’? -Werror=implicit-function-declaration 40 | fc_print("== c->type Lua: cannot change non-user counter"); | ~ | fc_isprint ../src/server/scripting/api_server_counters.c:40:5: error: nested extern declaration of ‘fc_print’ -Werror=nested-externs cc1: all warnings being treated as errors 239/645 Compiling C object libfc_server.a.p/server_savegame_savegame3.c.o ninja: build stopped: subcommand failed. }}}

Sorry. I must tell I do not test previous patch. I though it was too small change, It won't broke anythink. Current patch was compiled:

0001-OSDN-47828-S-awomir-Lach-slawek-lach.art.pl.patch(6KB)
Repair compilation/link errors
2024-02-18 03:33 更新者: lachu
コメント

Hi. I see this change on main branch, but this ticket has no resolution.

2024-02-18 03:33 更新者: lachu
コメント
(このコメントは削除されました)
2024-02-18 03:33 更新者: lachu
コメント
(このコメントは削除されました)
2024-02-18 03:48 更新者: cazfi
コメント

Reply To lachu

Hi. I see this change on main branch, but this ticket has no resolution.

It's not in freeciv repo, Likely you have cherry-picked or applied to your local main branch.

2024-02-18 03:56 更新者: cazfi
  • 担当者(未割り当て) から cazfi に更新されました
  • 解決法なし から 受領 に更新されました
2024-02-24 11:48 更新者: cazfi
  • 状況オープン から 完了 に更新されました
  • 解決法受領 から 修正済み に更新されました

添付ファイルリスト

編集

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