diff --git a/room/src/doom/d_net.rs b/room/src/doom/d_net.rs index 112e70b..39eddc2 100644 --- a/room/src/doom/d_net.rs +++ b/room/src/doom/d_net.rs @@ -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]; 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;