Use ntstring for Netgame.mission_name

This commit is contained in:
Kp 2014-12-22 04:35:48 +00:00
parent e166846dd1
commit 03370ed3e5
5 changed files with 10 additions and 9 deletions

View file

@ -32,6 +32,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#ifdef __cplusplus
#include "ntstring.h"
#define MAX_MISSIONS 5000 // ZICO - changed from 300 to get more levels in list
#define MAX_LEVELS_PER_MISSION 127 // KREATOR - increased from 30 (limited by Demo and Multiplayer code)
@ -83,7 +84,7 @@ struct Mission {
std::unique_ptr<d_fname[]> level_names;
std::unique_ptr<d_fname[]> secret_level_names;
int builtin_hogsize; // the size of the hogfile for a builtin mission, and 0 for an add-on mission
char mission_name[MISSION_NAME_LEN+1];
ntstring<MISSION_NAME_LEN> mission_name;
d_fname briefing_text_filename; // name of briefing file
d_fname ending_text_filename; // name of ending file
ubyte anarchy_only_flag; // if true, mission is only for anarchy

View file

@ -505,7 +505,7 @@ struct netgame_info : prohibit_void_ptr<netgame_info>, ignore_window_pointer_t
#endif
array<netplayer_info, MAX_PLAYERS> players;
ntstring<NETGAME_NAME_LEN> game_name;
char mission_title[MISSION_NAME_LEN+1];
ntstring<MISSION_NAME_LEN> mission_title;
char mission_name[9];
int levelnum;
ubyte gamemode;

View file

@ -110,7 +110,7 @@ struct UDP_netgame_info_lite : public prohibit_void_ptr<UDP_netgame_info_lite>
short program_iver[3];
fix GameID;
ntstring<NETGAME_NAME_LEN> game_name;
char mission_title[MISSION_NAME_LEN+1];
ntstring<MISSION_NAME_LEN> mission_title;
char mission_name[9];
int32_t levelnum;
ubyte gamemode;

View file

@ -153,7 +153,7 @@ static void show_netplayerinfo()
y+=LINE_SPACING;
gr_string(0x8000,y,Netgame.game_name.data());
y+=LINE_SPACING;
gr_printf(0x8000,y,"%s - lvl: %i",Netgame.mission_title,Netgame.levelnum);
gr_printf(0x8000, y, "%s - lvl: %i", Netgame.mission_title.data(), Netgame.levelnum);
x+=FSPACX(8);
y+=LINE_SPACING*2;

View file

@ -2229,7 +2229,7 @@ static void net_udp_send_game_info(const _sockaddr &sender_addr, ubyte info_upid
PUT_INTEL_SHORT(buf + len, DXX_VERSION_MICROi); len += 2; // 7
PUT_INTEL_INT(buf + len, Netgame.protocol.udp.GameID); len += 4; // 11
copy_from_ntstring(buf, len, Netgame.game_name);
memcpy(&(buf[len]), Netgame.mission_title, MISSION_NAME_LEN+1); len += (MISSION_NAME_LEN+1);
copy_from_ntstring(buf, len, Netgame.mission_title);
memcpy(&(buf[len]), Netgame.mission_name, 9); len += 9;
PUT_INTEL_INT(buf + len, Netgame.levelnum); len += 4;
buf[len] = Netgame.gamemode; len++;
@ -2274,7 +2274,7 @@ static void net_udp_send_game_info(const _sockaddr &sender_addr, ubyte info_upid
your_index = i;
}
copy_from_ntstring(buf, len, Netgame.game_name);
memcpy(&(buf[len]), Netgame.mission_title, MISSION_NAME_LEN+1); len += (MISSION_NAME_LEN+1);
copy_from_ntstring(buf, len, Netgame.mission_title);
memcpy(&(buf[len]), Netgame.mission_name, 9); len += 9;
PUT_INTEL_INT(buf + len, Netgame.levelnum); len += 4;
buf[len] = Netgame.gamemode; len++;
@ -2409,7 +2409,7 @@ static void net_udp_process_game_info(const uint8_t *data, uint_fast32_t, const
recv_game.GameID = GET_INTEL_INT(&(data[len])); len += 4;
copy_to_ntstring(data, len, recv_game.game_name);
memcpy(&recv_game.mission_title, &(data[len]), MISSION_NAME_LEN+1); len += (MISSION_NAME_LEN+1);
copy_to_ntstring(data, len, recv_game.mission_title);
memcpy(&recv_game.mission_name, &(data[len]), 9); len += 9;
recv_game.levelnum = GET_INTEL_INT(&(data[len])); len += 4;
recv_game.gamemode = data[len]; len++;
@ -2480,7 +2480,7 @@ static void net_udp_process_game_info(const uint8_t *data, uint_fast32_t, const
i.rank = data[len]; len++;
}
copy_to_ntstring(data, len, Netgame.game_name);
memcpy(&Netgame.mission_title, &(data[len]), MISSION_NAME_LEN+1); len += (MISSION_NAME_LEN+1);
copy_to_ntstring(data, len, Netgame.mission_title);
memcpy(&Netgame.mission_name, &(data[len]), 9); len += 9;
Netgame.levelnum = GET_INTEL_INT(&(data[len])); len += 4;
Netgame.gamemode = data[len]; len++;
@ -3290,7 +3290,7 @@ int net_udp_setup_game()
#endif
strcpy(Netgame.mission_name, Current_mission_filename);
strcpy(Netgame.mission_title, Current_mission_longname);
Netgame.mission_title = Current_mission_longname;
sprintf( slevel, "1" ); Netgame.levelnum = 1;