13 #include "gb/game_info.h" 14 #include "gb/racegen.h" 16 #define DEFAULT_ENROLLMENT_FILENAME "enroll.saves" 17 #define DEFAULT_ENROLLMENT_FAILURE_FILENAME "failures.saves" 30 static int recursing = 0;
31 static int successful_enroll_in_fix_mode = 0;
34 printf(
"Race (%s) unacceptable, for the following reason%c:\n",
35 race_info
.name, (n > 1) ?
's' :
'\0');
38 printf(
"\"Quit\" to break out of fix mode.\n");
42 n =
Dialogue("Abort, enroll anyway, fix, mail rejection?", "abort", 43 "enroll", "fix", "mail", 0
);
47 printf(
"Recursive racegen. \"Enroll\" or \"Quit\" to exit.\n");
51 if (successful_enroll_in_fix_mode) {
52 successful_enroll_in_fix_mode = 0;
57 if (failure_filename !=
nullptr) {
58 if (
nullptr == fopen(failure_filename,
"w+")) {
59 printf(
"Warning: unable to open failures file \"%s\".\n",
61 printf(
"Race not saved to failures file.\n");
65 printf(
"Race appended to failures file \"%s\".\n", failure_filename);
74 printf(
"Unable to open file \"%s\".\n",
TMP);
77 fprintf(g,
"To: %s\n", race_info
.address);
78 fprintf(g,
"Subject: %s Race Rejection\n",
GAME);
81 "The race you submitted (%s) was not accepted, for the " 82 "following reason%c:\n",
83 race_info
.name, (n > 1) ?
's' :
'\0');
86 fprintf(g,
"Please re-submit a race if you want to play in %s.\n",
GAME);
87 fprintf(g,
"(Check to make sure you are using racegen %s)\n",
VERSION);
89 fprintf(g,
"For verification, here is my understanding of your race:\n");
93 printf(
"Sending critique to %s via %s...", race_info
.address,
MAILER);
105 successful_enroll_in_fix_mode = 1;
111 printf(
"Unable to open file \"%s\".\n",
TMP);
114 fprintf(g,
"To: %s\n", race_info
.address);
115 fprintf(g,
"Subject: %s Race Accepted\n",
GAME);
117 fprintf(g,
"The race you submitted (%s) was accepted.\n", race_info
.name);
119 if (race.modified_by_diety) {
120 fprintf(g,
"The race was altered in order to be acceptable.\n") ;
121 fprintf(g,
"Your race now looks like this:\n") ;
123 print_to_file(g, verbose, 0) ;
129 printf(
"Sending acceptance to %s via %s...", race_info
.address,
MAILER);
143 g = fopen(argv[1],
"w+");
144 if (g ==
nullptr) printf(
"Unable to open failures file \"%s\".\n", argv[1]);
146 bcopy(&race_info, &last,
sizeof(
struct x));
154 printf(
"Race (%s) unacceptable, for the following reason%c:\n",
155 race_info
.name, (ret > 1) ?
's' :
'\0');
160 if (ret) printf(
"Enroll failed.\n");
174 f = fopen(argv[1],
"r");
176 printf(
"Unable to open races file \"%s\".\n", argv[1]);
181 g = fopen(argv[2],
"w");
182 if (g ==
nullptr) printf(
"Unable to open failures file \"%s\".\n", argv[2]);
198 printf(
"Enrolled %d race%c; %d failure%c saved in file %s.\n", nenrolled,
199 (nenrolled != 1) ?
's' :
'\0', n - nenrolled,
200 (n - nenrolled != 1) ?
's' :
'\0', argv[2]);
int critique_to_file(FILE *f, int rigorous_checking, int is_player_race)
static int enroll_player_race(char *failure_filename)
int load_from_file(FILE *g)
int enroll(int argc, char *argv[])
void process(int argc, char *argv[])
void print_to_file(FILE *f, int verbose)
int Dialogue(const char *,...)
void modify_print_loop(int level)
#define DEFAULT_ENROLLMENT_FAILURE_FILENAME
#define DEFAULT_ENROLLMENT_FILENAME