Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions room/src/doom/d_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,18 @@ extern "C" {
/// Caller must ensure `player_idx < MAXPLAYERS` and that the global state
/// (`players`, `playeringame`, `consoleplayer`, `demorecording`) is valid.
unsafe fn PlayerQuitGame(player_idx: usize) {
/// Capacity of [`EXITMSG`], named so `M_StringCopy` does not have to take
/// a shared reference to the `static mut` to read its length.
const EXITMSG_LEN: usize = 80;

/// 80-byte scratch buffer holding the formatted "Player N left the game"
/// message; its address is passed to the console-player's message pointer.
static mut EXITMSG: [c_char; 80] = [0; 80];
static mut EXITMSG: [c_char; EXITMSG_LEN] = [0; EXITMSG_LEN];
Comment on lines 299 to +301

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6d324f0: the original buffer doc comment now sits directly above static mut EXITMSG, and EXITMSG_LEN got its own short doc explaining why the constant exists (so M_StringCopy doesn't need to take a shared reference to the static to read its length).


M_StringCopy(
std::ptr::addr_of_mut!(EXITMSG[0]),
DEH_String(EXIT_MSG.as_ptr() as *const c_char),
EXITMSG.len(),
EXITMSG_LEN,
);

EXITMSG[7] += player_idx as c_char;
Expand Down