ATeamItem code cleanup and overhaul
The code in a_flags.cpp
still makes heavy use of C-style char arrays, which unfortunately aren't big enough to fit the names of players that are incredibly long (i.e. contain new text colours per character). Since I made the effort of cleaning up and overhauling this code a few years ago, I thought it'd be better to wipe the slate clean, touch up the changes I made, and overhaul the entire code. Here's a summary of changes:
- Renamed
a_flags.cpp
toa_teamitems.cpp
. This file has more to do with team items in general (which includes skull items), and not just flags. I also renamed any similar functions and server commands accordingly. - Removed all use of C-style char arrays in favour of
FString
and Hungarian notation. - Simplified and consolidated a lot of duplicated code, making it easier to read and maintain.
- Refactored code to allow clients to print messages on their own without the server needing to tell them to. An excellent way to reduce bandwidth usage.
- Added console messages for when the white flag is taken/returned.
- Messages are now displayed when the white flag is dropped.
- The "held by" message for the white flag is now colourized the same way as it is when picking up a team's flag or skull.
- Fixed an inconsistency in the fade-out time when printing the "x team scores" HUD message upon scoring in 1-Flag CTF (it was 0.25 seconds instead of 0.5, like it is in CTF or Skulltag).