1 /* 2 * XPilot NG, a multiplayer space war game. 3 * 4 * Copyright (C) 1991-2001 by 5 * 6 * Bj�rn Stabell <bjoern@xpilot.org> 7 * Ken Ronny Schouten <ken@xpilot.org> 8 * Bert Gijsbers <bert@xpilot.org> 9 * Dick Balaska <dick@xpilot.org> 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 #ifndef NETSERVER_H 27 #define NETSERVER_H 28 29 #ifndef PLAYER_H 30 /* need player_t */ 31 #include "player.h" 32 #endif 33 34 int Setup_net_server(void); 35 void Conn_change_nick(connection_t *connp, const char *nick); 36 void Destroy_connection(connection_t *connp, const char *reason); 37 int Check_connection(char *real, char *nick, char *dpy, char *addr); 38 int Setup_connection(char *real, char *nick, char *dpy, int team, 39 char *addr, char *host, unsigned version); 40 int Input(void); 41 int Send_reply(connection_t *connp, int replyto, int result); 42 int Send_self(connection_t *connp, player_t *pl, 43 int lock_id, 44 int lock_dist, 45 int lock_dir, 46 int autopilotlight, 47 int status, 48 char *mods); 49 int Send_leave(connection_t *connp, int id); 50 int Send_player(connection_t *connp, int id); 51 int Send_team(connection_t *connp, int id, int team); 52 int Send_score(connection_t *connp, int id, double score, 53 int life, int mychar, int alliance); 54 int Send_score_object(connection_t *connp, double score, clpos_t pos, const char *string); 55 int Send_timing(connection_t *connp, int id, int check, int round); 56 int Send_base(connection_t *connp, int id, int num); 57 int Send_fuel(connection_t *connp, int num, double fuel); 58 int Send_cannon(connection_t *connp, int num, int dead_ticks); 59 int Send_destruct(connection_t *connp, int count); 60 int Send_shutdown(connection_t *connp, int count, int delay); 61 int Send_thrusttime(connection_t *connp, int count, int max); 62 int Send_shieldtime(connection_t *connp, int count, int max); 63 int Send_phasingtime(connection_t *connp, int count, int max); 64 int Send_debris(connection_t *connp, int type, unsigned char *p, unsigned n); 65 int Send_wreckage(connection_t *connp, clpos_t pos, int wrtype, int size, int rot); 66 int Send_asteroid(connection_t *connp, clpos_t pos, int type, int size, int rot); 67 int Send_fastshot(connection_t *connp, int type, unsigned char *p, unsigned n); 68 int Send_missile(connection_t *connp, clpos_t pos, int len, int dir); 69 int Send_ball(connection_t *connp, clpos_t pos, int id, int style); 70 int Send_mine(connection_t *connp, clpos_t pos, int teammine, int id); 71 int Send_target(connection_t *connp, int num, int dead_ticks, double damage); 72 int Send_wormhole(connection_t *connp, clpos_t pos); 73 int Send_polystyle(connection_t *connp, int polyind, int newstyle); 74 int Send_audio(connection_t *connp, int type, int vol); 75 int Send_item(connection_t *connp, clpos_t pos, int type); 76 int Send_paused(connection_t *connp, clpos_t pos, int count); 77 int Send_appearing(connection_t *connp, clpos_t pos, int id, int count); 78 int Send_ecm(connection_t *connp, clpos_t pos, int size); 79 int Send_ship(connection_t *connp, clpos_t pos, int id, int dir, int shield, int cloak, int eshield, int phased, int deflector); 80 int Send_refuel(connection_t *connp, clpos_t pos1, clpos_t pos2); 81 int Send_connector(connection_t *connp, clpos_t pos1, clpos_t pos2, int tractor); 82 int Send_laser(connection_t *connp, int color, clpos_t pos, int len, int dir); 83 int Send_radar(connection_t *connp, int x, int y, int size); 84 int Send_fastradar(connection_t *connp, unsigned char *buf, unsigned n); 85 int Send_damaged(connection_t *connp, int damaged); 86 int Send_message(connection_t *connp, const char *msg); 87 int Send_loseitem(connection_t *connp, int lose_item_index); 88 int Send_start_of_frame(connection_t *connp); 89 int Send_end_of_frame(connection_t *connp); 90 int Send_reliable(connection_t *connp); 91 int Send_time_left(connection_t *connp, long sec); 92 int Send_eyes(connection_t *connp, int id); 93 int Send_trans(connection_t *connp, clpos_t pos1, clpos_t pos2); 94 void Get_display_parameters(connection_t *connp, int *width, int *height, 95 int *debris_colors, int *spark_rand); 96 int Get_player_id(connection_t *connp); 97 const char *Player_get_addr(player_t *pl); 98 const char *Player_get_dpy(player_t *pl); 99 int Send_shape(connection_t *connp, int shape); 100 int Check_max_clients_per_IP(char *host_addr); 101 #define FEATURE(connp, feature) ((connp)->features & (feature)) 102 #define F_POLY (1 << 0) 103 #define F_FLOATSCORE (1 << 1) 104 #define F_EXPLICITSELF (1 << 2) 105 #define F_ASTEROID (1 << 3) 106 #define F_TEMPWORM (1 << 4) 107 #define F_FASTRADAR (1 << 5) 108 #define F_SEPARATEPHASING (1 << 6) 109 #define F_TEAMRADAR (1 << 7) 110 #define F_SHOW_APPEARING (1 << 8) 111 #define F_SENDTEAM F_SHOW_APPEARING 112 #define F_CUMULATIVETURN (1 << 9) 113 #define F_BALLSTYLE (1 << 10) 114 #define F_POLYSTYLE (1 << 11) 115 116 #endif 117