Skip to content

P3: Store All Teams at War as a mission flag - #8031

Open
dustinspace217 wants to merge 1 commit into
scp-fs2open:masterfrom
dustinspace217:fix/all-teams-at-war-mission-flag
Open

dustinspace217 wants to merge 1 commit into
scp-fs2open:masterfrom
dustinspace217:fix/all-teams-at-war-mission-flag

Conversation

@dustinspace217

Copy link
Copy Markdown
Contributor

What?

All Teams at War is now kept as a mission flag, like Red Alert and Scramble, instead of a global variable. The +All Teams Attack line sets the flag, the game and the save code read it, and FRED and qtFRED edit it. The global is gone.

Why?

This was asked for in the review of #8028. The flag already existed, and qtFRED's mission specs list ticked it, but nothing read it. Ticking All Teams at War in qtFRED never reached the saved mission or the game.

How?

  • The +All Teams Attack line sets Mission::Mission_Flags::All_attack. Its separate reset is gone, since the mission reset already clears the flags.
  • The IFF check and the save code read the flag.
  • FRED's checkbox reads and writes the flag next to Red Alert and Scramble, so its existing flag comparison marks the mission changed.
  • qtFRED already edited the flag from its list. Its copy of the global and an unused setter are removed.

Testing?

  • Game, Debug, Linux, OpenGL and Vulkan, master and this branch, with Lua team:attacks() for every pair of teams:
    • Between the Ashes bta2_m1_03, which uses the line: at war on both builds.
    • Retail SM1-01: not at war on both builds.
    • A copy of SM1-01 with only the flag: at war on this branch, not on master.
    • The logs match between master and this branch.
  • qtFRED: ticking saves the line and the flag. A mission with the line opens ticked, and unticking removes both. A mission with only the flag gains the line when saved.
  • FRED, built with MSVC on Windows 11: the same editor cells, same results.
  • Debug and Release build without warnings, and the unit tests pass.
  • Not run: multiplayer, campaign play, and the retail and compatibility save formats. The flag is not sent over the network, since each machine reads its own mission file, and the line is written in every format.

Anything Else?

  • A mission saved by qtFRED with All Teams at War ticked has the flag but not the line, so it never started at war. With this change it does, which is what its designer ticked. One catch: FRED on master shows that box unticked for such a mission, because it read the old global, so a designer who then worked in FRED may have expected peace. None of the roughly 2,000 loose mission files in my mod library has the flag, but I did not check missions packed in VP files.
  • A mission with only the line gains the flag in +Flags: the next time it is saved. The line is still written, so older builds read it as before.
  • I wrote this with help from Claude Code.

All Teams at War lived in a global variable set by the +All Teams Attack line, while qtFRED's mission specs list ticked the All_attack mission flag, which nothing read, so ticking it there never reached the saved mission or the game. The flag is now the only place the setting is kept, as with +Red Alert: and +Scramble:. The +All Teams Attack line sets it, the game and the save code read it, and both editors edit it.

A mission saved by qtFRED with the box ticked has the flag but no line, and now starts with all teams at war, as its designer asked. A mission with only the line gains the flag in +Flags the next time it is saved; the line is still written, so older builds read it as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant