xref: /minix3/games/rogue/main.c (revision e3b78ef14fd58bd4477a5899732f50e4798b9dff)
1*e3b78ef1SRobin Karlsson /*	$NetBSD: main.c,v 1.9 2008/07/20 01:03:22 lukem Exp $	*/
2*e3b78ef1SRobin Karlsson 
3*e3b78ef1SRobin Karlsson /*
4*e3b78ef1SRobin Karlsson  * Copyright (c) 1988, 1993
5*e3b78ef1SRobin Karlsson  *	The Regents of the University of California.  All rights reserved.
6*e3b78ef1SRobin Karlsson  *
7*e3b78ef1SRobin Karlsson  * This code is derived from software contributed to Berkeley by
8*e3b78ef1SRobin Karlsson  * Timothy C. Stoehr.
9*e3b78ef1SRobin Karlsson  *
10*e3b78ef1SRobin Karlsson  * Redistribution and use in source and binary forms, with or without
11*e3b78ef1SRobin Karlsson  * modification, are permitted provided that the following conditions
12*e3b78ef1SRobin Karlsson  * are met:
13*e3b78ef1SRobin Karlsson  * 1. Redistributions of source code must retain the above copyright
14*e3b78ef1SRobin Karlsson  *    notice, this list of conditions and the following disclaimer.
15*e3b78ef1SRobin Karlsson  * 2. Redistributions in binary form must reproduce the above copyright
16*e3b78ef1SRobin Karlsson  *    notice, this list of conditions and the following disclaimer in the
17*e3b78ef1SRobin Karlsson  *    documentation and/or other materials provided with the distribution.
18*e3b78ef1SRobin Karlsson  * 3. Neither the name of the University nor the names of its contributors
19*e3b78ef1SRobin Karlsson  *    may be used to endorse or promote products derived from this software
20*e3b78ef1SRobin Karlsson  *    without specific prior written permission.
21*e3b78ef1SRobin Karlsson  *
22*e3b78ef1SRobin Karlsson  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*e3b78ef1SRobin Karlsson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*e3b78ef1SRobin Karlsson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*e3b78ef1SRobin Karlsson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*e3b78ef1SRobin Karlsson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*e3b78ef1SRobin Karlsson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*e3b78ef1SRobin Karlsson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*e3b78ef1SRobin Karlsson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*e3b78ef1SRobin Karlsson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*e3b78ef1SRobin Karlsson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*e3b78ef1SRobin Karlsson  * SUCH DAMAGE.
33*e3b78ef1SRobin Karlsson  */
34*e3b78ef1SRobin Karlsson 
35*e3b78ef1SRobin Karlsson #include <sys/cdefs.h>
36*e3b78ef1SRobin Karlsson #ifndef lint
37*e3b78ef1SRobin Karlsson __COPYRIGHT("@(#) Copyright (c) 1988, 1993\
38*e3b78ef1SRobin Karlsson  The Regents of the University of California.  All rights reserved.");
39*e3b78ef1SRobin Karlsson #endif /* not lint */
40*e3b78ef1SRobin Karlsson 
41*e3b78ef1SRobin Karlsson #ifndef lint
42*e3b78ef1SRobin Karlsson #if 0
43*e3b78ef1SRobin Karlsson static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 5/31/93";
44*e3b78ef1SRobin Karlsson #else
45*e3b78ef1SRobin Karlsson __RCSID("$NetBSD: main.c,v 1.9 2008/07/20 01:03:22 lukem Exp $");
46*e3b78ef1SRobin Karlsson #endif
47*e3b78ef1SRobin Karlsson #endif /* not lint */
48*e3b78ef1SRobin Karlsson 
49*e3b78ef1SRobin Karlsson /*
50*e3b78ef1SRobin Karlsson  * main.c
51*e3b78ef1SRobin Karlsson  *
52*e3b78ef1SRobin Karlsson  * This source herein may be modified and/or distributed by anybody who
53*e3b78ef1SRobin Karlsson  * so desires, with the following restrictions:
54*e3b78ef1SRobin Karlsson  *    1.)  No portion of this notice shall be removed.
55*e3b78ef1SRobin Karlsson  *    2.)  Credit shall not be taken for the creation of this source.
56*e3b78ef1SRobin Karlsson  *    3.)  This code is not to be traded, sold, or used for personal
57*e3b78ef1SRobin Karlsson  *         gain or profit.
58*e3b78ef1SRobin Karlsson  *
59*e3b78ef1SRobin Karlsson  */
60*e3b78ef1SRobin Karlsson 
61*e3b78ef1SRobin Karlsson #include "rogue.h"
62*e3b78ef1SRobin Karlsson 
63*e3b78ef1SRobin Karlsson int
main(int argc,char * argv[])64*e3b78ef1SRobin Karlsson main(int argc, char *argv[])
65*e3b78ef1SRobin Karlsson {
66*e3b78ef1SRobin Karlsson 	if (init(argc, argv)) {		/* restored game */
67*e3b78ef1SRobin Karlsson 		goto PL;
68*e3b78ef1SRobin Karlsson 	}
69*e3b78ef1SRobin Karlsson 
70*e3b78ef1SRobin Karlsson 	for (;;) {
71*e3b78ef1SRobin Karlsson 		clear_level();
72*e3b78ef1SRobin Karlsson 		make_level();
73*e3b78ef1SRobin Karlsson 		put_objects();
74*e3b78ef1SRobin Karlsson 		put_stairs();
75*e3b78ef1SRobin Karlsson 		add_traps();
76*e3b78ef1SRobin Karlsson 		put_mons();
77*e3b78ef1SRobin Karlsson 		put_player(party_room);
78*e3b78ef1SRobin Karlsson 		print_stats(STAT_ALL);
79*e3b78ef1SRobin Karlsson PL:
80*e3b78ef1SRobin Karlsson 		play_level();
81*e3b78ef1SRobin Karlsson 		free_stuff(&level_objects);
82*e3b78ef1SRobin Karlsson 		free_stuff(&level_monsters);
83*e3b78ef1SRobin Karlsson 	}
84*e3b78ef1SRobin Karlsson }
85