Validate netgame mode index
This commit is contained in:
parent
88759aee48
commit
5575f9beba
|
@ -153,7 +153,8 @@ void show_netplayerinfo()
|
||||||
|
|
||||||
x+=FSPACX(8);
|
x+=FSPACX(8);
|
||||||
y+=LINE_SPACING*2;
|
y+=LINE_SPACING*2;
|
||||||
gr_printf(x,y,"game mode: %s",GMNames[Netgame.gamemode]);
|
unsigned gamemode = Netgame.gamemode;
|
||||||
|
gr_printf(x,y,"game mode: %s",gamemode < (sizeof(GMNames) / sizeof(GMNames[0])) ? GMNames[gamemode] : "INVALID");
|
||||||
y+=LINE_SPACING;
|
y+=LINE_SPACING;
|
||||||
gr_printf(x,y,"difficulty: %s",MENU_DIFFICULTY_TEXT(Netgame.difficulty));
|
gr_printf(x,y,"difficulty: %s",MENU_DIFFICULTY_TEXT(Netgame.difficulty));
|
||||||
y+=LINE_SPACING;
|
y+=LINE_SPACING;
|
||||||
|
|
22
main/multi.c
22
main/multi.c
|
@ -149,8 +149,26 @@ short kill_matrix[MAX_PLAYERS][MAX_PLAYERS];
|
||||||
int multi_goto_secret = 0;
|
int multi_goto_secret = 0;
|
||||||
short team_kills[2];
|
short team_kills[2];
|
||||||
int multi_quit_game = 0;
|
int multi_quit_game = 0;
|
||||||
char *GMNames[9]={"Anarchy","Team Anarchy","Robo Anarchy","Cooperative","Capture the Flag","Hoard","Team Hoard","Bounty","Unknown"};
|
const char GMNames[MULTI_GAME_TYPE_COUNT][MULTI_GAME_NAME_LENGTH]={
|
||||||
char *GMNamesShrt[9]={"ANRCHY","TEAM","ROBO","COOP","FLAG","HOARD","TMHOARD","BOUNTY","UNKNOWN"};
|
"Anarchy",
|
||||||
|
"Team Anarchy",
|
||||||
|
"Robo Anarchy",
|
||||||
|
"Cooperative",
|
||||||
|
"Capture the Flag",
|
||||||
|
"Hoard",
|
||||||
|
"Team Hoard",
|
||||||
|
"Bounty"
|
||||||
|
};
|
||||||
|
const char GMNamesShrt[MULTI_GAME_TYPE_COUNT][8]={
|
||||||
|
"ANRCHY",
|
||||||
|
"TEAM",
|
||||||
|
"ROBO",
|
||||||
|
"COOP",
|
||||||
|
"FLAG",
|
||||||
|
"HOARD",
|
||||||
|
"TMHOARD",
|
||||||
|
"BOUNTY"
|
||||||
|
};
|
||||||
|
|
||||||
// For rejoin object syncing (used here and all protocols - globally)
|
// For rejoin object syncing (used here and all protocols - globally)
|
||||||
|
|
||||||
|
|
|
@ -214,8 +214,12 @@ enum { for_each_netflag_value(define_netflag_bit_enum) };
|
||||||
enum { for_each_netflag_value(define_netflag_bit_mask) };
|
enum { for_each_netflag_value(define_netflag_bit_mask) };
|
||||||
enum { NETFLAG_DOPOWERUP = 0 for_each_netflag_value(define_netflag_powerup_mask) };
|
enum { NETFLAG_DOPOWERUP = 0 for_each_netflag_value(define_netflag_powerup_mask) };
|
||||||
|
|
||||||
|
#define MULTI_GAME_TYPE_COUNT 8
|
||||||
|
#define MULTI_GAME_NAME_LENGTH 17
|
||||||
#define MULTI_ALLOW_POWERUP_MAX 26
|
#define MULTI_ALLOW_POWERUP_MAX 26
|
||||||
extern char *multi_allow_powerup_text[MULTI_ALLOW_POWERUP_MAX];
|
extern char *multi_allow_powerup_text[MULTI_ALLOW_POWERUP_MAX];
|
||||||
|
extern const char GMNames[MULTI_GAME_TYPE_COUNT][MULTI_GAME_NAME_LENGTH];
|
||||||
|
extern const char GMNamesShrt[MULTI_GAME_TYPE_COUNT][8];
|
||||||
|
|
||||||
// Exported functions
|
// Exported functions
|
||||||
|
|
||||||
|
@ -322,9 +326,6 @@ extern short team_kills[2];
|
||||||
|
|
||||||
extern int multi_goto_secret;
|
extern int multi_goto_secret;
|
||||||
|
|
||||||
extern char *GMNames[9];
|
|
||||||
extern char *GMNamesShrt[9];
|
|
||||||
|
|
||||||
extern ushort my_segments_checksum;
|
extern ushort my_segments_checksum;
|
||||||
|
|
||||||
//do we draw the kill list on the HUD?
|
//do we draw the kill list on the HUD?
|
||||||
|
|
|
@ -929,7 +929,8 @@ int net_udp_list_join_poll( newmenu *menu, d_event *event, direct_join *dj )
|
||||||
else
|
else
|
||||||
snprintf(status, sizeof(status), "BETWEEN ");
|
snprintf(status, sizeof(status), "BETWEEN ");
|
||||||
|
|
||||||
snprintf (menus[i+4].text,sizeof(char)*74,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",(i+(NLPage*UDP_NETGAMES_PPAGE))+1,GameName,GMNamesShrt[Active_udp_games[(i+(NLPage*UDP_NETGAMES_PPAGE))].gamemode],nplayers, Active_udp_games[(i+(NLPage*UDP_NETGAMES_PPAGE))].max_numplayers,MissName,levelname,status);
|
unsigned gamemode = Active_udp_games[(i+(NLPage*UDP_NETGAMES_PPAGE))].gamemode;
|
||||||
|
snprintf (menus[i+4].text,sizeof(char)*74,"%d.\t%s \t%s \t %d/%d \t%s \t %s \t%s",(i+(NLPage*UDP_NETGAMES_PPAGE))+1,GameName,(gamemode < sizeof(GMNamesShrt) / sizeof(GMNamesShrt[0])) ? GMNamesShrt[gamemode] : "INVALID",nplayers, Active_udp_games[(i+(NLPage*UDP_NETGAMES_PPAGE))].max_numplayers,MissName,levelname,status);
|
||||||
|
|
||||||
Assert(strlen(menus[i+4].text) < 75);
|
Assert(strlen(menus[i+4].text) < 75);
|
||||||
}
|
}
|
||||||
|
@ -5282,7 +5283,8 @@ int net_udp_show_game_info()
|
||||||
|
|
||||||
info+=sprintf (info," - Lvl %i",netgame->levelnum);
|
info+=sprintf (info," - Lvl %i",netgame->levelnum);
|
||||||
info+=sprintf (info,"\n\nDifficulty: %s",MENU_DIFFICULTY_TEXT(netgame->difficulty));
|
info+=sprintf (info,"\n\nDifficulty: %s",MENU_DIFFICULTY_TEXT(netgame->difficulty));
|
||||||
info+=sprintf (info,"\nGame Mode: %s",GMNames[netgame->gamemode]);
|
unsigned gamemode = netgame->gamemode;
|
||||||
|
info+=sprintf (info,"\nGame Mode: %s",gamemode < (sizeof(GMNames) / sizeof(GMNames[0])) ? GMNames[gamemode] : "INVALID");
|
||||||
info+=sprintf (info,"\nPlayers: %i/%i",netgame->numconnected,netgame->max_numplayers);
|
info+=sprintf (info,"\nPlayers: %i/%i",netgame->numconnected,netgame->max_numplayers);
|
||||||
|
|
||||||
c=nm_messagebox1("WELCOME", (int (*)(newmenu *, d_event *, void *))show_game_info_handler, netgame, 2, "JOIN GAME", "GAME INFO", rinfo);
|
c=nm_messagebox1("WELCOME", (int (*)(newmenu *, d_event *, void *))show_game_info_handler, netgame, 2, "JOIN GAME", "GAME INFO", rinfo);
|
||||||
|
|
Loading…
Reference in a new issue