Tíquete #42666

Lua: API to unhardcode autoupgrade

: 2021-07-24 23:41 Última Atualização: 2022-02-10 07:55

Relator:
Dono:
Estado:
Fechado
Componente:
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
4

Details

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
Comentário

Done. Based on a patch from #43778

2022-02-07 07:51 Updated by: cazfi
Comentário

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
Comentário

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
Comentário

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
  • Dono Update from (Nenhum) to cazfi
  • Resolução Update from Nenhum to Accepted
Comentário

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
Comentário

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
  • Estado Update from Aberto to Fechado
  • Resolução 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. » Login