Shrink some Netgame fields

For protocol compatibility, zero-pad the outbound messages.  Previously,
the upper bits were zero because the value fit in a byte.
This commit is contained in:
Kp 2017-08-26 19:47:51 +00:00
parent 3340a6c16c
commit 3bcee35c7b
2 changed files with 15 additions and 15 deletions

View file

@ -777,17 +777,12 @@ struct netgame_info : prohibit_void_ptr<netgame_info>, ignore_window_pointer_t
packed_spawn_granted_items SpawnGrantedItems;
packed_netduplicate_items DuplicatePowerups;
#if defined(DXX_BUILD_DESCENT_II)
/*
* Only used in Descent II, but defined in both for historical
* reasons
*/
short Allow_marker_view;
short AlwaysLighting;
/* End Descent II */
uint8_t Allow_marker_view;
uint8_t AlwaysLighting;
#endif
short ShowEnemyNames;
short BrightPlayers;
short InvulAppear;
uint8_t ShowEnemyNames;
uint8_t BrightPlayers;
uint8_t InvulAppear;
ushort segments_checksum;
int KillGoal;
fix PlayTimeAllowed;

View file

@ -2543,12 +2543,17 @@ static uint_fast32_t net_udp_prepare_heavy_game_info(const _sockaddr *addr, ubyt
#elif defined(DXX_BUILD_DESCENT_II)
PUT_INTEL_SHORT(buf + len, Netgame.SpawnGrantedItems.mask); len += 2;
PUT_INTEL_SHORT(buf + len, Netgame.DuplicatePowerups.get_packed_field()); len += 2;
PUT_INTEL_SHORT(buf + len, Netgame.Allow_marker_view); len += 2;
PUT_INTEL_SHORT(buf + len, Netgame.AlwaysLighting); len += 2;
buf[len++] = Netgame.Allow_marker_view;
buf[len++] = 0;
buf[len++] = Netgame.AlwaysLighting;
buf[len++] = 0;
#endif
PUT_INTEL_SHORT(buf + len, Netgame.ShowEnemyNames); len += 2;
PUT_INTEL_SHORT(buf + len, Netgame.BrightPlayers); len += 2;
PUT_INTEL_SHORT(buf + len, Netgame.InvulAppear); len += 2;
buf[len++] = Netgame.ShowEnemyNames;
buf[len++] = 0;
buf[len++] = Netgame.BrightPlayers;
buf[len++] = 0;
buf[len++] = Netgame.InvulAppear;
buf[len++] = 0;
range_for (const auto &i, Netgame.team_name)
{
memcpy(&buf[len], static_cast<const char *>(i), (CALLSIGN_LEN+1));