P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuver
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
L’issue individua il controllo difettoso del timer di rotazione in aicode.cpp, in ai_control_info_apply; leggi quella funzione e confronta la sua condizione di rotazione con quella laterale. Modifica il controllo del tempo trascorso in modo che venga riconosciuta una finestra di rotazione attiva, poi riproduci la manovra laterale temporizzata seguita da una rotazione temporizzata e conferma che entrambe le navi girano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
A timed rotation maneuver (ship-rot-maneuver with a duration, or the rotation half of ship-maneuver, or Lua ship:doManeuver) does nothing on a ship that earlier ran a timed lateral maneuver which has since expired. The same call on a ship that never had a lateral maneuver works. FREDders see a rotation that works in one mission and silently fails in another depending on what the ship did before.
The cause is a missing ! in aicode.cpp. In ai_control_info_apply the lateral check reads "never expires, or the lateral timer has NOT elapsed", but the rotational check reads "never expires, or the rotational timer HAS elapsed", so a live rotation window never counts as a rotational maneuver. Rotations are only applied while the lateral window counts as live. A lateral timer that was never set (0) counts as not elapsed, which is why a fresh ship rotates. Once any finite lateral maneuver on that ship has expired, both booleans are false during the rotation window and the override block is skipped.
Steps to reproduce
- FSO master 12a36dc1a (also current as of 76219fd1e;
aicode.cppis unchanged between them), release build, Linux, MediaVPs 5.0.2. - In any mission, two hostile GTF Ulysses, A and B, both given a play-dead order so the AI does not steer. I created them from Lua with
mn.createShip, facing +Z. - Ship A:
A:doManeuver(1000, 0,0,0,false, 0,0,100,false, 0)(forward thrust for 1 second). Wait at least 3 seconds for it to expire. - Both ships:
doManeuver(3000, 100,0,0,false, 0,0,0,false, 0)(full heading rotation for 3 seconds). The equivalent sexps areship-lat-maneuverwith duration 1000 and forward 100, thenship-rot-maneuverwith duration 3000 and heading 100. - After the 3 seconds, read each ship's forward vector (
Orientation:getFvec()).
Expected vs. actual behavior
Expected: both ships have turned the same amount.
Actual: ship B (no earlier lateral maneuver) turned; its forward vector went from (0, 0, 1) to (0.895, -0.438, 0.090). Ship A (earlier 1 s lateral maneuver) did not move at all; its forward vector stayed (0, 0, 1). Both doManeuver calls returned true.
Proposed fixes
- Add the missing
!. Make the rotational test inai_control_info_applyread!timestamp_elapsed(aip->ai_override_rot_timestamp), matching the lateral test two lines above. One character. - Fix 1 plus reset the two maneuver timers when a ship is created.
init_ai_objectdoes not touchai_override_lat_timestampor the rotational timer, so a reused AI slot can inherit an old expired timer; clearing both at creation removes the "works on fresh ships only" variability even for code paths that still read the lateral timer. - Apply the two halves independently. Instead of one combined "any maneuver live" gate around the whole block, apply the rotational values when the rotational window is live and the lateral values when the lateral window is live. Clearer, but a larger edit to a block that the expiry code in
ai_control_info_flags_upkeepalready keeps mostly correct.
- Lingua principale
- C++
- Stelle
- 488
- Fork
- 184
- Merge medio
- 2g 8h
- PR unite (30g)
- 41
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scp-fs2open/fs2open.github.com
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
scp-fs2open/fs2open.github.com#7901 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
scp-fs2open/fs2open.github.com#7899 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
scp-fs2open/fs2open.github.com#7890 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 43/100
scp-fs2open/fs2open.github.com#7913 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
scp-fs2open/fs2open.github.com#7912 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di scp-fs2open/fs2open.github.com
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ROCm/rocm-libraries#14027 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Qiskit/qiskit-aer#2487 ·
I maintainer di solito rispondono entro 1 giorno
-
GUI
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
qbittorrent/qBittorrent#25104 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno