1 /* $Id: netserver.h,v 5.11 2002/08/21 14:22:32 bertg Exp $ 2 * 3 * XPilot, a multiplayer gravity war game. Copyright (C) 1991-2001 by 4 * 5 * Bj�rn Stabell <bjoern@xpilot.org> 6 * Ken Ronny Schouten <ken@xpilot.org> 7 * Bert Gijsbers <bert@xpilot.org> 8 * Dick Balaska <dick@xpilot.org> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 */ 24 25 #ifndef NETSERVER_H 26 #define NETSERVER_H 27 28 #ifdef NETSERVER_C 29 30 31 static int Compress_map(unsigned char *map, int size); 32 static int Init_setup(void); 33 static int Handle_listening(int ind); 34 static int Handle_setup(int ind); 35 static int Handle_login(int ind, char *errmsg, int errsize); 36 static void Handle_input(int fd, void *arg); 37 38 39 static int Receive_keyboard(int ind); 40 static int Receive_quit(int ind); 41 static int Receive_play(int ind); 42 static int Receive_power(int ind); 43 static int Receive_ack(int ind); 44 static int Receive_ack_cannon(int ind); 45 static int Receive_ack_fuel(int ind); 46 static int Receive_ack_target(int ind); 47 static int Receive_discard(int ind); 48 static int Receive_undefined(int ind); 49 static int Receive_talk(int ind); 50 static int Receive_display(int ind); 51 static int Receive_modifier_bank(int ind); 52 static int Receive_motd(int ind); 53 static int Receive_shape(int ind); 54 static int Receive_pointer_move(int ind); 55 static int Receive_audio_request(int ind); 56 static int Receive_fps_request(int ind); 57 58 static int Send_motd(int ind); 59 60 #endif /* NETSERVER_C */ 61 62 int Get_motd(char *buf, int offset, int maxlen, int *size_ptr); 63 int Setup_net_server(void); 64 void Destroy_connection(int ind, const char *reason); 65 int Check_connection(char *real, char *nick, char *dpy, char *addr); 66 int Setup_connection(char *real, char *nick, char *dpy, int team, 67 char *addr, char *host, unsigned version); 68 int Input(void); 69 int Send_reply(int ind, int replyto, int result); 70 int Send_self(int ind, player *pl, 71 int lock_id, 72 int lock_dist, 73 int lock_dir, 74 int autopilotlight, 75 long status, 76 char *mods); 77 int Send_leave(int ind, int id); 78 int Send_war(int ind, int robot_id, int killer_id); 79 int Send_seek(int ind, int programmer_id, int robot_id, int sought_id); 80 int Send_player(int ind, int id); 81 int Send_score(int ind, int id, DFLOAT score, 82 int life, int mychar, int alliance); 83 int Send_score_object(int ind, DFLOAT score, int x, int y, const char *string); 84 int Send_team_score(int ind, int team, DFLOAT score); 85 int Send_timing(int ind, int id, int check, int round); 86 int Send_base(int ind, int id, int num); 87 int Send_fuel(int ind, int num, int fuel); 88 int Send_cannon(int ind, int num, int dead_time); 89 int Send_destruct(int ind, int count); 90 int Send_shutdown(int ind, int count, int delay); 91 int Send_thrusttime(int ind, int count, int max); 92 int Send_shieldtime(int ind, int count, int max); 93 int Send_phasingtime(int ind, int count, int max); 94 int Send_rounddelay(int ind, int count, int max); 95 int Send_debris(int ind, int type, unsigned char *p, int n); 96 int Send_wreckage(int ind, int x, int y, u_byte wrtype, u_byte size, u_byte rot); 97 int Send_asteroid(int ind, int x, int y, u_byte type, u_byte size, u_byte rot); 98 int Send_fastshot(int ind, int type, unsigned char *p, int n); 99 int Send_missile(int ind, int x, int y, int len, int dir); 100 int Send_ball(int ind, int x, int y, int id); 101 int Send_mine(int ind, int x, int y, int teammine, int id); 102 int Send_target(int ind, int num, int dead_time, int damage); 103 int Send_wormhole(int ind, int x, int y); 104 int Send_audio(int ind, int type, int vol); 105 int Send_item(int ind, int x, int y, int type); 106 int Send_paused(int ind, int x, int y, int count); 107 int Send_ecm(int ind, int x, int y, int size); 108 int Send_ship(int ind, int x, int y, int id, int dir, int shield, int cloak, int eshield, 109 int phased, int deflector); 110 int Send_refuel(int ind, int x0, int y0, int x1, int y1); 111 int Send_connector(int ind, int x0, int y0, int x1, int y1, int tractor); 112 int Send_laser(int ind, int color, int x, int y, int len, int dir); 113 int Send_radar(int ind, int x, int y, int size); 114 int Send_fastradar(int ind, unsigned char *buf, int n); 115 int Send_damaged(int ind, int damaged); 116 int Send_message(int ind, const char *msg); 117 int Send_loseitem(int lose_item_index, int ind); 118 int Send_start_of_frame(int ind); 119 int Send_end_of_frame(int ind); 120 int Send_reliable(int ind); 121 int Send_time_left(int ind, long sec); 122 int Send_eyes(int ind, int id); 123 int Send_trans(int ind, int x1, int y1, int x2, int y2); 124 void Get_display_parameters(int ind, int *width, int *height, 125 int *debris_colors, int *spark_rand); 126 int Get_player_id(int); 127 int Get_conn_version(int ind); 128 const char *Get_player_addr(int ind); 129 const char *Get_player_dpy(int ind); 130 int Send_shape(int ind, int shape); 131 int Check_max_clients_per_IP(char *host_addr); 132 133 #endif 134 135