Ticket #42666

Lua: API to unhardcode autoupgrade

Eröffnet am: 2021-07-24 23:41 Letztes Update: 2022-02-10 07:55

Auswertung:
Verantwortlicher:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
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-Verlauf (3/14 Historien)

2021-07-24 23:41 Aktualisiert von: ihnatus
  • New Ticket "Lua: API to unhardcode autoupgrade" created
2022-02-06 06:44 Aktualisiert von: ihnatus
Kommentar

Done. Based on a patch from #43778

2022-02-07 07:51 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: ihnatus
  • File 3_1-lua-api-upgrades2.patch (File ID: 8482) is attached
2022-02-08 02:29 Aktualisiert von: ihnatus
Kommentar

Switch edited.

2022-02-08 04:03 Aktualisiert von: ihnatus
  • File 3_1-lua-api-upgrades2.patch (File ID: 8482) is deleted
2022-02-08 15:34 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Keine to Accepted
Kommentar

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 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Lösung Update from Accepted to Gefixt

Dateianhangliste

Bearbeiten

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Anmelden