待辦事項 #42666

Lua: API to unhardcode autoupgrade

啟用日期: 2021-07-24 23:41 最後更新: 2022-02-10 07:55

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
修正
檔案:
4

細節

This is a sub-task of #42659. Needed functions (test ones are probably common, edit ones are server scripting):

  • test if a unit may be converted (upgraded) to a given type regarding its current position, transporter and cargo;
  • get a unit type a player may upgrade a unit type to;
  • convert (upgrade) a unit to a given type (if it is possible; a double testing will likely occur in the loop but it's not fatal);
  • promote a unit given number of veteranship ranks (may be negative) clipped by its veteran system, no notifications sent; naturally accompanied by general veteranship getting functions;
  • an algorithm (in Lua or C) to get a random selection from a list.

Ticket History (3/14 Histories)

2021-07-24 23:41 Updated by: ihnatus
  • New Ticket "Lua: API to unhardcode autoupgrade" created
2022-02-06 06:44 Updated by: ihnatus
評語

Done. Based on a patch from #43778

2022-02-07 07:51 Updated by: cazfi
評語

default case from api_methods_unit_transform_problem() switch should be removed, and the assert placed after the block (all valid 'uu' values cause function to return from inside the switch). That way we get compiler warning in the future if there's a new 'enum unit_upgrade_result' added, but not handled in the switch.

2022-02-08 02:29 Updated by: ihnatus
  • File 3_1-lua-api-upgrades2.patch (File ID: 8482) is attached
2022-02-08 02:29 Updated by: ihnatus
評語

Switch edited.

2022-02-08 04:03 Updated by: ihnatus
  • File 3_1-lua-api-upgrades2.patch (File ID: 8482) is deleted
2022-02-08 15:34 Updated by: cazfi
評語

Patch looks good to me (haven't tested it yet). The only concern is that is this future-proof (to not cause compatibility issues) concerning what ever way #43251 will get resolved.

2022-02-08 16:07 Updated by: cazfi
  • 負責人 Update from (無) to cazfi
  • 處理結果 Update from to Accepted
評語

Git was complaining about a new trailing whitespace. Attached version with that fixed.

Reply To cazfi

The only concern is that is this future-proof (to not cause compatibility issues) concerning what ever way #43251 will get resolved.

Beginning review period regardless. People have 36h to comment, and that includes possibility to comment about #43251 compatibility.

2022-02-09 19:48 Updated by: cazfi
評語

Reply To cazfi

Git was complaining about a new trailing whitespace. Attached version with that fixed. Reply To cazfi

The only concern is that is this future-proof (to not cause compatibility issues) concerning what ever way #43251 will get resolved.

Beginning review period regardless. People have 36h to comment, and that includes possibility to comment about #43251 compatibility.

My own take is that after this goes in (and to a released datafile format), we just need to resolve #43251 in a way that retains compatibility. It can add stuff, but will have some limitations how it can rework existing functionality.

2022-02-10 07:55 Updated by: cazfi
  • 狀態 Update from 開啟 to 關閉
  • 處理結果 Update from Accepted to 修正

Attachment File List

編輯

Please login to add comment to this ticket » 登入