1 #include "struct.h"
2 #include "ircaux.h"
3 #include "server.h"
4 #include "output.h"
5 #include "module.h"
6 #include "parse.h"
7 #include "timer.h"
8 #include <sys/time.h>
9 #include <stdlib.h>
10 #include <stdio.h>
11 
12 #define INIT_MODULE
13 #include "modval.h"
14 
15 /*
16  * I put this here because pana said I should use it, but its commented out
17  * in ircaux.h :)
18  */
19 #ifndef new_realloc
20 #define new_realloc(x,y) n_realloc((x),(y),__FILE__,__LINE__)
21 #endif
22 
23 #define MINPLAYERS 2            /* Minimum number of players per game */
24 #define MAXPLAYERS 10           /* Max number of players per game */
25 #define MINLENGTH 3             /* Minimum number of letters per acronym */
26 #define MAXLENGTH 5             /* Max number of letters per acronym */
27 #define ROUNDS 10               /* Number of rounds to play */
28 #define EXTENSIONS 3            /* Max number of 30 second extensions */
29 #define TOP 10                  /* Show the top XX names for the scores */
30 #define MAXLEN 15               /* Max number of characters per acro word */
31 
32 /*
33  * These must be "proper" paths -- ie the ENTIRE path must exist and there
34  * are no expansion characters in there (IE ~ or $(HOME))
35  */
36 
37 #define SCOREFILE ".BitchX/acro.score"
38 #define WEBSCORE "acro.html"
39 
40 /* prec -- a linked list containing all the player info */
41 
42 typedef struct _prec {
43 	char *nick;
44 	char *host;
45 	char *acro;
46 	char *last;
47 	struct _prec *next;
48 } prec;
49 
50 /* vrec -- linked list storing voters, and who they voted for */
51 
52 typedef struct _vrec {
53 	char *nick;
54 	char *host;
55 	int vote;
56 	struct _vrec *next;
57 } vrec;
58 
59 /* grec -- struct containing the info about the current game */
60 
61 typedef struct {
62 	int progress;
63 	int round;
64 	int rounds;
65 	int players;
66 	int extended;
67 	int top;
68 	int maxlen;
69 	char *nym;
70 } grec;
71 
72 /* srec -- linked list of scores */
73 
74 typedef struct _srec {
75 	struct _srec *next;
76 	char *nick;
77 	unsigned long score;
78 } srec;
79 
80 struct settings {
81 	int minplayers;
82 	int maxplayers;
83 	int minlength;
84 	int maxlength;
85 	int rounds;
86 	int extensions;
87 	int top;
88 	int maxlen;
89 	char *scorefile;
90 	char *webscore;
91 };
92 
93 static char letters[] = "ABCDEFGHIJKLMNOPRSTUVWY";
94 
95 static int acro_main (char *, char *, char *, char **);
96 int Acro_Init(IrcCommandDll **, Function_ptr *);
97 BUILT_IN_DLL(put_scores);
98 grec *init_acro(grec *);
99 void make_acro(grec *);
100 int valid_acro(grec *, char *);
101 void read_scores(void);
102 int write_scores(srec *);
103 prec *take_acro(grec *, prec *, char *, char *, char *);
104 vrec *take_vote(grec *, vrec *, prec *, char *, char *, char *);
105 srec *end_vote(vrec *, prec *, srec *);
106 srec *sort_scores(srec *);
107 void show_scores(grec *, srec *, srec *, char *);
108 int warn_acro(void *, char *);
109 int start_vote(void *, char *);
110 int warn_vote(void *, char *);
111 int end_voting(void *, char *);
112 void show_acros(prec *, char *);
113 void free_round(prec **, vrec **);
114 void free_score(srec **);
115 /* static void game_setup _(( IrcCommandDll *, char *, char *, char *)); */
116