Update of /cvsroot/netrek/server/Vanilla/ntserv In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3547/ntserv Modified Files: data.c daemonII.c commands.c enter.c gencmds.c ntscmds.c slotmaint.c sysdefaults.c main.c Log Message: voting site policy Index: sysdefaults.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/sysdefaults.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sysdefaults.c 21 Mar 2005 05:23:44 -0000 1.1 +++ sysdefaults.c 26 Apr 2006 09:52:43 -0000 1.2 @@ -2,12 +2,8 @@ */ #include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <sys/types.h> #include <sys/stat.h> #include "defs.h" -#include INC_STRINGS #include "struct.h" #include "data.h" #include "copyright2.h" Index: ntscmds.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/ntscmds.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ntscmds.c 24 Apr 2006 12:35:17 -0000 1.8 +++ ntscmds.c 26 Apr 2006 09:52:43 -0000 1.9 @@ -26,13 +26,8 @@ #define C_PR_INPICKUP C_PR_1 -#if defined (ALLOW_EJECT) void do_player_eject(int who, int player, int mflags, int sendto); -#endif - -#if defined (ALLOW_BAN) void do_player_ban(int who, int player, int mflags, int sendto); -#endif #if defined (AUTO_INL) void do_start_inl(void); @@ -72,12 +67,8 @@ #ifdef GENO_COUNT void do_genos_query(char *comm, struct message *mess, int who); #endif -#if defined (ALLOW_EJECT) void eject_player(int who); -#endif -#if defined (ALLOW_BAN) void ban_player(int who); -#endif void do_client_query(char *comm, struct message *mess, int who); void do_ping_query(char *comm, struct message *mess, int who); void do_stats_query(char *comm, struct message *mess, int who); @@ -183,26 +174,18 @@ "Show player's genocides e.g. 'GENOS 0'", do_genos_query }, /* GENOS */ #endif -#ifdef VOTING - { "The following votes can be used: (M=Majority, T=Team vote)", C_DESC | C_PR_INPICKUP}, - { "Ejection Votes are recorded for the god to review.", - C_DESC | C_PR_INPICKUP}, -#if defined(ALLOW_EJECT) { "EJECT", C_VC_TEAM | C_GLOG | C_PLAYER | C_PR_INPICKUP, "Eject a player e.g. 'EJECT 0 IDLE'", do_player_eject, /* EJECT */ 2, PV_EJECT, 120, 600}, -#endif -#if defined(ALLOW_BAN) { "BAN", C_VC_TEAM | C_GLOG | C_PLAYER | C_PR_INPICKUP, "Eject and ban a player e.g. 'BAN 0'", do_player_ban, /* BAN */ 2, PV_BAN, 120, 600}, -#endif #if defined(TRIPLE_PLANET_MAYHEM) { "TRIPLE", C_VC_ALL | C_GLOG | C_PR_INPICKUP, @@ -243,7 +226,6 @@ do_start_mars, 1, PV_OTHER+5, 0 }, #endif -#endif /* VOTING */ /* crosscheck, last voting array element used (PV_OTHER+n) must not exceed PV_TOTAL, see include/defs.h */ @@ -257,7 +239,6 @@ (status->gameup & GU_INROBOT) ? 0 : C_PR_INPICKUP); } -#if defined (ALLOW_EJECT) void do_player_eject(int who, int player, int mflags, int sendto) { register struct player *j; @@ -265,17 +246,18 @@ j = &players[player]; - if (j->p_status == PFREE) { + if (!eject_vote_enable) { + reason = "Eject voting disabled in server configuration."; + } else if (j->p_status == PFREE) { reason = "You may not eject a free slot."; } else if (j->p_flags & PFROBOT) { reason = "You may not eject a robot."; } else if (j->p_team != players[who].p_team) { reason = "You may not eject players of the other team."; -#ifdef EJECT_ONLY_IF_QUEUE - } else if ((queues[QU_PICKUP].q_flags & QU_OPEN) && - (queues[QU_PICKUP].count == 0)){ + } else if (eject_vote_only_if_queue && + (queues[QU_PICKUP].q_flags & QU_OPEN) && + (queues[QU_PICKUP].count == 0)){ reason = "You may not eject if there is no queue."; -#endif } if (reason != NULL) { @@ -299,12 +281,12 @@ j->p_ship.s_type = STARBASE; j->p_whydead=KQUIT; j->p_explode=10; - /* note VICIOUS_EJECT prevents animation of ship explosion */ + /* note vicious eject prevents animation of ship explosion */ j->p_status=PEXPLODE; j->p_whodead=me->p_no; bay_release(j); -#if defined(VICIOUS_EJECT) + if (eject_vote_vicious) { /* Eject AND free the slot. I am sick of the idiots who login and just make the game less playable. And @@ -316,12 +298,9 @@ } else { freeslot(j); } -#endif - + } } -#endif /* ALLOW_EJECT */ -#if defined (ALLOW_BAN) void do_player_ban(int who, int player, int mflags, int sendto) { struct player *j; @@ -329,7 +308,9 @@ j = &players[player]; - if (j->p_status == PFREE) { + if (!ban_vote_enable) { + reason = "Ban voting disabled in server configuration."; + } else if (j->p_status == PFREE) { reason = "You may not ban a free slot."; } else if (j->p_flags & PFROBOT) { reason = "You may not ban a robot."; @@ -359,7 +340,7 @@ struct ban *b = &bans[i]; if (b->b_expire == 0) { strcpy(b->b_ip, j->p_ip); - b->b_expire = 100; + b->b_expire = ban_vote_length; ERROR(2,( "ban of %s was voted\n", b->b_ip)); return; } @@ -367,7 +348,6 @@ pmessage(0, MALL, addr_mess(who,MALL), " temporary ban list is full, ban ineffective"); } -#endif /* ALLOW_BAN */ #if defined(AUTO_PRACTICE) void do_start_basep(void) Index: slotmaint.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/slotmaint.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- slotmaint.c 21 Mar 2005 10:17:17 -0000 1.2 +++ slotmaint.c 26 Apr 2006 09:52:43 -0000 1.3 @@ -40,11 +40,7 @@ who->p_stats.st_tticks=1; */ queues[who->w_queue].free_slots++; - -#ifdef VOTING MZERO(who->voting, sizeof(time_t) * PV_TOTAL); -#endif - who->p_process = 0; return retvalue; @@ -105,13 +101,8 @@ } players[i].p_stats.st_keymap[95]=0; players[i].p_stats.st_flags=ST_INITIAL; - players[i].p_process = 0; - -#ifdef VOTING MZERO(players[i].voting, sizeof(time_t) * PV_TOTAL); -#endif - #ifdef OBSERVERS if (queues[w_queue].q_flags & QU_OBSERVER) Observer++; #endif Index: enter.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/enter.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- enter.c 10 Apr 2006 10:56:32 -0000 1.3 +++ enter.c 26 Apr 2006 09:52:43 -0000 1.4 @@ -190,13 +190,11 @@ me->p_war = me->p_hostile; } -#ifdef VOTING /* reset eject voting to avoid inheriting this slot's last occupant's */ /* escaped fate just in case the last vote comes through after the */ /* old guy quit and the new guy joined -Villalpando req. by Cameron */ for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) j->voting[me->p_no] = -1; -#endif /* join message stuff */ sprintf(me->p_mapchars,"%c%c",teamlet[me->p_team], shipnos[me->p_no]); Index: daemonII.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/daemonII.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- daemonII.c 24 Apr 2006 10:12:17 -0000 1.11 +++ daemonII.c 26 Apr 2006 09:52:43 -0000 1.12 @@ -188,9 +188,7 @@ #endif players[i].p_no=i; players[i].p_timerdelay = defskip; -#ifdef VOTING MZERO(players[i].voting, sizeof(time_t) * PV_TOTAL); -#endif } #ifdef NEUTRAL Index: data.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/data.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- data.c 24 Apr 2006 12:35:17 -0000 1.5 +++ data.c 26 Apr 2006 09:52:43 -0000 1.6 @@ -407,3 +407,11 @@ int whitelisted = 0; int blacklisted = 0; int ignored[MAXPLAYER]; + +int voting=0; +int ban_vote_enable=0; +int ban_vote_length=10; +int ban_vote_offset=0; +int eject_vote_enable=0; +int eject_vote_only_if_queue=0; +int eject_vote_vicious=0; Index: commands.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/commands.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- commands.c 23 Apr 2006 10:39:10 -0000 1.4 +++ commands.c 26 Apr 2006 09:52:43 -0000 1.5 @@ -50,13 +50,10 @@ int do_help(); char *check_possible(char *line, char *command); int getplayer(int from, char *line); - -#ifdef VOTING int do_generic_vote(char *comm, int who); int do_start_robot(); -#endif -#if defined (ALLOW_EJECT) && !defined(INL) +#if !defined(INL) int do_player_eject(); #endif @@ -378,8 +375,6 @@ -#ifdef VOTING - /*********** VOTING LIST *********** Note: The vote list *must* must be in upper case. @@ -399,7 +394,7 @@ struct vote_handler votes[] = { { NULL, 0, 0, 0, NULL, 0, NULL}, /* record 0 */ -#if defined(ALLOW_EJECT) && !defined(INL) +#if !defined(INL) { "EJECT", VC_TEAM | VC_GLOG | VC_PLAYER, 2, @@ -492,8 +487,6 @@ #define NUM_VOTES (sizeof(votes) / sizeof(votes[0]) ) -#endif /* VOTING */ - /* Using just strstr is not enough to ensure uniqueness. There are commands such as STATS and SBSTATS that could be matched in two @@ -564,9 +557,8 @@ } } i = 0; -#ifdef VOTING - i = do_generic_vote(upper,mess->m_from); /* maybe it's a vote? */ -#endif + if (voting) + i = do_generic_vote(upper,mess->m_from); /* maybe it's a vote? */ free (upper); return (i); } @@ -1003,7 +995,7 @@ #endif /* TRIPLE_PLANET_MAYHEM */ -#if defined (ALLOW_EJECT) +#if !defined(INL) int do_player_eject(int who, int player, int mflags, int sendto) { register struct player *j; @@ -1052,9 +1044,7 @@ j->p_status=PEXPLODE; j->p_whodead=me->p_no; } -#endif /* ALLOW_EJECT */ - -#ifdef VOTING +#endif check_listing(comm) char *comm; @@ -1206,7 +1196,6 @@ } return 1; } -#endif /* VOTING */ #if defined(AUTO_PRACTICE) && !defined(BASEP) int do_start_basep(who, mflags, sendto) @@ -1332,8 +1321,7 @@ } } -#ifdef VOTING - if (NUM_VOTES > 1) { + if (voting && (NUM_VOTES > 1)) { char ch; pmessage(who,MINDIV,addr, "The following votes can be used: (M=Majority, T=Team vote)"); @@ -1347,7 +1335,6 @@ votes[i].type, ch, votes[i].desc); } } -#endif } #ifndef INL Index: main.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- main.c 24 Apr 2006 12:35:17 -0000 1.7 +++ main.c 26 Apr 2006 09:52:43 -0000 1.8 @@ -832,7 +832,7 @@ if (b->b_expire) { if (!strcmp(b->b_ip, ip)) { ERROR(2,( "ban of %s has been probed\n", b->b_ip)); - b->b_expire += 10; + b->b_expire += ban_vote_offset; return TRUE; } b->b_expire--; Index: gencmds.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/gencmds.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gencmds.c 22 Apr 2006 11:31:53 -0000 1.2 +++ gencmds.c 26 Apr 2006 09:52:43 -0000 1.3 @@ -105,24 +105,16 @@ } } /* !C_GLOG */ -#ifdef VOTING - if (cmds[i].tag & (C_VC_ALL | C_VC_TEAM)) - { - if (do_vote(comm, mess, cmds, i)) - { + if ((voting) && (cmds[i].tag & (C_VC_ALL | C_VC_TEAM))) { + if (do_vote(comm, mess, cmds, i)) { if ( cmds[i].tag & C_GLOG ) { - if (glog_open() == 0) { /* Log pass for God to see */ glog_printf("VOTE: The motion %s passes\n", comm); } } } - } - else -#endif - { - if (cmds[i].tag & C_PLAYER) - { + } else { + if (cmds[i].tag & C_PLAYER) { int who; /* This is really not that useful - If the calling @@ -131,13 +123,11 @@ who = getplayer(mess->m_from, comm); if (who >= 0) (*cmds[i].handler)(comm, mess, who, cmds, i, prereqs); - else - { + else { free(comm); return 0; } - } - else + } else (*cmds[i].handler)(comm, mess, cmds, i, prereqs); } free(comm); @@ -179,7 +169,6 @@ return what; } -#ifdef VOTING int do_vote(char *comm, struct message *mess, struct command_handler_2 *votes, int num) { @@ -316,7 +305,6 @@ return 0; } } -#endif /* VOTING */ /* ARGSUSED */ int do_help(char *comm, struct message *mess, struct command_handler_2 *cmds, @@ -344,8 +332,7 @@ (its description has a value of NULL, not "") Use this hack to make a command hidden */ continue; -#ifdef VOTING - else if (cmds[i].tag & (C_VC_TEAM | C_VC_ALL)) + else if ((voting)&&(cmds[i].tag & (C_VC_TEAM | C_VC_ALL))) { char ch; @@ -358,7 +345,6 @@ pmessage(who,MINDIV,addr, "|%10s - %c: %s", cmds[i].command, ch, cmds[i].desc); } -#endif /* VOTING */ else pmessage(who,MINDIV,addr, "|%10s - %s", cmds[i].command, cmds[i].desc);