On Sun, Apr 09, 2006 at 11:13:44PM -0700, William Balcerski wrote: > Th increase in the numbers of players (MAXPLAYERS) made the index system > on the voting structure obsolete, I increased the number of voting slots and > indexed all the vote commands past where they would overlap with player > slots. Taken, kinda. I've adopted most of your change but then used macros to set the base of the array for non-eject votes. As I understand it, the non-eject votes cost us one array element in each player struct for each vote type. So the INL vote costs one time_t in each player struct. Patch attached. -- James Cameron mailto:quozl at us.netrek.org http://quozl.netrek.org/ -------------- next part -------------- Index: ChangeLog =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ChangeLog,v retrieving revision 1.16 diff -u -r1.16 ChangeLog --- ChangeLog 10 Apr 2006 10:56:30 -0000 1.16 +++ ChangeLog 10 Apr 2006 11:32:43 -0000 @@ -1,3 +1,8 @@ +Mon Apr 10 21:31:33 2006 James Cameron <quozl at us.netrek.org> + + * defs.h, ntscmds.c (nts_commands): reallocate voting array sizes. + Reported by: William Balcerski. + Mon Apr 10 20:41:52 2006 James Cameron <quozl at us.netrek.org> * struct.h: deprecate p_docked and p_ports in favour of Index: include/defs.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/include/defs.h,v retrieving revision 1.4 diff -u -r1.4 defs.h --- include/defs.h 10 Apr 2006 10:56:31 -0000 1.4 +++ include/defs.h 10 Apr 2006 11:32:45 -0000 @@ -64,7 +64,11 @@ the rest obs slots */ #ifdef VOTING -#define PV_TOTAL MAXPLAYER /* total number of votable slots */ +#define PV_EXTRA 8 /* # of non-eject vote types */ +#define PV_TOTAL MAXPLAYER+PV_EXTRA /* total number of voting slots */ +#define PV_EJECT 0 /* array base for eject votes */ +#define PV_OTHER MAXPLAYER /* array base for non-eject votes */ +/* see ntserv/ntscmds.c for array */ #endif #if defined(NEWBIESERVER) || defined(PRETSERVER) Index: ntserv/ntscmds.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/ntserv/ntscmds.c,v retrieving revision 1.5 diff -u -r1.5 ntscmds.c --- ntserv/ntscmds.c 10 Apr 2006 10:56:32 -0000 1.5 +++ ntserv/ntscmds.c 10 Apr 2006 11:32:48 -0000 @@ -189,52 +189,55 @@ C_VC_TEAM | C_GLOG | C_PLAYER | C_PR_INPICKUP, "Eject a player e.g. 'EJECT 0 IDLE'", do_player_eject, /* EJECT */ - 2, 0, 120, 600}, + 2, PV_EJECT, 120, 600}, #endif #if defined(TRIPLE_PLANET_MAYHEM) { "TRIPLE", C_VC_ALL | C_GLOG | C_PR_INPICKUP, "Start triple planet mayhem by vote", do_triple_planet_mayhem, - 2, 22, 0}, + 2, PV_OTHER, 0}, { "BALANCE", C_VC_ALL | C_GLOG | C_PR_INPICKUP, "Request team randomise & balance", do_balance, - 4, 23, 0 }, + 4, PV_OTHER+1, 0 }, #endif #if defined(AUTO_INL) { "INL", C_VC_ALL | C_GLOG | C_PR_INPICKUP, "Start game under INL rules.", do_start_inl, - 1, 20, 0 }, + 1, PV_OTHER+2, 0 }, #endif #if defined(AUTO_PRACTICE) { "PRACTICE", C_VC_ALL | C_PR_INPICKUP, "Start basepractice by majority vote.", do_start_basep, - 1, 20, 0 }, + 1, PV_OTHER+3, 0 }, #endif #if defined(AUTO_HOCKEY) { "HOCKEY", C_VC_ALL | C_GLOG | C_PR_INPICKUP, "Start hockey by majority vote.", do_start_puck, - 1, 20, 0 }, + 1, PV_OTHER+4, 0 }, #endif #if defined(AUTO_DOGFIGHT) { "DOGFIGHT", C_VC_ALL | C_GLOG | C_PR_INPICKUP, "Start dogfight tournament by majority vote.", do_start_mars, - 1, 20, 0 }, + 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 */ + { NULL } - }; +}; int check_command(struct message *mess) { @@ -308,9 +311,9 @@ void do_start_basep(void) { if (vfork() == 0) { - (void) SIGNAL(SIGALRM,SIG_DFL); - execl(Basep, "basep", 0); - perror(Basep); + (void) SIGNAL(SIGALRM,SIG_DFL); + execl(Basep, "basep", 0); + perror(Basep); } } #endif -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060410/7813b8b8/attachment.pgp