* Copyright (c) 1988 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)init.c 5.2 (Berkeley) %G%";
* This source herein may be modified and/or distributed by anybody who
* so desires, with the following restrictions:
* 1.) No portion of this notice shall be removed.
* 2.) Credit shall not be taken for the creation of this source.
* 3.) This code is not to be traded, sold, or used for personal
char login_name
[MAX_OPT_LEN
];
char *nick_name
= (char *) 0;
boolean save_is_interactive
= 1;
char *error_file
= "rogue.esave";
char *byebye_string
= "Okay, bye bye!";
if ((!pn
) || (strlen(pn
) >= MAX_OPT_LEN
)) {
clean_up("Hey! Who are you?");
(void) strcpy(login_name
, pn
);
if (!score_only
&& !rest_file
) {
printf("Hello %s, just a moment while I dig the dungeon...",
if ((LINES
< DROWS
) || (COLS
< DCOLS
)) {
clean_up("must be played on 24 x 80 screen");
put_scores((object
*) 0, 0);
get_wand_and_ring_materials();
level_objects
.next_object
= (object
*) 0;
level_monsters
.next_monster
= (object
*) 0;
rogue
.pack
.next_object
= (object
*) 0;
(void) add_to_pack(obj
, &rogue
.pack
, 1);
obj
= alloc_object(); /* initial armor */
obj
->which_kind
= RINGMAIL
;
(void) add_to_pack(obj
, &rogue
.pack
, 1);
obj
= alloc_object(); /* initial weapons */
obj
->hit_enchant
= obj
->d_enchant
= 1;
(void) add_to_pack(obj
, &rogue
.pack
, 1);
(void) add_to_pack(obj
, &rogue
.pack
, 1);
obj
->quantity
= get_rand(25, 35);
(void) add_to_pack(obj
, &rogue
.pack
, 1);
if (save_is_interactive
) {
save_into_file(error_file
);
for (i
= 1; i
< argc
; i
++) {
for (j
= 1; argv
[i
][j
]; j
++) {
if (eptr
= md_getenv("ROGUEOPTS")) {
if (!strncmp(eptr
, "fruit=", 6)) {
env_get_value(&fruit
, eptr
, 1);
} else if (!strncmp(eptr
, "file=", 5)) {
env_get_value(&save_file
, eptr
, 0);
} else if (!strncmp(eptr
, "jump", 4)) {
} else if (!strncmp(eptr
, "name=", 5)) {
env_get_value(&nick_name
, eptr
, 0);
} else if (!strncmp(eptr
, "noaskquit", 9)) {
} else if (!strncmp(eptr
, "noskull", 5) ||
!strncmp(eptr
,"notomb", 6)) {
} else if (!strncmp(eptr
, "passgo", 5)) {
while ((*eptr
) && (*eptr
!= ',')) {
/* If some strings have not been set through ROGUEOPTS, assign defaults
* to them so that the options editor has data to work with.
init_str(&nick_name
, login_name
);
init_str(&save_file
, "rogue.save");
init_str(&fruit
, "slime-mold");
env_get_value(s
, e
, add_blank
)
while ((*e
) && (*e
!= ',')) {
*e
= ';'; /* ':' reserved for score file purposes */
if (++i
>= MAX_OPT_LEN
) {
*s
= md_malloc(MAX_OPT_LEN
+ 2);
(void) strncpy(*s
, t
, i
);
*str
= md_malloc(MAX_OPT_LEN
+ 2);
(void) strcpy(*str
, dflt
);