Update of /cvsroot/netrek/server/Vanilla/ntserv In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26631/ntserv Modified Files: commands.c daemonII.c data.c main.c ntscmds.c openmem.c redraw.c smessage.c Log Message: merge from jerub darcs 2006-05-12 Index: redraw.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/redraw.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- redraw.c 14 Apr 2006 10:19:17 -0000 1.3 +++ redraw.c 12 May 2006 03:44:48 -0000 1.4 @@ -210,7 +210,7 @@ me->p_wtemp = pl->p_wtemp; me->p_etemp = pl->p_etemp; /* These flags shouldn't be propagated to observers */ -#define NOOBSMASK (PFSELFDEST|PFPLOCK|PFPLLOCK|PFOBSERV) +#define NOOBSMASK (PFWAR|PFREFITTING|PFSELFDEST|PFPLOCK|PFPLLOCK|PFOBSERV) me->p_flags = (pl->p_flags & ~NOOBSMASK) | (me->p_flags & NOOBSMASK); me->p_dir = pl->p_dir; Index: ntscmds.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/ntscmds.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ntscmds.c 6 May 2006 13:12:56 -0000 1.11 +++ ntscmds.c 12 May 2006 03:44:48 -0000 1.12 @@ -226,7 +226,7 @@ { NULL } }; -int check_command(struct message *mess) +int do_check_command(struct message *mess) { return check_2_command(mess, nts_commands, (status->gameup & GU_INROBOT) ? 0 : C_PR_INPICKUP); Index: smessage.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/smessage.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- smessage.c 21 Mar 2005 05:23:44 -0000 1.1 +++ smessage.c 12 May 2006 03:44:48 -0000 1.2 @@ -66,6 +66,13 @@ } +static int (*do_message_post)(struct message *message) = NULL; + +void do_message_post_set(int (*proposed)(struct message *message)) +{ + do_message_post = proposed; +} + void do_message(int recip, int group, char *address, u_char from, const char *fmt, va_list args) { @@ -108,7 +115,10 @@ message_flag(cur,address); cur->m_flags |= MVALID; - if ((cur->m_flags & MINDIV) && (cur->m_recpt == me->p_no) && - (cur->m_from == me->p_no)) - check_command(cur); + if (do_message_post != NULL) { + if ((cur->m_flags & MINDIV) && (cur->m_recpt == me->p_no) && + (cur->m_from == me->p_no)) { + (*do_message_post)(cur); + } + } } Index: openmem.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/openmem.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- openmem.c 6 May 2006 14:02:37 -0000 1.4 +++ openmem.c 12 May 2006 03:44:48 -0000 1.5 @@ -70,6 +70,7 @@ { players = sharedMemory->players; torps = sharedMemory->torps; + context = sharedMemory->context; status = sharedMemory->status; planets = sharedMemory->planets; phasers = sharedMemory->phasers; Index: data.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/data.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- data.c 6 May 2006 12:06:39 -0000 1.7 +++ data.c 12 May 2006 03:44:48 -0000 1.8 @@ -9,6 +9,7 @@ struct player *players; struct player *me; struct torp *torps; +struct context *context; struct status *status; struct ship *myship; struct stats *mystats; Index: commands.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/commands.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- commands.c 6 May 2006 12:05:57 -0000 1.6 +++ commands.c 12 May 2006 03:44:48 -0000 1.7 @@ -507,8 +507,7 @@ return what; } -check_listing(comm) -char *comm; +int check_listing(char *comm) { register int i; @@ -675,9 +674,7 @@ /* ARGSUSED */ -int do_help(comm,mess) -char *comm; -struct message *mess; +int do_help(char *comm, struct message *mess) { int who; int i; @@ -748,63 +745,52 @@ votes[i].type, ch, votes[i].desc); } } - return; + return 0; } #ifndef INL /*** QUERIES ***/ -send_query(which,who,from) -char which; -int who, from; +int send_query(char which, int who, int from) { pmessage2(who, MINDIV, " ", from, "%c", which); + return 0; } /* ARGSUSED */ -do_client_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_client_query(char *comm, struct message *mess, int who) { #ifdef RSA send_query('#', who, mess->m_from); #endif + return 0; } /* ARGSUSED */ -do_ping_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_ping_query(char *comm, struct message *mess, int who) { - send_query('!', who, mess->m_from); + send_query('!', who, mess->m_from); + return 0; } /* ARGSUSED */ -do_stats_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_stats_query(char *comm, struct message *mess, int who) { - send_query('?', who, mess->m_from); + send_query('?', who, mess->m_from); + return 0; } /* ARGSUSED */ -do_whois_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_whois_query(char *comm, struct message *mess, int who) { - send_query('@', who, mess->m_from); + send_query('@', who, mess->m_from); + return 0; } #ifdef RSA -int bounceRSAClientType(from) -int from; +int bounceRSAClientType(int from) { bounce(from,"Client: %s", RSA_client_type); - return 1; } #endif @@ -869,9 +855,7 @@ return 1; } -int -bounceSBStats(from) - int from; +int bounceSBStats(int from) { float sessionRatio, sessionKPH, sessionDPH, overallKPH, overallDPH, overallRatio; @@ -961,8 +945,7 @@ #ifdef PING -int bouncePingStats(from) -int from; +int bouncePingStats(int from) { if(me->p_avrt == -1){ /* client doesn't support it or server not pinging */ @@ -986,34 +969,28 @@ #if !defined (DOG) && !defined (PUCK) /* Server only */ /* ARGSUSED */ -do_sbstats_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_sbstats_query(char *comm, struct message *mess, int who) { - send_query('^', who, mess->m_from); + send_query('^', who, mess->m_from); + return 0; } #ifdef GENO_COUNT -do_genos_query(comm,mess,who) -char *comm; -struct message *mess; -int who; +int do_genos_query(char *comm, struct message *mess, int who) { char *addr; addr = addr_mess(mess->m_from,MINDIV); pmessage(mess->m_from, MINDIV, addr, "%s has won the game %d times.", players[who].p_name,players[who].p_stats.st_genos); + return 0; } #endif /* ARGSUSED */ #if !defined (BASEP) || !defined(BASEPRACTICE) -do_time_msg(comm,mess) -char *comm; -struct message *mess; +int do_time_msg(char *comm, struct message *mess) { int who; int t; @@ -1029,6 +1006,7 @@ } else { pmessage(who, MINDIV, addr, "The %s have %d minutes left before they surrender.", team_name(t), teams[t].s_surrender); } + return 0; } /* @@ -1036,9 +1014,7 @@ */ /* ARGSUSED */ -do_queue_msg(comm,mess) -char *comm; -struct message *mess; +int do_queue_msg(char *comm, struct message *mess) { int who; char *addr; @@ -1059,6 +1035,7 @@ pmessage(who, MINDIV, addr, "There is no one on the %s queue.", queues[i].q_name); } + return 0; } #endif Index: main.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- main.c 6 May 2006 12:06:39 -0000 1.9 +++ main.c 12 May 2006 03:44:48 -0000 1.10 @@ -123,6 +123,7 @@ /* this finds the shared memory information */ openmem(1); + do_message_post_set(do_check_command); readsysdefaults(); #ifdef FEATURE_PACKETS Index: daemonII.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/daemonII.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- daemonII.c 6 May 2006 12:06:39 -0000 1.13 +++ daemonII.c 12 May 2006 03:44:48 -0000 1.14 @@ -228,6 +228,7 @@ status->kills=10; status->losses=10; } + context->daemon = getpid(); #undef wait @@ -4488,14 +4489,6 @@ } } -/* dummy check_command to fool do_message() */ - -int check_command(struct message *mess) { - /* get rid of annoying compiler warning */ - if (mess) ; - return 1; -} - void message_flag(struct message *cur, char *address) { if(arg[0] != DINVALID){