comparison xrogue/main.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents cadff8f047a1
children 7c1cb43f346e
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
25 #include "mach_dep.h" 25 #include "mach_dep.h"
26 #include "network.h" 26 #include "network.h"
27 #include "rogue.h" 27 #include "rogue.h"
28 28
29 void open_records(void); 29 void open_records(void);
30 30 bool too_much(void);
31 main(argc, argv, envp) 31 bool author(void);
32 char **argv; 32 bool playtime(void);
33 char **envp; 33 bool betaover(void);
34
35 int
36 main(int argc, char *argv[], char *envp[])
34 { 37 {
35 register char *env; 38 register char *env;
36 time_t now; 39 time_t now;
37 40
38 md_init(); 41 md_init();
281 /* 284 /*
282 * endit: 285 * endit:
283 * Exit the program abnormally. 286 * Exit the program abnormally.
284 */ 287 */
285 288
286 /*UNUSED*/ 289 void
287 void 290 endit(int sig)
288 endit(sig)
289 int sig;
290 { 291 {
291 NOOP(sig); 292 NOOP(sig);
292 fatal("Ok, if you want to exit that badly, I'll have to allow it\n"); 293 fatal("Ok, if you want to exit that badly, I'll have to allow it\n");
293 } 294 }
294 295
295 /* 296 /*
296 * fatal: 297 * fatal:
297 * Exit the program, printing a message. 298 * Exit the program, printing a message.
298 */ 299 */
299 300
300 fatal(s) 301 void
301 char *s; 302 fatal(char *s)
302 { 303 {
303 clear(); 304 clear();
304 move(lines-2, 0); 305 move(lines-2, 0);
305 printw("%s", s); 306 printw("%s", s);
306 draw(stdscr); 307 draw(stdscr);
311 /* 312 /*
312 * rnd: 313 * rnd:
313 * Pick a very random number. 314 * Pick a very random number.
314 */ 315 */
315 316
316 rnd(range) 317 int
317 register int range; 318 rnd(int range)
318 { 319 {
319 return( md_rand(range) ); 320 return( md_rand(range) );
320 } 321 }
321 322
322 /* 323 /*
323 * roll: 324 * roll:
324 * roll a number of dice 325 * roll a number of dice
325 */ 326 */
326 327
327 roll(number, sides) 328 int
328 register int number, sides; 329 roll(int number, int sides)
329 { 330 {
330 register int dtotal = 0; 331 register int dtotal = 0;
331 332
332 while(number--) 333 while(number--)
333 dtotal += rnd(sides)+1; 334 dtotal += rnd(sides)+1;
334 return dtotal; 335 return dtotal;
335 } 336 }
336 337
337 setup() 338 void
339 setup(void)
338 { 340 {
339 md_setup(); 341 md_setup();
340 } 342 }
341 343
342 /* 344 /*
343 * playit: 345 * playit:
344 * The main loop of the program. Loop until the game is over, 346 * The main loop of the program. Loop until the game is over,
345 * refreshing things and looking at the proper times. 347 * refreshing things and looking at the proper times.
346 */ 348 */
347 349
348 playit() 350 void
351 playit(void)
349 { 352 {
350 register char *opts; 353 register char *opts;
351 354
352 /* 355 /*
353 * parse environment declaration of options 356 * parse environment declaration of options
364 367
365 /* 368 /*
366 * see if the system is being used too much for this game 369 * see if the system is being used too much for this game
367 */ 370 */
368 371
369 too_much() 372 bool
373 too_much(void)
370 { 374 {
371 /* we no longer do load checking or user counts */ 375 /* we no longer do load checking or user counts */
372 return(FALSE); 376 return(FALSE);
373 } 377 }
374 378
375 /* 379 /*
376 * author: 380 * author:
377 * See if a user is an author of the program 381 * See if a user is an author of the program
378 */ 382 */
379 383
380 author() 384 bool
385 author(void)
381 { 386 {
382 switch (md_getuid()) { 387 switch (md_getuid()) {
383 case 0: /* always OK for root to play */ 388 case 0: /* always OK for root to play */
384 return TRUE; 389 return TRUE;
385 default: 390 default:
390 /* 395 /*
391 * playtime: 396 * playtime:
392 * Returns TRUE when it is a good time to play rogue 397 * Returns TRUE when it is a good time to play rogue
393 */ 398 */
394 399
395 playtime() 400 bool
401 playtime(void)
396 { 402 {
397 /* we no longer do playtime checking */ 403 /* we no longer do playtime checking */
398 404
399 return TRUE; 405 return TRUE;
400 } 406 }
402 /* 408 /*
403 * betaover: 409 * betaover:
404 * Returns TRUE if the test period of this version of the game is over 410 * Returns TRUE if the test period of this version of the game is over
405 */ 411 */
406 412
407 betaover() 413 bool
414 betaover(void)
408 { 415 {
409 return(FALSE); 416 return(FALSE);
410 } 417 }
411 418
412 419
413 exit_game(flag) 420 void
414 int flag; 421 exit_game(int flag)
415 { 422 {
416 int i; 423 int i;
417 424
418 if (flag & EXIT_CLS) /* Clear Screen */ 425 if (flag & EXIT_CLS) /* Clear Screen */
419 { 426 {