From: Peep P. <so...@us...> - 2004-03-15 18:59:21
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3528 Modified Files: net.c net.h Log Message: Added input_to_called. Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** net.c 12 Mar 2004 08:40:10 -0000 1.6 --- net.c 15 Mar 2004 18:50:10 -0000 1.7 *************** *** 89,93 **** player_t *p; ! object_t *temp_pl; p = type_xmalloc(player_t); --- 89,93 ---- player_t *p; ! object_t *player_ob; p = type_xmalloc(player_t); *************** *** 102,110 **** this_player = p; ! temp_pl = type_xmalloc(object_t); ! temp_pl->iaob = p; ! temp_pl->name = NULL; ! temp_pl->prog = NULL; ! this_ob = p->ob = temp_pl; { variable_t *login_ob, *pob; --- 102,110 ---- this_player = p; ! player_ob = type_xmalloc(object_t); ! player_ob->iaob = p; ! player_ob->name = NULL; ! player_ob->prog = NULL; ! this_ob = p->ob = player_ob; { variable_t *login_ob, *pob; *************** *** 117,134 **** /* More freedom to the coder! Doesn't have to return anything if not needed. */ printf("Warning: master::connect() didn't return an object.\n"); ! xfree(temp_pl); return; } p->ob = login_ob->u.ob; p->ob->iaob = p; apply(login_ob->u.ob, "logon", NULL); ! if(this_player == p && p->ob == temp_pl) { return; } ! /* temp_pl is not needed anymore if we get this far. */ ! xfree(temp_pl); } } --- 117,136 ---- /* More freedom to the coder! Doesn't have to return anything if not needed. */ printf("Warning: master::connect() didn't return an object.\n"); ! xfree(player_ob); return; } p->ob = login_ob->u.ob; + this_ob = login_ob->u.ob; p->ob->iaob = p; apply(login_ob->u.ob, "logon", NULL); ! if(this_player == p && p->ob == player_ob) { return; } ! debug("net_accept", "player object was changed to %p; freeing player_ob %p\n", p->ob, player_ob); ! /* player_ob is not needed anymore if we get this far. */ ! xfree(player_ob); } } *************** *** 170,173 **** --- 172,181 ---- goto out; } + + if(!p->ob) { + net_send("Oops, looks like you don't have an interactive object!\n", 55, p); + net_disconnect(p); + return; + } c = strchr(p->conn.recvbuf, '\r'); *************** *** 178,183 **** } else if(c = strchr(p->conn.recvbuf, '\n')) *c = '\0';*/ ! if(p->ob) ! apply(p->ob, p->input_to, "s", p->conn.recvbuf); /* The previous apply() might have destructed p->ob */ if(p->ob) --- 186,195 ---- } else if(c = strchr(p->conn.recvbuf, '\n')) *c = '\0';*/ ! p->input_to_called = 1; ! apply(p->ob, p->input_to, "s", p->conn.recvbuf); ! if(p->input_to_called) { /* input_to wasn't called again */ ! p->input_to = NULL; ! } ! /* The previous apply() might have destructed p->ob */ if(p->ob) Index: net.h =================================================================== RCS file: /cvsroot/agd/server/src/net.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** net.h 12 Mar 2004 16:02:05 -0000 1.7 --- net.h 15 Mar 2004 18:50:10 -0000 1.8 *************** *** 35,38 **** --- 35,39 ---- char *input_to; + int input_to_called; } player_t; |