1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _MULTI_ENDGAME_HEADER_FILE
13 #define _MULTI_ENDGAME_HEADER_FILE
14 
15 // ----------------------------------------------------------------------------------------------------------
16 // Put all functions/data related to leaving a netgame, handling players leaving, handling the server leaving,
17 // and notifying the user of all of these actions, here.
18 //
19 
20 
21 // ----------------------------------------------------------------------------------------------------------
22 // MULTI ENDGAME DEFINES/VARS
23 //
24 
25 // defines for calling multi_quit_game(...)
26 #define PROMPT_NONE									0				// don't prompt anyone when quitting (multi_quit_game)
27 #define PROMPT_HOST									1				// prompt the host when quitting (multi_quit_game)
28 #define PROMPT_CLIENT								2				// prompt the client when quitting (multi_quit_game)
29 #define PROMPT_ALL									3				// prompt any players when quitting (multi_quit_game)
30 
31 // notification defines for calling multi_quit_game(...)
32 #define MULTI_END_NOTIFY_NONE						(-1)			// no notification code
33 #define MULTI_END_NOTIFY_KICKED					1				// player was kicked
34 #define MULTI_END_NOTIFY_SERVER_LEFT			2				// server has left the game
35 #define MULTI_END_NOTIFY_FILE_REJECTED			3				// mission file was rejected by the server
36 #define MULTI_END_NOTIFY_EARLY_END				4				// game ended while the ingame joiner was joining
37 #define MULTI_END_NOTIFY_INGAME_TIMEOUT		5				// waited too long in the ship select screen
38 #define MULTI_END_NOTIFY_KICKED_BAD_XFER		6				// kicked because file xfer failed
39 #define MULTI_END_NOTIFY_KICKED_CANT_XFER		7				// kicked because can't xfer a builtin mission
40 #define MULTI_END_NOTIFY_KICKED_INGAME_ENDED	8				// kicked because was ingame joining in an ending game
41 
42 // error defines for calling multi_quit_game(...)
43 #define MULTI_END_ERROR_NONE						(-1)			// no error code
44 #define MULTI_END_ERROR_CONTACT_LOST			1				// contact with the server has been lost
45 #define MULTI_END_ERROR_CONNECT_FAIL			2				// failed to connect to the server
46 #define MULTI_END_ERROR_LOAD_FAIL				3				// failed to load the mission properly
47 #define MULTI_END_ERROR_INGAME_SHIP				4				// unable to create ingame join player ship
48 #define MULTI_END_ERROR_INGAME_BOGUS			5				// received bogus data on ingame join
49 #define MULTI_END_ERROR_STRANS_FAIL				6				// server transfer failed (obsolete)
50 #define MULTI_END_ERROR_SHIP_ASSIGN				7				// server had problems assigning players to ships
51 #define MULTI_END_ERROR_HOST_LEFT				8				// host has left a standalone game
52 #define MULTI_END_ERROR_XFER_FAIL				9				// mission file xfer failed on the client
53 #define MULTI_END_ERROR_WAVE_COUNT				10				// illegal data found in mission when parsing
54 #define MULTI_END_ERROR_TEAM0_EMPTY				11				// all of team 0 has left
55 #define MULTI_END_ERROR_TEAM1_EMPTY				12				// all of team 1 has left
56 #define MULTI_END_ERROR_CAPTAIN_LEFT			13				// captain of a team has left while not ingame
57 
58 // ----------------------------------------------------------------------------------------------------------
59 // MULTI ENDGAME FUNCTIONS
60 //
61 
62 // initialize the endgame processor (call when joining/starting a new netgame)
63 void multi_endgame_init();
64 
65 // process all endgame related events
66 void multi_endgame_process();
67 
68 // if the game has been flagged as ended (ie, its going to be reset)
69 int multi_endgame_ending();
70 
71 // general quit function, with optional notification, error, and winsock error codes
72 // return 0 if the act was cancelled, 1 if it was accepted
73 int multi_quit_game(int prompt,int notify_code = MULTI_END_NOTIFY_NONE,int err_code = MULTI_END_ERROR_NONE,int wsa_error = -1);
74 
75 
76 #endif
77