From: Peep P. <so...@us...> - 2004-03-18 20:55:33
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1421 Modified Files: net.c Log Message: Cleanup. Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- net.c 15 Mar 2004 18:50:10 -0000 1.7 +++ net.c 18 Mar 2004 20:45:47 -0000 1.8 @@ -22,18 +22,6 @@ return -1; } -#if 0 -void remove_player(int nr) -{ - int i; - for(i=nr;i<numplayers;i++) { - if(i + 1 < numplayers) - players[i] = players[i+1]; - } - numplayers--; -} -#endif - void net_listen(unsigned short port) { struct sockaddr_in sin; @@ -42,7 +30,7 @@ #ifdef WINSOCK WSADATA wsaData; if(WSAStartup(MAKEWORD(1, 1), &wsaData)) { - fprintf(stderr, "Network error: winsock init failed.\n"); + fprintf(stderr, "Network error: Winsock initialization failed.\n"); exit(2); } #endif @@ -114,9 +102,10 @@ crash(0, "master::connect() is not working", 3); if(!login_ob->u.ob) { - /* More freedom to the coder! Doesn't have to return anything if not needed. */ printf("Warning: master::connect() didn't return an object.\n"); + do_write("Oops, glitch in world fabric - you didn't get an object.\n"); xfree(player_ob); + net_disconnect(p); return; } @@ -206,14 +195,15 @@ fprintf(stderr, "Error reading from player!\n"); /* fall through, and make them netdead */ case 0: - apply(master, "net_dead", "o", pl->ob); - /* the login object will have to restore this object's iaob */ - pl->ob->iaob = NULL; + apply(pl->ob, "net_dead", "o", pl->ob); + if(pl->ob) { + /* the login object will have to restore this object's iaob */ + pl->ob->iaob = NULL; + } pl->conn.state = DISCONNECTED; break; default: net_read(pl); -/* pl->conn.idle = 0;*/ break; } } |