Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuver

Aperta Adatta ai principianti
#7,914 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp, lua
Ambito
game-dev

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

  1. FSO master 12a36dc1a (also current as of 76219fd1e; aicode.cpp is unchanged between them), release build, Linux, MediaVPs 5.0.2.
  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.
  3. 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.
  4. Both ships: doManeuver(3000, 100,0,0,false, 0,0,0,false, 0) (full heading rotation for 3 seconds). The equivalent sexps are ship-lat-maneuver with duration 1000 and forward 100, then ship-rot-maneuver with duration 3000 and heading 100.
  5. 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

  1. Add the missing !. Make the rotational test in ai_control_info_apply read !timestamp_elapsed(aip->ai_override_rot_timestamp), matching the lateral test two lines above. One character.
  2. Fix 1 plus reset the two maneuver timers when a ship is created. init_ai_object does not touch ai_override_lat_timestamp or 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.
  3. 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_upkeep already 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scp-fs2open/fs2open.github.com

Tutte le issue di scp-fs2open/fs2open.github.com

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.