1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
17 #include "libgame/libgame.h"
23 static int num_clients = 0;
24 static boolean run_server_only_once = FALSE;
26 struct NetworkServerPlayerInfo
29 char player_name[MAX_PLAYER_NAME_LEN + 1];
34 boolean action_received;
36 struct NetworkServerPlayerInfo *next;
39 static struct NetworkServerPlayerInfo *first_player = NULL;
41 #define NEXT(player) ((player)->next ? (player)->next : first_player)
43 /* TODO: peer address */
44 static TCPsocket lfd; /* listening TCP socket */
45 static UDPsocket udp; /* listening UDP socket */
46 static SDLNet_SocketSet fds; /* socket set */
48 static struct NetworkBuffer *read_buffer = NULL;
49 static struct NetworkBuffer *write_buffer = NULL;
51 static unsigned int ServerFrameCounter = 0;
54 int getNetwork8BitInteger(byte *ptr)
59 int putNetwork8BitInteger(byte *ptr, int value)
66 int getNetwork16BitInteger(byte *ptr)
68 return ((ptr[0] << 8) |
72 int putNetwork16BitInteger(byte *ptr, int value)
74 ptr[0] = (value >> 8) & 0xff;
75 ptr[1] = (value >> 0) & 0xff;
80 int getNetwork32BitInteger(byte *ptr)
82 return ((ptr[0] << 24) |
88 int putNetwork32BitInteger(byte *ptr, int value)
90 ptr[0] = (value >> 24) & 0xff;
91 ptr[1] = (value >> 16) & 0xff;
92 ptr[2] = (value >> 8) & 0xff;
93 ptr[3] = (value >> 0) & 0xff;
98 char *getNetworkString(byte *ptr)
103 int putNetworkString(byte *ptr, char *s)
105 strcpy((char *)ptr, s);
107 return strlen(s) + 1;
110 struct NetworkBuffer *newNetworkBuffer(void)
112 struct NetworkBuffer *new = checked_calloc(sizeof(struct NetworkBuffer));
114 new->max_size = MAX_BUFFER_SIZE;
118 new->buffer = checked_calloc(new->max_size);
123 static void resetNetworkBufferForReading(struct NetworkBuffer *nb)
128 static void resetNetworkBufferForWriting(struct NetworkBuffer *nb)
134 void initNetworkBufferForReceiving(struct NetworkBuffer *nb)
136 resetNetworkBufferForWriting(nb);
139 void initNetworkBufferForReading(struct NetworkBuffer *nb)
141 resetNetworkBufferForReading(nb);
143 /* skip message length header */
144 getNetworkBuffer32BitInteger(nb);
147 void initNetworkBufferForWriting(struct NetworkBuffer *nb, int message_type,
150 resetNetworkBufferForWriting(nb);
152 /* will be replaced with message length before sending */
153 putNetworkBuffer32BitInteger(nb, 0);
155 putNetworkBuffer8BitInteger(nb, message_type);
156 putNetworkBuffer8BitInteger(nb, player_nr);
159 static void copyNetworkBufferForWriting(struct NetworkBuffer *nb_from,
160 struct NetworkBuffer *nb_to,
163 initNetworkBufferForReading(nb_from);
165 int message_type = getNetworkBuffer8BitInteger(nb_from);
167 /* skip player number */
168 getNetworkBuffer8BitInteger(nb_from);
170 initNetworkBufferForWriting(nb_to, message_type, player_nr);
172 while (nb_from->pos < nb_from->size)
174 int b = getNetworkBuffer8BitInteger(nb_from);
176 putNetworkBuffer8BitInteger(nb_to, b);
180 static void increaseNetworkBuffer(struct NetworkBuffer *nb, int additional_size)
182 /* add some more buffer size than is really required this time */
183 nb->max_size += additional_size + MAX_BUFFER_SIZE;
184 nb->buffer = checked_realloc(nb->buffer, nb->max_size);
187 int receiveNetworkBufferBytes(struct NetworkBuffer *nb, TCPsocket socket,
190 if (num_bytes > MAX_PACKET_SIZE)
192 Error(ERR_NETWORK_SERVER, "protocol error: invalid packet size %d",
198 if (nb->pos + num_bytes > nb->max_size)
199 increaseNetworkBuffer(nb, num_bytes);
201 int result = SDLNet_TCP_Recv(socket, &nb->buffer[nb->pos], num_bytes);
203 if (result != num_bytes)
206 nb->pos += num_bytes;
212 int receiveNetworkBufferPacket(struct NetworkBuffer *nb, TCPsocket socket)
214 int num_bytes, num_bytes_head, num_bytes_body;
217 num_bytes = receiveNetworkBufferBytes(nb, socket, num_bytes_head);
219 if (num_bytes != num_bytes_head)
222 num_bytes_body = getNetwork32BitInteger(nb->buffer);
223 num_bytes = receiveNetworkBufferBytes(nb, socket, num_bytes_body);
228 int getNetworkBuffer8BitInteger(struct NetworkBuffer *nb)
232 if (nb->pos + num_bytes > nb->size)
235 int value = getNetwork8BitInteger(&nb->buffer[nb->pos]);
237 nb->pos += num_bytes;
242 void putNetworkBuffer8BitInteger(struct NetworkBuffer *nb, int value)
246 if (nb->pos + num_bytes > nb->max_size)
247 increaseNetworkBuffer(nb, num_bytes);
249 nb->pos += putNetwork8BitInteger(&nb->buffer[nb->pos], value);
253 int getNetworkBuffer16BitInteger(struct NetworkBuffer *nb)
257 if (nb->pos + num_bytes > nb->size)
260 int value = getNetwork16BitInteger(&nb->buffer[nb->pos]);
262 nb->pos += num_bytes;
267 void putNetworkBuffer16BitInteger(struct NetworkBuffer *nb, int value)
271 if (nb->pos + num_bytes > nb->max_size)
272 increaseNetworkBuffer(nb, num_bytes);
274 nb->pos += putNetwork16BitInteger(&nb->buffer[nb->pos], value);
278 int getNetworkBuffer32BitInteger(struct NetworkBuffer *nb)
282 if (nb->pos + num_bytes > nb->size)
285 int value = getNetwork32BitInteger(&nb->buffer[nb->pos]);
287 nb->pos += num_bytes;
292 void putNetworkBuffer32BitInteger(struct NetworkBuffer *nb, int value)
296 if (nb->pos + num_bytes > nb->max_size)
297 increaseNetworkBuffer(nb, num_bytes);
299 nb->pos += putNetwork32BitInteger(&nb->buffer[nb->pos], value);
303 char *getNetworkBufferString(struct NetworkBuffer *nb)
305 char *s = getNetworkString(&nb->buffer[nb->pos]);
307 nb->pos += strlen(s) + 1;
312 void putNetworkBufferString(struct NetworkBuffer *nb, char *s)
314 int num_bytes = strlen(s) + 1;
316 if (nb->pos + num_bytes > nb->max_size)
317 increaseNetworkBuffer(nb, num_bytes);
319 nb->pos += putNetworkString(&nb->buffer[nb->pos], s);
323 int getNetworkBufferFile(struct NetworkBuffer *nb, char *filename)
326 int num_bytes = getNetworkBuffer32BitInteger(nb);
329 if (!(file = fopen(filename, MODE_WRITE)))
331 Error(ERR_WARN, "cannot write file '%s' from network buffer", filename);
336 for (i = 0; i < num_bytes; i++)
338 int b = getNetworkBuffer8BitInteger(nb);
340 putFile8Bit(file, b);
348 int putNetworkBufferFile(struct NetworkBuffer *nb, char *filename)
351 int filesize_pos = nb->pos;
354 /* will be replaced with file size */
355 putNetworkBuffer32BitInteger(nb, 0);
357 if (!(file = openFile(filename, MODE_READ)))
359 Error(ERR_WARN, "cannot read file '%s' to network buffer", filename);
366 int b = getFile8Bit(file);
368 if (checkEndOfFile(file))
371 putNetworkBuffer8BitInteger(nb, b);
379 putNetwork32BitInteger(&nb->buffer[filesize_pos], num_bytes);
384 void dumpNetworkBuffer(struct NetworkBuffer *nb)
388 printf("::: network buffer maximum size: %d\n", nb->max_size);
389 printf("::: network buffer size: %d\n", nb->size);
390 printf("::: network buffer position : %d\n", nb->pos);
392 for (i = 0; i < nb->size; i++)
397 printf("%02x ", nb->buffer[i]);
403 static void SendNetworkBufferToAllButOne(struct NetworkBuffer *nb,
404 struct NetworkServerPlayerInfo *except)
406 struct NetworkServerPlayerInfo *player;
408 /* set message length header */
409 putNetwork32BitInteger(nb->buffer, nb->size - 4);
411 for (player = first_player; player != NULL; player = player->next)
413 if (player != except && player->introduced)
415 /* directly send the buffer to the network client */
416 SDLNet_TCP_Send(player->fd, nb->buffer, nb->size);
421 static void SendNetworkBufferToAll(struct NetworkBuffer *nb)
423 SendNetworkBufferToAllButOne(nb, NULL);
426 static void SendNetworkBufferToClient(struct NetworkBuffer *nb,
427 struct NetworkServerPlayerInfo *player)
429 /* set message length header */
430 putNetwork32BitInteger(nb->buffer, nb->size - 4);
432 /* directly send the buffer to the network client */
433 SDLNet_TCP_Send(player->fd, nb->buffer, nb->size);
436 static void RemovePlayer(struct NetworkServerPlayerInfo *player)
439 Error(ERR_NETWORK_SERVER, "dropping client %d (%s)",
440 player->number, player->player_name);
442 SDLNet_TCP_DelSocket(fds, player->fd);
443 SDLNet_TCP_Close(player->fd);
445 if (player == first_player)
447 first_player = player->next;
451 struct NetworkServerPlayerInfo *p;
453 for (p = first_player; p != NULL; p = p->next)
455 if (p->next && p->next == player)
457 p->next = player->next;
464 if (player->introduced)
466 initNetworkBufferForWriting(write_buffer, OP_PLAYER_DISCONNECTED,
469 SendNetworkBufferToAllButOne(write_buffer, player);
475 #if 0 /* do not terminate network server if last player disconnected */
476 if (run_server_only_once && num_clients == 0)
480 Error(ERR_NETWORK_SERVER, "no clients left");
481 Error(ERR_NETWORK_SERVER, "aborting");
489 static void AddPlayer(TCPsocket fd)
491 struct NetworkServerPlayerInfo *player, *p;
493 boolean again = TRUE;
495 SDLNet_TCP_AddSocket(fds, fd);
497 player = checked_calloc(sizeof(struct NetworkServerPlayerInfo));
500 player->player_name[0] = 0;
501 player->active = FALSE;
502 player->introduced = FALSE;
504 player->action_received = FALSE;
505 player->next = first_player;
507 first_player = player;
516 if (p->number == number)
529 player->number = number;
532 initNetworkBufferForWriting(write_buffer, OP_YOUR_NUMBER, 0);
534 putNetworkBuffer8BitInteger(write_buffer, player->number);
536 SendNetworkBufferToClient(write_buffer, player);
539 static void Handle_OP_PROTOCOL_VERSION(struct NetworkServerPlayerInfo *player)
541 int protocol_version_major = getNetworkBuffer8BitInteger(read_buffer);
542 int protocol_version_minor = getNetworkBuffer8BitInteger(read_buffer);
543 int protocol_version_patch = getNetworkBuffer8BitInteger(read_buffer);
545 if (protocol_version_major != PROTOCOL_VERSION_MAJOR ||
546 protocol_version_minor != PROTOCOL_VERSION_MINOR)
549 Error(ERR_NETWORK_SERVER,
550 "client %d (%s) has wrong protocol version %d.%d.%d",
551 player->number, player->player_name,
552 protocol_version_major,
553 protocol_version_minor,
554 protocol_version_patch);
556 initNetworkBufferForWriting(write_buffer, OP_BAD_PROTOCOL_VERSION, 0);
558 putNetworkBuffer8BitInteger(write_buffer, PROTOCOL_VERSION_MAJOR);
559 putNetworkBuffer8BitInteger(write_buffer, PROTOCOL_VERSION_MINOR);
560 putNetworkBuffer8BitInteger(write_buffer, PROTOCOL_VERSION_PATCH);
562 SendNetworkBufferToClient(write_buffer, player);
564 RemovePlayer(player);
569 Error(ERR_NETWORK_SERVER,
570 "client %d (%s) uses protocol version %d.%d.%d",
571 player->number, player->player_name,
572 protocol_version_major,
573 protocol_version_minor,
574 protocol_version_patch);
578 static void Handle_OP_NUMBER_WANTED(struct NetworkServerPlayerInfo *player)
580 int nr_wanted = getNetworkBuffer8BitInteger(read_buffer);
581 int client_nr = player->number;
582 boolean nr_is_free = TRUE;
583 struct NetworkServerPlayerInfo *p;
586 Error(ERR_NETWORK_SERVER, "client %d (%s) wants to switch to # %d",
587 player->number, player->player_name, nr_wanted);
589 for (p = first_player; p != NULL; p = p->next)
591 if (p->number == nr_wanted)
602 Error(ERR_NETWORK_SERVER, "client %d (%s) switches to # %d",
603 player->number, player->player_name, nr_wanted);
604 else if (player->number == nr_wanted)
605 Error(ERR_NETWORK_SERVER, "client %d (%s) already has # %d",
606 player->number, player->player_name, nr_wanted);
608 Error(ERR_NETWORK_SERVER,
609 "client %d (%s) cannot switch (client %d already exists)",
610 player->number, player->player_name, nr_wanted);
614 player->number = nr_wanted;
616 initNetworkBufferForWriting(write_buffer, OP_NUMBER_WANTED, client_nr);
618 putNetworkBuffer8BitInteger(write_buffer, nr_wanted);
619 putNetworkBuffer8BitInteger(write_buffer, player->number);
621 SendNetworkBufferToAll(write_buffer);
624 static void Handle_OP_PLAYER_NAME(struct NetworkServerPlayerInfo *player)
626 char *player_name = getNetworkBufferString(read_buffer);
629 strncpy(player->player_name, player_name, MAX_PLAYER_NAME_LEN);
630 player->player_name[MAX_PLAYER_NAME_LEN] = '\0';
632 for (i = 0; i < MAX_PLAYER_NAME_LEN; i++)
634 if (player->player_name[i] < ' ' ||
635 ((unsigned char)(player->player_name[i]) > 0x7e &&
636 (unsigned char)(player->player_name[i]) <= 0xa0))
638 player->player_name[i] = 0;
644 if (!player->introduced)
646 initNetworkBufferForWriting(write_buffer, OP_PLAYER_CONNECTED,
649 SendNetworkBufferToAllButOne(write_buffer, player);
653 Error(ERR_NETWORK_SERVER, "client %d calls itself \"%s\"",
654 player->number, player->player_name);
656 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
658 SendNetworkBufferToAllButOne(write_buffer, player);
660 if (!player->introduced)
662 struct NetworkServerPlayerInfo *p;
664 for (p = first_player; p != NULL; p = p->next)
666 if (p != player && p->introduced)
668 initNetworkBufferForWriting(write_buffer, OP_PLAYER_CONNECTED,
671 SendNetworkBufferToClient(write_buffer, player);
673 initNetworkBufferForWriting(write_buffer, OP_PLAYER_NAME, p->number);
675 putNetworkBufferString(write_buffer, p->player_name);
677 SendNetworkBufferToClient(write_buffer, player);
682 player->introduced = TRUE;
685 static void Handle_OP_START_PLAYING(struct NetworkServerPlayerInfo *player)
687 char *new_leveldir_identifier = getNetworkBufferString(read_buffer);
688 int level_nr = getNetworkBuffer16BitInteger(read_buffer);
691 Error(ERR_NETWORK_SERVER,
692 "client %d (%s) starts game [level %d from level set '%s']",
693 player->number, player->player_name, level_nr,
694 new_leveldir_identifier);
696 struct NetworkServerPlayerInfo *p;
698 /* reset frame counter */
699 ServerFrameCounter = 0;
701 Error(ERR_NETWORK_SERVER, "resetting ServerFrameCounter to 0");
703 /* reset player actions */
704 for (p = first_player; p != NULL; p = p->next)
707 p->action_received = FALSE;
713 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
715 SendNetworkBufferToAll(write_buffer);
718 static void Handle_OP_PAUSE_PLAYING(struct NetworkServerPlayerInfo *player)
721 Error(ERR_NETWORK_SERVER, "client %d (%s) pauses game",
722 player->number, player->player_name);
724 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
726 SendNetworkBufferToAll(write_buffer);
729 static void Handle_OP_CONTINUE_PLAYING(struct NetworkServerPlayerInfo *player)
732 Error(ERR_NETWORK_SERVER, "client %d (%s) continues game",
733 player->number, player->player_name);
735 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
737 SendNetworkBufferToAll(write_buffer);
740 static void Handle_OP_STOP_PLAYING(struct NetworkServerPlayerInfo *player)
742 int cause_for_stopping = getNetworkBuffer8BitInteger(read_buffer);
745 Error(ERR_NETWORK_SERVER, "client %d (%s) stops game [%d]",
746 player->number, player->player_name, cause_for_stopping);
748 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
750 SendNetworkBufferToAll(write_buffer);
753 static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player)
755 int player_action = getNetworkBuffer8BitInteger(read_buffer);
756 int last_client_nr = 0;
757 struct NetworkServerPlayerInfo *p;
760 /* store player action */
761 for (p = first_player; p != NULL; p = p->next)
763 if (p->number == player->number)
765 p->action = player_action;
766 p->action_received = TRUE;
770 /* check if server received action from each player */
771 for (p = first_player; p != NULL; p = p->next)
773 if (!p->action_received)
776 if (p->number > last_client_nr)
777 last_client_nr = p->number;
780 int player_action_all[last_client_nr];
782 /* initialize all player actions to zero */
783 for (i = 0; i < last_client_nr; i++)
784 player_action_all[i] = 0;
786 /* broadcast actions of all players to all players */
787 for (p = first_player; p != NULL; p = p->next)
789 player_action_all[p->number - 1] = p->action;
792 p->action_received = FALSE;
795 initNetworkBufferForWriting(write_buffer, OP_MOVE_PLAYER, player->number);
797 putNetworkBuffer32BitInteger(write_buffer, ServerFrameCounter);
799 for (i = 0; i < last_client_nr; i++)
800 putNetworkBuffer8BitInteger(write_buffer, player_action_all[i]);
802 SendNetworkBufferToAll(write_buffer);
804 ServerFrameCounter++;
807 static void Handle_OP_BROADCAST_MESSAGE(struct NetworkServerPlayerInfo *player)
809 char *message = getNetworkBufferString(read_buffer);
812 Error(ERR_NETWORK_SERVER, "client %d (%s) sends message: %s",
813 player->number, player->player_name, message);
815 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
817 SendNetworkBufferToAllButOne(write_buffer, player);
820 static void Handle_OP_LEVEL_FILE(struct NetworkServerPlayerInfo *player)
822 copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
824 SendNetworkBufferToAllButOne(write_buffer, player);
827 static void ExitNetworkServer(int exit_value)
829 Error(ERR_NETWORK_SERVER, "exiting network server");
834 /* the following is not used for a standalone server;
835 the pointer points to an integer containing the port-number */
836 int NetworkServerThread(void *ptr)
838 NetworkServer(*((int *) ptr), 0);
840 /* should never be reached */
844 void NetworkServer(int port, int serveronly)
846 struct NetworkServerPlayerInfo *player;
849 #if defined(PLATFORM_UNIX) && !defined(PLATFORM_NEXT)
850 struct sigaction sact;
853 if (read_buffer == NULL)
854 read_buffer = newNetworkBuffer();
856 if (write_buffer == NULL)
857 write_buffer = newNetworkBuffer();
860 port = DEFAULT_SERVER_PORT;
862 // if only running the network server, exit on Ctrl-C
864 signal(SIGINT, ExitNetworkServer);
867 run_server_only_once = TRUE;
869 #if defined(PLATFORM_UNIX)
870 #if defined(PLATFORM_NEXT)
871 signal(SIGPIPE, SIG_IGN);
873 sact.sa_handler = SIG_IGN;
874 sigemptyset(&sact.sa_mask);
876 sigaction(SIGPIPE, &sact, NULL);
880 if (SDLNet_ResolveHost(&ip, NULL, port) == -1)
881 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_ResolveHost() failed: %s",
884 if ((fds = SDLNet_AllocSocketSet(MAX_PLAYERS + 1 + 1)) == NULL)
885 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_AllocSocketSet() failed: %s"),
888 if ((lfd = SDLNet_TCP_Open(&ip)) == NULL)
889 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_Open() failed: %s"),
892 if (SDLNet_TCP_AddSocket(fds, lfd) == -1)
893 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_AddSocket() failed: %s"),
896 if ((udp = SDLNet_UDP_Open(port)) == NULL)
897 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_UDP_Open() failed: %s",
900 if (SDLNet_UDP_AddSocket(fds, udp) == -1)
901 Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_AddSocket() failed: %s"),
906 Error(ERR_NETWORK_SERVER, "started up, listening on port %d", port);
907 Error(ERR_NETWORK_SERVER, "using protocol version %d.%d.%d",
908 PROTOCOL_VERSION_MAJOR,
909 PROTOCOL_VERSION_MINOR,
910 PROTOCOL_VERSION_PATCH);
915 // wait for 100 ms for activity on open network sockets
916 if (SDLNet_CheckSockets(fds, 100) < 1)
919 /* accept incoming TCP connections */
920 if (SDLNet_SocketReady(lfd))
922 Error(ERR_DEBUG, "got TCP packet");
926 newsock = SDLNet_TCP_Accept(lfd);
932 /* accept incoming UDP packets */
933 if (SDLNet_SocketReady(udp))
935 Error(ERR_DEBUG, "got UDP packet");
937 static UDPpacket packet;
939 int num_packets = SDLNet_UDP_Recv(udp, &packet);
941 if (num_packets == 1)
944 SDLNet_UDP_Send(udp, -1, &packet);
948 for (player = first_player; player != NULL; player = player->next)
950 if (!SDLNet_SocketReady(player->fd))
953 initNetworkBufferForReceiving(read_buffer);
955 int num_bytes = receiveNetworkBufferPacket(read_buffer, player->fd);
960 Error(ERR_NETWORK_SERVER, "EOF from client %d (%s)",
961 player->number, player->player_name);
963 RemovePlayer(player);
968 initNetworkBufferForReading(read_buffer);
970 int message_type = getNetworkBuffer8BitInteger(read_buffer);
972 /* skip player number */
973 getNetworkBuffer8BitInteger(read_buffer);
975 if (!player->introduced &&
976 message_type != OP_PLAYER_NAME &&
977 message_type != OP_PROTOCOL_VERSION)
980 Error(ERR_NETWORK_SERVER, "got opcode %d for client %d which is not introduced yet (expected OP_PLAYER_NAME or OP_PROTOCOL_VERSION)", message_type, player->number);
982 RemovePlayer(player);
987 switch (message_type)
989 case OP_PROTOCOL_VERSION:
990 Handle_OP_PROTOCOL_VERSION(player);
993 case OP_NUMBER_WANTED:
994 Handle_OP_NUMBER_WANTED(player);
998 Handle_OP_PLAYER_NAME(player);
1001 case OP_START_PLAYING:
1002 Handle_OP_START_PLAYING(player);
1005 case OP_PAUSE_PLAYING:
1006 Handle_OP_PAUSE_PLAYING(player);
1009 case OP_CONTINUE_PLAYING:
1010 Handle_OP_CONTINUE_PLAYING(player);
1013 case OP_STOP_PLAYING:
1014 Handle_OP_STOP_PLAYING(player);
1017 case OP_MOVE_PLAYER:
1018 Handle_OP_MOVE_PLAYER(player);
1021 case OP_BROADCAST_MESSAGE:
1022 Handle_OP_BROADCAST_MESSAGE(player);
1026 Handle_OP_LEVEL_FILE(player);
1030 if (options.verbose)
1031 Error(ERR_NETWORK_SERVER,
1032 "unknown opcode %d from client %d (%s)",
1033 message_type, player->number, player->player_name);