Path: uunet!news.tek.com!saab!billr From: billr@saab.CNA.TEK.COM (Bill Randle) Newsgroups: comp.sources.games Subject: v18i051: nethack31 - display oriented dungeons & dragons (Ver. 3.1), Patch3r/18 Date: 20 Jul 1993 22:33:50 GMT Organization: Tektronix, Inc, Redmond, OR, USA Lines: 1162 Approved: billr@saab.CNA.TEK.COM Message-ID: <22hrse$9rm@ying.cna.tek.com> NNTP-Posting-Host: saab.cna.tek.com Xref: uunet comp.sources.games:1851 Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller) Posting-number: Volume 18, Issue 51 Archive-name: nethack31/patch3r Patch-To: nethack31: Volume 16, Issue 1-116 Environment: Amiga, Atari, Mac, MS-DOS, Windows-NT, OS2, Unix, VMS, X11 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'sys/share/lev_yacc.c2' <<'END_OF_FILE' X init_lev.lit = yyvsp[-2].i; X init_lev.walled = yyvsp[0].i; X yyval.i = 1; X } Xbreak; Xcase 14: X{ X yyval.i = 0; X } Xbreak; Xcase 15: X{ X yyval.i = lev_flags; X lev_flags = 0; /* clear for next user */ X } Xbreak; Xcase 16: X{ X lev_flags |= yyvsp[-2].i; X } Xbreak; Xcase 17: X{ X lev_flags |= yyvsp[0].i; X } Xbreak; Xcase 20: X{ X int i, j; X X i = strlen(yyvsp[0].map) + 1; X j = tmpmessage[0] ? strlen(tmpmessage) : 0; X if(i+j > 255) { X yyerror("Message string too long (>256 characters)"); X } else { X if(j) tmpmessage[j++] = '\n'; X strncpy(tmpmessage+j, yyvsp[0].map, i-1); X tmpmessage[j+i-1] = 0; X } X } Xbreak; Xcase 23: X{ X if(special_lev.nrobjects) { X yyerror("Object registers already initialized!"); X } else { X special_lev.nrobjects = n_olist; X special_lev.robjects = (char *) alloc(n_olist); X (void) memcpy((genericptr_t)special_lev.robjects, X (genericptr_t)olist, n_olist); X } X } Xbreak; Xcase 24: X{ X if(special_lev.nrmonst) { X yyerror("Monster registers already initialized!"); X } else { X special_lev.nrmonst = n_mlist; X special_lev.rmonst = (char *) alloc(n_mlist); X (void) memcpy((genericptr_t)special_lev.rmonst, X (genericptr_t)mlist, n_mlist); X } X } Xbreak; Xcase 25: X{ X tmproom[nrooms] = New(room); X (void) memset((genericptr_t) tmproom[nrooms], 0, X sizeof *tmproom[nrooms]); X tmproom[nrooms]->name = (char *) 0; X tmproom[nrooms]->parent = (char *) 0; X tmproom[nrooms]->rtype = 0; X tmproom[nrooms]->rlit = 0; X tmproom[nrooms]->xalign = ERR; X tmproom[nrooms]->yalign = ERR; X tmproom[nrooms]->x = 0; X tmproom[nrooms]->y = 0; X tmproom[nrooms]->w = 2; X tmproom[nrooms]->h = 2; X in_room = 1; X } Xbreak; Xcase 31: X{ X tmpcor[0] = New(corridor); X tmpcor[0]->src.room = -1; X ncorridor = 1; X } Xbreak; Xcase 34: X{ X tmpcor[ncorridor] = New(corridor); X tmpcor[ncorridor]->src.room = yyvsp[-2].corpos.room; X tmpcor[ncorridor]->src.wall = yyvsp[-2].corpos.wall; X tmpcor[ncorridor]->src.door = yyvsp[-2].corpos.door; X tmpcor[ncorridor]->dest.room = yyvsp[0].corpos.room; X tmpcor[ncorridor]->dest.wall = yyvsp[0].corpos.wall; X tmpcor[ncorridor]->dest.door = yyvsp[0].corpos.door; X ncorridor++; X } Xbreak; Xcase 35: X{ X tmpcor[ncorridor]->src.room = yyvsp[-2].corpos.room; X tmpcor[ncorridor]->src.wall = yyvsp[-2].corpos.wall; X tmpcor[ncorridor]->src.door = yyvsp[-2].corpos.door; X tmpcor[ncorridor]->dest.room = -1; X tmpcor[ncorridor]->dest.wall = yyvsp[0].i; X ncorridor++; X } Xbreak; Xcase 36: X{ X if (yyvsp[-5].i >= nrooms) X yyerror("Wrong room number!"); X yyval.corpos.room = yyvsp[-5].i; X yyval.corpos.wall = yyvsp[-3].i; X yyval.corpos.door = yyvsp[-1].i; X } Xbreak; Xcase 37: X{ X store_room(); X } Xbreak; Xcase 38: X{ X store_room(); X } Xbreak; Xcase 39: X{ X tmproom[nrooms] = New(room); X (void) memset((genericptr_t) tmproom[nrooms], 0, X sizeof *tmproom[nrooms]); X tmproom[nrooms]->parent = dup_string(yyvsp[-1].map); X tmproom[nrooms]->name = (char *) 0; X tmproom[nrooms]->rtype = yyvsp[-9].i; X tmproom[nrooms]->rlit = yyvsp[-7].i; X tmproom[nrooms]->filled = yyvsp[0].i; X tmproom[nrooms]->xalign = ERR; X tmproom[nrooms]->yalign = ERR; X tmproom[nrooms]->x = current_coord.x; X tmproom[nrooms]->y = current_coord.y; X tmproom[nrooms]->w = current_size.width; X tmproom[nrooms]->h = current_size.height; X in_room = 1; X } Xbreak; Xcase 40: X{ X tmproom[nrooms] = New(room); X (void) memset((genericptr_t) tmproom[nrooms], 0, X sizeof *tmproom[nrooms]); X tmproom[nrooms]->name = (char *) 0; X tmproom[nrooms]->parent = (char *) 0; X tmproom[nrooms]->rtype = yyvsp[-9].i; X tmproom[nrooms]->rlit = yyvsp[-7].i; X tmproom[nrooms]->filled = yyvsp[0].i; X tmproom[nrooms]->xalign = current_align.x; X tmproom[nrooms]->yalign = current_align.y; X tmproom[nrooms]->x = current_coord.x; X tmproom[nrooms]->y = current_coord.y; X tmproom[nrooms]->w = current_size.width; X tmproom[nrooms]->h = current_size.height; X in_room = 1; X } Xbreak; Xcase 41: X{ X yyval.i = 1; X } Xbreak; Xcase 42: X{ X yyval.i = yyvsp[0].i; X } Xbreak; Xcase 43: X{ X if ( yyvsp[-3].i < 1 || yyvsp[-3].i > 5 || X yyvsp[-1].i < 1 || yyvsp[-1].i > 5 ) { X yyerror("Room position should be between 1 & 5!"); X } else { X current_coord.x = yyvsp[-3].i; X current_coord.y = yyvsp[-1].i; X } X } Xbreak; Xcase 44: X{ X current_coord.x = current_coord.y = ERR; X } Xbreak; Xcase 45: X{ X if ( yyvsp[-3].i < 0 || yyvsp[-1].i < 0) { X yyerror("Invalid subroom position !"); X } else { X current_coord.x = yyvsp[-3].i; X current_coord.y = yyvsp[-1].i; X } X } Xbreak; Xcase 46: X{ X current_coord.x = current_coord.y = ERR; X } Xbreak; Xcase 47: X{ X current_align.x = yyvsp[-3].i; X current_align.y = yyvsp[-1].i; X } Xbreak; Xcase 48: X{ X current_align.x = current_align.y = ERR; X } Xbreak; Xcase 49: X{ X current_size.width = yyvsp[-3].i; X current_size.height = yyvsp[-1].i; X } Xbreak; Xcase 50: X{ X current_size.height = current_size.width = ERR; X } Xbreak; Xcase 66: X{ X if (tmproom[nrooms]->name) X yyerror("This room already has a name!"); X else X tmproom[nrooms]->name = dup_string(yyvsp[0].map); X } Xbreak; Xcase 67: X{ X if (tmproom[nrooms]->chance) X yyerror("This room already assigned a chance!"); X else if (tmproom[nrooms]->rtype == OROOM) X yyerror("Only typed rooms can have a chance!"); X else if (yyvsp[0].i < 1 || yyvsp[0].i > 99) X yyerror("The chance is supposed to be precentile."); X else X tmproom[nrooms]->chance = yyvsp[0].i; X } Xbreak; Xcase 68: X{ X /* ERR means random here */ X if (yyvsp[-2].i == ERR && yyvsp[0].i != ERR) { X yyerror("If the door wall is random, so must be its pos!"); X } else { X tmprdoor[ndoor] = New(room_door); X tmprdoor[ndoor]->secret = yyvsp[-6].i; X tmprdoor[ndoor]->mask = yyvsp[-4].i; X tmprdoor[ndoor]->wall = yyvsp[-2].i; X tmprdoor[ndoor]->pos = yyvsp[0].i; X ndoor++; X } X } Xbreak; Xcase 75: X{ X maze.filling = yyvsp[0].i; X if (index(yyvsp[-2].map, '.')) X yyerror("Invalid dot ('.') in level name."); X if (strlen(yyvsp[-2].map) > 8) X yyerror("Level names limited to 8 characters."); X yyval.map = yyvsp[-2].map; X in_room = 0; X } Xbreak; Xcase 76: X{ X yyval.i = get_floor_type((char)yyvsp[0].i); X } Xbreak; Xcase 77: X{ X yyval.i = -1; X } Xbreak; Xcase 80: X{ X store_part(); X } Xbreak; Xcase 81: X{ X tmppart[npart] = New(mazepart); X tmppart[npart]->halign = 1; X tmppart[npart]->valign = 1; X tmppart[npart]->nrobjects = 0; X tmppart[npart]->nloc = 0; X tmppart[npart]->nrmonst = 0; X tmppart[npart]->xsize = 1; X tmppart[npart]->ysize = 1; X tmppart[npart]->map = (char **) alloc(sizeof(char *)); X tmppart[npart]->map[0] = (char *) alloc(1); X tmppart[npart]->map[0][0] = STONE; X max_x_map = COLNO-1; X max_y_map = ROWNO; X } Xbreak; Xcase 82: X{ X tmppart[npart] = New(mazepart); X tmppart[npart]->halign = yyvsp[-1].i % 10; X tmppart[npart]->valign = yyvsp[-1].i / 10; X tmppart[npart]->nrobjects = 0; X tmppart[npart]->nloc = 0; X tmppart[npart]->nrmonst = 0; X scan_map(yyvsp[0].map); X } Xbreak; Xcase 83: X{ X yyval.i = yyvsp[-2].i + (yyvsp[0].i * 10); X } Xbreak; Xcase 90: X{ X if (tmppart[npart]->nrobjects) { X yyerror("Object registers already initialized!"); X } else { X tmppart[npart]->robjects = (char *)alloc(n_olist); X (void) memcpy((genericptr_t)tmppart[npart]->robjects, X (genericptr_t)olist, n_olist); X tmppart[npart]->nrobjects = n_olist; X } X } Xbreak; Xcase 91: X{ X if (tmppart[npart]->nloc) { X yyerror("Location registers already initialized!"); X } else { X register int i; X tmppart[npart]->rloc_x = (char *) alloc(n_plist); X tmppart[npart]->rloc_y = (char *) alloc(n_plist); X for(i=0;irloc_x[i] = plist[i].x; X tmppart[npart]->rloc_y[i] = plist[i].y; X } X tmppart[npart]->nloc = n_plist; X } X } Xbreak; Xcase 92: X{ X if (tmppart[npart]->nrmonst) { X yyerror("Monster registers already initialized!"); X } else { X tmppart[npart]->rmonst = (char *) alloc(n_mlist); X (void) memcpy((genericptr_t)tmppart[npart]->rmonst, X (genericptr_t)mlist, n_mlist); X tmppart[npart]->nrmonst = n_mlist; X } X } Xbreak; Xcase 93: X{ X if (n_olist < MAX_REGISTERS) X olist[n_olist++] = yyvsp[0].i; X else X yyerror("Object list too long!"); X } Xbreak; Xcase 94: X{ X if (n_olist < MAX_REGISTERS) X olist[n_olist++] = yyvsp[-2].i; X else X yyerror("Object list too long!"); X } Xbreak; Xcase 95: X{ X if (n_mlist < MAX_REGISTERS) X mlist[n_mlist++] = yyvsp[0].i; X else X yyerror("Monster list too long!"); X } Xbreak; Xcase 96: X{ X if (n_mlist < MAX_REGISTERS) X mlist[n_mlist++] = yyvsp[-2].i; X else X yyerror("Monster list too long!"); X } Xbreak; Xcase 97: X{ X if (n_plist < MAX_REGISTERS) X plist[n_plist++] = current_coord; X else X yyerror("Location list too long!"); X } Xbreak; Xcase 98: X{ X if (n_plist < MAX_REGISTERS) X plist[n_plist++] = current_coord; X else X yyerror("Location list too long!"); X } Xbreak; Xcase 122: X{ X tmpmonst[nmons] = New(monster); X tmpmonst[nmons]->x = current_coord.x; X tmpmonst[nmons]->y = current_coord.y; X tmpmonst[nmons]->class = yyvsp[-4].i; X tmpmonst[nmons]->peaceful = -1; /* no override */ X tmpmonst[nmons]->asleep = -1; X tmpmonst[nmons]->align = - MAX_REGISTERS - 2; X tmpmonst[nmons]->name = (char *) 0; X tmpmonst[nmons]->appear = 0; X tmpmonst[nmons]->appear_as = (char *) 0; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Monster"); X if (!yyvsp[-2].map) X tmpmonst[nmons]->id = -1; X else { X int token = get_monster_id(yyvsp[-2].map, (char) yyvsp[-4].i); X if (token == ERR) { X yywarning("Illegal monster name! Making random monster."); X tmpmonst[nmons]->id = -1; X } else X tmpmonst[nmons]->id = token; X } X } Xbreak; Xcase 123: X{ X nmons++; X } Xbreak; Xcase 126: X{ X tmpmonst[nmons]->name = dup_string(yyvsp[0].map); X } Xbreak; Xcase 127: X{ X tmpmonst[nmons]->peaceful = yyvsp[0].i; X } Xbreak; Xcase 128: X{ X tmpmonst[nmons]->asleep = yyvsp[0].i; X } Xbreak; Xcase 129: X{ X tmpmonst[nmons]->align = yyvsp[0].i; X } Xbreak; Xcase 130: X{ X tmpmonst[nmons]->appear = yyvsp[-1].i; X tmpmonst[nmons]->appear_as = dup_string(yyvsp[0].map); X } Xbreak; Xcase 131: X{ X tmpobj[nobj] = New(object); X tmpobj[nobj]->x = current_coord.x; X tmpobj[nobj]->y = current_coord.y; X tmpobj[nobj]->class = yyvsp[-4].i; X tmpobj[nobj]->corpsenm = -1; /* init as none */ X tmpobj[nobj]->curse_state = -1; X tmpobj[nobj]->name = (char *) 0; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Object"); X if (!yyvsp[-2].map) X tmpobj[nobj]->id = -1; X else { X int token = get_object_id(yyvsp[-2].map); X if (token == ERR) { X yywarning("Illegal object name! Making random object."); X tmpobj[nobj]->id = -1; X } else X tmpobj[nobj]->id = token; X } X } Xbreak; Xcase 132: X{ X nobj++; X } Xbreak; Xcase 133: X{ X tmpobj[nobj]->spe = -127; X } Xbreak; Xcase 134: X{ X int token = get_monster_id(yyvsp[-2].map, (char)0); X if (token == ERR) /* "random" */ X tmpobj[nobj]->corpsenm = -2; X else X tmpobj[nobj]->corpsenm = token; X tmpobj[nobj]->spe = yyvsp[0].i; X } Xbreak; Xcase 135: X{ X tmpobj[nobj]->curse_state = yyvsp[-4].i; X tmpobj[nobj]->spe = yyvsp[-2].i; X if (yyvsp[0].map) X tmpobj[nobj]->name = dup_string(yyvsp[0].map); X else X tmpobj[nobj]->name = (char *) 0; X } Xbreak; Xcase 139: X{ X yyval.i = -127; X } Xbreak; Xcase 140: X{ X tmpdoor[ndoor] = New(door); X tmpdoor[ndoor]->x = current_coord.x; X tmpdoor[ndoor]->y = current_coord.y; X tmpdoor[ndoor]->mask = yyvsp[-2].i; X if(current_coord.x >= 0 && current_coord.y >= 0 && X tmpmap[current_coord.y][current_coord.x] != DOOR && X tmpmap[current_coord.y][current_coord.x] != SDOOR) X yyerror("Door decl doesn't match the map"); X ndoor++; X } Xbreak; Xcase 141: X{ X tmptrap[ntrap] = New(trap); X tmptrap[ntrap]->x = current_coord.x; X tmptrap[ntrap]->y = current_coord.y; X tmptrap[ntrap]->type = yyvsp[-2].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Trap"); X ntrap++; X } Xbreak; Xcase 142: X{ X int x, y, dir; X X tmpdb[ndb] = New(drawbridge); X x = tmpdb[ndb]->x = current_coord.x; X y = tmpdb[ndb]->y = current_coord.y; X /* convert dir from a DIRECTION to a DB_DIR */ X dir = yyvsp[-2].i; X switch(dir) { X case W_NORTH: dir = DB_NORTH; y--; break; X case W_SOUTH: dir = DB_SOUTH; y++; break; X case W_EAST: dir = DB_EAST; x++; break; X case W_WEST: dir = DB_WEST; x--; break; X default: X yyerror("Invalid drawbridge direction"); X break; X } X tmpdb[ndb]->dir = dir; X if (current_coord.x >= 0 && current_coord.y >= 0 && X !IS_WALL(tmpmap[y][x])) { X char ebuf[60]; X Sprintf(ebuf, X "Wall needed for drawbridge (%02d, %02d)", X current_coord.x, current_coord.y); X yyerror(ebuf); X } X X if ( yyvsp[0].i == D_ISOPEN ) X tmpdb[ndb]->db_open = 1; X else if ( yyvsp[0].i == D_CLOSED ) X tmpdb[ndb]->db_open = 0; X else X yyerror("A drawbridge can only be open or closed!"); X ndb++; X } Xbreak; Xcase 143: X{ X tmpwalk[nwalk] = New(walk); X tmpwalk[nwalk]->x = current_coord.x; X tmpwalk[nwalk]->y = current_coord.y; X tmpwalk[nwalk]->dir = yyvsp[0].i; X nwalk++; X } Xbreak; Xcase 144: X{ X wallify_map(); X } Xbreak; Xcase 145: X{ X tmplad[nlad] = New(lad); X tmplad[nlad]->x = current_coord.x; X tmplad[nlad]->y = current_coord.y; X tmplad[nlad]->up = yyvsp[0].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Ladder"); X nlad++; X } Xbreak; Xcase 146: X{ X tmpstair[nstair] = New(stair); X tmpstair[nstair]->x = current_coord.x; X tmpstair[nstair]->y = current_coord.y; X tmpstair[nstair]->up = yyvsp[0].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Stairway"); X nstair++; X } Xbreak; Xcase 147: X{ X tmplreg[nlreg] = New(lev_region); X tmplreg[nlreg]->in_islev = yyvsp[0].i; X tmplreg[nlreg]->inarea.x1 = current_region.x1; X tmplreg[nlreg]->inarea.y1 = current_region.y1; X tmplreg[nlreg]->inarea.x2 = current_region.x2; X tmplreg[nlreg]->inarea.y2 = current_region.y2; X } Xbreak; Xcase 148: X{ X tmplreg[nlreg]->del_islev = yyvsp[-2].i; X tmplreg[nlreg]->delarea.x1 = current_region.x1; X tmplreg[nlreg]->delarea.y1 = current_region.y1; X tmplreg[nlreg]->delarea.x2 = current_region.x2; X tmplreg[nlreg]->delarea.y2 = current_region.y2; X if(yyvsp[0].i) X tmplreg[nlreg]->rtype = LR_UPSTAIR; X else X tmplreg[nlreg]->rtype = LR_DOWNSTAIR; X tmplreg[nlreg]->rname = 0; X nlreg++; X } Xbreak; Xcase 149: X{ X tmplreg[nlreg] = New(lev_region); X tmplreg[nlreg]->in_islev = yyvsp[0].i; X tmplreg[nlreg]->inarea.x1 = current_region.x1; X tmplreg[nlreg]->inarea.y1 = current_region.y1; X tmplreg[nlreg]->inarea.x2 = current_region.x2; X tmplreg[nlreg]->inarea.y2 = current_region.y2; X } Xbreak; Xcase 150: X{ X tmplreg[nlreg]->del_islev = yyvsp[-2].i; X tmplreg[nlreg]->delarea.x1 = current_region.x1; X tmplreg[nlreg]->delarea.y1 = current_region.y1; X tmplreg[nlreg]->delarea.x2 = current_region.x2; X tmplreg[nlreg]->delarea.y2 = current_region.y2; X tmplreg[nlreg]->rtype = LR_PORTAL; X tmplreg[nlreg]->rname = yyvsp[0].map; X nlreg++; X } Xbreak; Xcase 151: X{ X tmplreg[nlreg] = New(lev_region); X tmplreg[nlreg]->in_islev = yyvsp[0].i; X tmplreg[nlreg]->inarea.x1 = current_region.x1; X tmplreg[nlreg]->inarea.y1 = current_region.y1; X tmplreg[nlreg]->inarea.x2 = current_region.x2; X tmplreg[nlreg]->inarea.y2 = current_region.y2; X } Xbreak; Xcase 152: X{ X tmplreg[nlreg]->del_islev = yyvsp[0].i; X tmplreg[nlreg]->delarea.x1 = current_region.x1; X tmplreg[nlreg]->delarea.y1 = current_region.y1; X tmplreg[nlreg]->delarea.x2 = current_region.x2; X tmplreg[nlreg]->delarea.y2 = current_region.y2; X } Xbreak; Xcase 153: X{ X switch(yyvsp[0].i) { X case -1: tmplreg[nlreg]->rtype = LR_TELE; break; X case 0: tmplreg[nlreg]->rtype = LR_DOWNTELE; break; X case 1: tmplreg[nlreg]->rtype = LR_UPTELE; break; X } X tmplreg[nlreg]->rname = 0; X nlreg++; X } Xbreak; Xcase 154: X{ X tmplreg[nlreg] = New(lev_region); X tmplreg[nlreg]->in_islev = yyvsp[0].i; X tmplreg[nlreg]->inarea.x1 = current_region.x1; X tmplreg[nlreg]->inarea.y1 = current_region.y1; X tmplreg[nlreg]->inarea.x2 = current_region.x2; X tmplreg[nlreg]->inarea.y2 = current_region.y2; X } Xbreak; Xcase 155: X{ X tmplreg[nlreg]->del_islev = yyvsp[0].i; X tmplreg[nlreg]->delarea.x1 = current_region.x1; X tmplreg[nlreg]->delarea.y1 = current_region.y1; X tmplreg[nlreg]->delarea.x2 = current_region.x2; X tmplreg[nlreg]->delarea.y2 = current_region.y2; X tmplreg[nlreg]->rtype = LR_BRANCH; X tmplreg[nlreg]->rname = 0; X nlreg++; X } Xbreak; Xcase 156: X{ X yyval.i = -1; X } Xbreak; Xcase 157: X{ X yyval.i = yyvsp[0].i; X } Xbreak; Xcase 158: X{ X yyval.i = 0; X } Xbreak; Xcase 159: X{ X/* This series of if statements is a hack for MSC 5.1. It seems that its X tiny little brain cannot compile if these are all one big if statement. */ X if (yyvsp[-7].i <= 0 || yyvsp[-7].i >= COLNO) X yyerror("Region out of level range!"); X else if (yyvsp[-5].i < 0 || yyvsp[-5].i >= ROWNO) X yyerror("Region out of level range!"); X else if (yyvsp[-3].i <= 0 || yyvsp[-3].i >= COLNO) X yyerror("Region out of level range!"); X else if (yyvsp[-1].i < 0 || yyvsp[-1].i >= ROWNO) X yyerror("Region out of level range!"); X current_region.x1 = yyvsp[-7].i; X current_region.y1 = yyvsp[-5].i; X current_region.x2 = yyvsp[-3].i; X current_region.y2 = yyvsp[-1].i; X yyval.i = 1; X } Xbreak; Xcase 160: X{ X tmpfountain[nfountain] = New(fountain); X tmpfountain[nfountain]->x = current_coord.x; X tmpfountain[nfountain]->y = current_coord.y; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Fountain"); X nfountain++; X } Xbreak; Xcase 161: X{ X tmpsink[nsink] = New(sink); X tmpsink[nsink]->x = current_coord.x; X tmpsink[nsink]->y = current_coord.y; X nsink++; X } Xbreak; Xcase 162: X{ X tmppool[npool] = New(pool); X tmppool[npool]->x = current_coord.x; X tmppool[npool]->y = current_coord.y; X npool++; X } Xbreak; Xcase 163: X{ X tmpdig[ndig] = New(digpos); X tmpdig[ndig]->x1 = current_region.x1; X tmpdig[ndig]->y1 = current_region.y1; X tmpdig[ndig]->x2 = current_region.x2; X tmpdig[ndig]->y2 = current_region.y2; X ndig++; X } Xbreak; Xcase 164: X{ X tmppass[npass] = New(digpos); X tmppass[npass]->x1 = current_region.x1; X tmppass[npass]->y1 = current_region.y1; X tmppass[npass]->x2 = current_region.x2; X tmppass[npass]->y2 = current_region.y2; X npass++; X } Xbreak; Xcase 165: X{ X tmpreg[nreg] = New(region); X tmpreg[nreg]->x1 = current_region.x1; X tmpreg[nreg]->y1 = current_region.y1; X tmpreg[nreg]->x2 = current_region.x2; X tmpreg[nreg]->y2 = current_region.y2; X tmpreg[nreg]->rlit = yyvsp[-3].i; X tmpreg[nreg]->rtype = yyvsp[-1].i; X if(yyvsp[0].i & 1) tmpreg[nreg]->rtype += MAXRTYPE+1; X tmpreg[nreg]->rirreg = ((yyvsp[0].i & 2) != 0); X if(current_region.x1 > current_region.x2 || X current_region.y1 > current_region.y2) X yyerror("Region start > end!"); X if(tmpreg[nreg]->rtype == VAULT && X (tmpreg[nreg]->rirreg || X (tmpreg[nreg]->x2 - tmpreg[nreg]->x1 != 1) || X (tmpreg[nreg]->y2 - tmpreg[nreg]->y1 != 1))) X yyerror("Vaults must be exactly 2x2!"); X if(want_warnings && !tmpreg[nreg]->rirreg && X current_region.x1 > 0 && current_region.y1 > 0 && X current_region.x2 < max_x_map && X current_region.y2 < max_y_map) { X /* check for walls in the room */ X char ebuf[60]; X register int x, y, nrock = 0; X X for(y=current_region.y1; y<=current_region.y2; y++) X for(x=current_region.x1; X x<=current_region.x2; x++) X if(IS_ROCK(tmpmap[y][x]) || X IS_DOOR(tmpmap[y][x])) nrock++; X if(nrock) { X Sprintf(ebuf, X "Rock in room (%02d,%02d,%02d,%02d)?!", X current_region.x1, current_region.y1, X current_region.x2, current_region.y2); X yywarning(ebuf); X } X if ( X !IS_ROCK(tmpmap[current_region.y1-1][current_region.x1-1]) || X !IS_ROCK(tmpmap[current_region.y2+1][current_region.x1-1]) || X !IS_ROCK(tmpmap[current_region.y1-1][current_region.x2+1]) || X !IS_ROCK(tmpmap[current_region.y2+1][current_region.x2+1])) { X Sprintf(ebuf, X "NonRock edge in room (%02d,%02d,%02d,%02d)?!", X current_region.x1, current_region.y1, X current_region.x2, current_region.y2); X yywarning(ebuf); X } X } else if(tmpreg[nreg]->rirreg && X !IS_ROOM(tmpmap[current_region.y1][current_region.x1])) { X char ebuf[60]; X Sprintf(ebuf, X "Rock in irregular room (%02d,%02d)?!", X current_region.x1, current_region.y1); X yyerror(ebuf); X } X nreg++; X } Xbreak; Xcase 166: X{ X tmpaltar[naltar] = New(altar); X tmpaltar[naltar]->x = current_coord.x; X tmpaltar[naltar]->y = current_coord.y; X tmpaltar[naltar]->align = yyvsp[-2].i; X tmpaltar[naltar]->shrine = yyvsp[0].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Altar"); X naltar++; X } Xbreak; Xcase 167: X{ X tmpgold[ngold] = New(gold); X tmpgold[ngold]->x = current_coord.x; X tmpgold[ngold]->y = current_coord.y; X tmpgold[ngold]->amount = yyvsp[-2].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Gold"); X ngold++; X } Xbreak; Xcase 168: X{ X tmpengraving[nengraving] = New(engraving); X tmpengraving[nengraving]->x = current_coord.x; X tmpengraving[nengraving]->y = current_coord.y; X tmpengraving[nengraving]->e.text = yyvsp[0].map; X tmpengraving[nengraving]->etype = yyvsp[-2].i; X if (!in_room) X check_coord(current_coord.x, current_coord.y, X "Engraving"); X nengraving++; X } Xbreak; Xcase 170: X{ X yyval.i = - MAX_REGISTERS - 1; X } Xbreak; Xcase 173: X{ X yyval.i = - MAX_REGISTERS - 1; X } Xbreak; Xcase 176: X{ X yyval.map = (char *) 0; X } Xbreak; Xcase 178: X{ X yyval.map = (char *) 0; X } Xbreak; Xcase 179: X{ X int token = get_trap_type(yyvsp[0].map); X if (token == ERR) X yyerror("Unknown trap type!"); X yyval.i = token; X } Xbreak; Xcase 181: X{ X int token = get_room_type(yyvsp[0].map); X if (token == ERR) { X yywarning("Unknown room type! Making ordinary room..."); X yyval.i = OROOM; X } else X yyval.i = token; X } Xbreak; Xcase 183: X{ X yyval.i = 0; X } Xbreak; Xcase 184: X{ X yyval.i = yyvsp[0].i; X } Xbreak; Xcase 185: X{ X yyval.i = yyvsp[-2].i + (yyvsp[0].i << 1); X } Xbreak; Xcase 188: X{ X current_coord.x = current_coord.y = -MAX_REGISTERS-1; X } Xbreak; Xcase 195: X{ X yyval.i = - MAX_REGISTERS - 1; X } Xbreak; Xcase 198: X{ X if ( yyvsp[-1].i >= MAX_REGISTERS ) X yyerror("Register Index overflow!"); X else X current_coord.x = current_coord.y = - yyvsp[-1].i - 1; X } Xbreak; Xcase 199: X{ X if ( yyvsp[-1].i >= MAX_REGISTERS ) X yyerror("Register Index overflow!"); X else X yyval.i = - yyvsp[-1].i - 1; X } Xbreak; Xcase 200: X{ X if ( yyvsp[-1].i >= MAX_REGISTERS ) X yyerror("Register Index overflow!"); X else X yyval.i = - yyvsp[-1].i - 1; X } Xbreak; Xcase 201: X{ X if ( yyvsp[-1].i >= 3 ) X yyerror("Register Index overflow!"); X else X yyval.i = - yyvsp[-1].i - 1; X } Xbreak; Xcase 203: X{ X if (check_monster_char((char) yyvsp[0].i)) X yyval.i = yyvsp[0].i ; X else { X yyerror("Unknown monster class!"); X yyval.i = ERR; X } X } Xbreak; Xcase 204: X{ X char c = yyvsp[0].i; X if (check_object_char(c)) X yyval.i = c; X else { X yyerror("Unknown char class!"); X yyval.i = ERR; X } X } Xbreak; Xcase 207: X{ X yyval.map = (char *) 0; X } Xbreak; Xcase 212: X{ X if (!in_room && !init_lev.init_present && X (yyvsp[-3].i < 0 || yyvsp[-3].i > max_x_map || X yyvsp[-1].i < 0 || yyvsp[-1].i > max_y_map)) X yyerror("Coordinates out of map range!"); X current_coord.x = yyvsp[-3].i; X current_coord.y = yyvsp[-1].i; X } Xbreak; Xcase 213: X{ X/* This series of if statements is a hack for MSC 5.1. It seems that its X tiny little brain cannot compile if these are all one big if statement. */ X if (yyvsp[-7].i < 0 || yyvsp[-7].i > max_x_map) X yyerror("Region out of map range!"); X else if (yyvsp[-5].i < 0 || yyvsp[-5].i > max_y_map) X yyerror("Region out of map range!"); X else if (yyvsp[-3].i < 0 || yyvsp[-3].i > max_x_map) X yyerror("Region out of map range!"); X else if (yyvsp[-1].i < 0 || yyvsp[-1].i > max_y_map) X yyerror("Region out of map range!"); X current_region.x1 = yyvsp[-7].i; X current_region.y1 = yyvsp[-5].i; X current_region.x2 = yyvsp[-3].i; X current_region.y2 = yyvsp[-1].i; X } Xbreak; X } X yyssp -= yym; X yystate = *yyssp; X yyvsp -= yym; X yym = yylhs[yyn]; X if (yystate == 0 && yym == 0) X { X#if YYDEBUG X if (yydebug) X printf("%sdebug: after reduction, shifting from state 0 to\ X state %d\n", YYPREFIX, YYFINAL); X#endif X yystate = YYFINAL; X *++yyssp = YYFINAL; X *++yyvsp = yyval; X if (yychar < 0) X { X if ((yychar = yylex()) < 0) yychar = 0; X#if YYDEBUG X if (yydebug) X { X yys = 0; X if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; X if (!yys) yys = "illegal-symbol"; X printf("%sdebug: state %d, reading %d (%s)\n", X YYPREFIX, YYFINAL, yychar, yys); X } X#endif X } X if (yychar == 0) goto yyaccept; X goto yyloop; X } X if ((yyn = yygindex[yym]) != 0 && (yyn += yystate) >= 0 && X yyn <= YYTABLESIZE && yycheck[yyn] == yystate) X yystate = yytable[yyn]; X else X yystate = yydgoto[yym]; X#if YYDEBUG X if (yydebug) X printf("%sdebug: after reduction, shifting from state %d \ Xto state %d\n", YYPREFIX, *yyssp, yystate); X#endif X if (yyssp >= yyss + yystacksize - 1) X { X goto yyoverflow; X } X *++yyssp = yystate; X *++yyvsp = yyval; X goto yyloop; Xyyoverflow: X yyerror("yacc stack overflow"); Xyyabort: X return (1); Xyyaccept: X return (0); X} END_OF_FILE if test 26478 -ne `wc -c <'sys/share/lev_yacc.c2'`; then echo shar: \"'sys/share/lev_yacc.c2'\" unpacked with wrong size! fi # end of 'sys/share/lev_yacc.c2' echo shar: End of archive 18 \(of 18\). cp /dev/null ark18isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 18 archives. echo "Now execute ./patchit3.sh" rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0