1
- /* NetHack 3.6 dig.c $NHDT-Date: 1542765354 2018/11/21 01:55:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.115 $ */
1
+ /* NetHack 3.6 dig.c $NHDT-Date: 1544442710 2018/12/10 11:51:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.116 $ */
2
2
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3
3
/*-Copyright (c) Michael Allison, 2012. */
4
4
/* NetHack may be freely redistributed. See license for details. */
@@ -81,7 +81,7 @@ boolean waslit, rockit;
81
81
lev -> horizontal = FALSE;
82
82
/* short-circuit vision recalc */
83
83
viz_array [y ][x ] = (dist < 3 ) ? (IN_SIGHT | COULD_SEE ) : COULD_SEE ;
84
- lev -> typ = (rockit ? STONE : ROOM );
84
+ lev -> typ = (rockit ? STONE : ROOM ); /* flags set via doormask above */
85
85
if (dist >= 3 )
86
86
impossible ("mkcavepos called with dist %d" , dist );
87
87
feel_newsym (x , y );
@@ -129,7 +129,7 @@ register boolean rockit;
129
129
}
130
130
131
131
if (!rockit && levl [u .ux ][u .uy ].typ == CORR ) {
132
- levl [u .ux ][u .uy ].typ = ROOM ;
132
+ levl [u .ux ][u .uy ].typ = ROOM ; /* flags for CORR already 0 */
133
133
if (waslit )
134
134
levl [u .ux ][u .uy ].waslit = TRUE;
135
135
newsym (u .ux , u .uy ); /* in case player is invisible */
@@ -361,9 +361,9 @@ dig(VOID_ARGS)
361
361
}
362
362
363
363
if (context .digging .effort > 100 ) {
364
- register const char * digtxt , * dmgtxt = (const char * ) 0 ;
365
- register struct obj * obj ;
366
- register boolean shopedge = * in_rooms (dpx , dpy , SHOPBASE );
364
+ const char * digtxt , * dmgtxt = (const char * ) 0 ;
365
+ struct obj * obj ;
366
+ boolean shopedge = * in_rooms (dpx , dpy , SHOPBASE );
367
367
368
368
if ((obj = sobj_at (STATUE , dpx , dpy )) != 0 ) {
369
369
if (break_statue (obj ))
@@ -397,25 +397,24 @@ dig(VOID_ARGS)
397
397
}
398
398
if (IS_TREE (lev -> typ )) {
399
399
digtxt = "You cut down the tree." ;
400
- lev -> typ = ROOM ;
400
+ lev -> typ = ROOM , lev -> flags = 0 ;
401
401
if (!rn2 (5 ))
402
402
(void ) rnd_treefruit_at (dpx , dpy );
403
403
} else {
404
404
digtxt = "You succeed in cutting away some rock." ;
405
- lev -> typ = CORR ;
405
+ lev -> typ = CORR , lev -> flags = 0 ;
406
406
}
407
407
} else if (IS_WALL (lev -> typ )) {
408
408
if (shopedge ) {
409
409
add_damage (dpx , dpy , SHOP_WALL_DMG );
410
410
dmgtxt = "damage" ;
411
411
}
412
412
if (level .flags .is_maze_lev ) {
413
- lev -> typ = ROOM ;
413
+ lev -> typ = ROOM , lev -> flags = 0 ;
414
414
} else if (level .flags .is_cavernous_lev && !in_town (dpx , dpy )) {
415
- lev -> typ = CORR ;
415
+ lev -> typ = CORR , lev -> flags = 0 ;
416
416
} else {
417
- lev -> typ = DOOR ;
418
- lev -> doormask = D_NODOOR ;
417
+ lev -> typ = DOOR , lev -> doormask = D_NODOOR ;
419
418
}
420
419
digtxt = "You make an opening in the wall." ;
421
420
} else if (lev -> typ == SDOOR ) {
@@ -573,6 +572,7 @@ int ttyp;
573
572
} else if (lev -> typ == DRAWBRIDGE_DOWN
574
573
|| (is_drawbridge_wall (x , y ) >= 0 )) {
575
574
int bx = x , by = y ;
575
+
576
576
/* if under the portcullis, the bridge is adjacent */
577
577
(void ) find_drawbridge (& bx , & by );
578
578
destroy_drawbridge (bx , by );
@@ -853,6 +853,7 @@ coord *cc;
853
853
} else {
854
854
typ = fillholetyp (dig_x , dig_y , FALSE);
855
855
856
+ lev -> flags = 0 ;
856
857
if (typ != ROOM ) {
857
858
lev -> typ = typ ;
858
859
liquid_flow (dig_x , dig_y , typ , ttmp ,
@@ -935,7 +936,7 @@ coord *cc;
935
936
pline_The ("grave seems unused. Strange...." );
936
937
break ;
937
938
}
938
- levl [dig_x ][dig_y ].typ = ROOM ;
939
+ levl [dig_x ][dig_y ].typ = ROOM , levl [ dig_x ][ dig_y ]. flags = 0 ;
939
940
del_engr_at (dig_x , dig_y );
940
941
newsym (dig_x , dig_y );
941
942
return ;
@@ -1272,7 +1273,7 @@ register struct monst *mtmp;
1272
1273
newsym (mtmp -> mx , mtmp -> my );
1273
1274
return FALSE;
1274
1275
} else if (here -> typ == SCORR ) {
1275
- here -> typ = CORR ;
1276
+ here -> typ = CORR , here -> flags = 0 ;
1276
1277
unblock_point (mtmp -> mx , mtmp -> my );
1277
1278
newsym (mtmp -> mx , mtmp -> my );
1278
1279
draft_message (FALSE); /* "You feel a draft." */
@@ -1297,20 +1298,19 @@ register struct monst *mtmp;
1297
1298
if (* in_rooms (mtmp -> mx , mtmp -> my , SHOPBASE ))
1298
1299
add_damage (mtmp -> mx , mtmp -> my , 0L );
1299
1300
if (level .flags .is_maze_lev ) {
1300
- here -> typ = ROOM ;
1301
+ here -> typ = ROOM , here -> flags = 0 ;
1301
1302
} else if (level .flags .is_cavernous_lev
1302
1303
&& !in_town (mtmp -> mx , mtmp -> my )) {
1303
- here -> typ = CORR ;
1304
+ here -> typ = CORR , here -> flags = 0 ;
1304
1305
} else {
1305
- here -> typ = DOOR ;
1306
- here -> doormask = D_NODOOR ;
1306
+ here -> typ = DOOR , here -> doormask = D_NODOOR ;
1307
1307
}
1308
1308
} else if (IS_TREE (here -> typ )) {
1309
- here -> typ = ROOM ;
1309
+ here -> typ = ROOM , here -> flags = 0 ;
1310
1310
if (pile && pile < 5 )
1311
1311
(void ) rnd_treefruit_at (mtmp -> mx , mtmp -> my );
1312
1312
} else {
1313
- here -> typ = CORR ;
1313
+ here -> typ = CORR , here -> flags = 0 ;
1314
1314
if (pile && pile < 5 )
1315
1315
(void ) mksobj_at ((pile == 1 ) ? BOULDER : ROCK , mtmp -> mx , mtmp -> my ,
1316
1316
TRUE, FALSE);
@@ -1495,7 +1495,7 @@ zap_dig()
1495
1495
shopdoor = TRUE;
1496
1496
}
1497
1497
if (room -> typ == SDOOR )
1498
- room -> typ = DOOR ;
1498
+ room -> typ = DOOR ; /* doormask set below */
1499
1499
else if (cansee (zx , zy ))
1500
1500
pline_The ("door is razed!" );
1501
1501
watch_dig ((struct monst * ) 0 , zx , zy , TRUE);
@@ -1511,21 +1511,21 @@ zap_dig()
1511
1511
add_damage (zx , zy , SHOP_WALL_COST );
1512
1512
shopwall = TRUE;
1513
1513
}
1514
- room -> typ = ROOM ;
1514
+ room -> typ = ROOM , room -> flags = 0 ;
1515
1515
unblock_point (zx , zy ); /* vision */
1516
1516
} else if (!Blind )
1517
1517
pline_The ("wall glows then fades." );
1518
1518
break ;
1519
1519
} else if (IS_TREE (room -> typ )) { /* check trees before stone */
1520
1520
if (!(room -> wall_info & W_NONDIGGABLE )) {
1521
- room -> typ = ROOM ;
1521
+ room -> typ = ROOM , room -> flags = 0 ;
1522
1522
unblock_point (zx , zy ); /* vision */
1523
1523
} else if (!Blind )
1524
1524
pline_The ("tree shudders but is unharmed." );
1525
1525
break ;
1526
1526
} else if (room -> typ == STONE || room -> typ == SCORR ) {
1527
1527
if (!(room -> wall_info & W_NONDIGGABLE )) {
1528
- room -> typ = CORR ;
1528
+ room -> typ = CORR , room -> flags = 0 ;
1529
1529
unblock_point (zx , zy ); /* vision */
1530
1530
} else if (!Blind )
1531
1531
pline_The ("rock glows then fades." );
@@ -1541,17 +1541,16 @@ zap_dig()
1541
1541
}
1542
1542
watch_dig ((struct monst * ) 0 , zx , zy , TRUE);
1543
1543
if (level .flags .is_cavernous_lev && !in_town (zx , zy )) {
1544
- room -> typ = CORR ;
1544
+ room -> typ = CORR , room -> flags = 0 ;
1545
1545
} else {
1546
- room -> typ = DOOR ;
1547
- room -> doormask = D_NODOOR ;
1546
+ room -> typ = DOOR , room -> doormask = D_NODOOR ;
1548
1547
}
1549
1548
digdepth -= 2 ;
1550
1549
} else if (IS_TREE (room -> typ )) {
1551
- room -> typ = ROOM ;
1550
+ room -> typ = ROOM , room -> flags = 0 ;
1552
1551
digdepth -= 2 ;
1553
1552
} else { /* IS_ROCK but not IS_WALL or SDOOR */
1554
- room -> typ = CORR ;
1553
+ room -> typ = CORR , room -> flags = 0 ;
1555
1554
digdepth -- ;
1556
1555
}
1557
1556
unblock_point (zx , zy ); /* vision */
@@ -1563,8 +1562,10 @@ zap_dig()
1563
1562
1564
1563
if (pitflow && isok (flow_x , flow_y )) {
1565
1564
struct trap * ttmp = t_at (flow_x , flow_y );
1565
+
1566
1566
if (ttmp && is_pit (ttmp -> ttyp )) {
1567
1567
schar filltyp = fillholetyp (ttmp -> tx , ttmp -> ty , TRUE);
1568
+
1568
1569
if (filltyp != ROOM )
1569
1570
pit_flow (ttmp , filltyp );
1570
1571
}
@@ -1589,15 +1590,15 @@ char *msg;
1589
1590
int ltyp ;
1590
1591
struct rm * room ;
1591
1592
const char * foundation_msg =
1592
- "The foundation is too hard to dig through from this angle." ;
1593
+ "The foundation is too hard to dig through from this angle." ;
1593
1594
1594
1595
if (!cc )
1595
1596
return FALSE;
1596
1597
if (!isok (cc -> x , cc -> y ))
1597
1598
return FALSE;
1598
1599
* msg = '\0' ;
1599
1600
room = & levl [cc -> x ][cc -> y ];
1600
- ltyp = room -> typ ;
1601
+ ltyp = room -> typ , room -> flags = 0 ;
1601
1602
1602
1603
if (is_pool (cc -> x , cc -> y ) || is_lava (cc -> x , cc -> y )) {
1603
1604
/* this is handled by the caller after we return FALSE */
@@ -1677,15 +1678,14 @@ pit_flow(trap, filltyp)
1677
1678
struct trap * trap ;
1678
1679
schar filltyp ;
1679
1680
{
1680
- if (trap && (filltyp != ROOM )
1681
- && is_pit (trap -> ttyp )) {
1681
+ if (trap && filltyp != ROOM && is_pit (trap -> ttyp )) {
1682
1682
struct trap t ;
1683
1683
int idx ;
1684
1684
1685
1685
t = * trap ;
1686
- levl [trap -> tx ][trap -> ty ].typ = filltyp ;
1687
- liquid_flow (trap -> tx , trap -> ty , filltyp , trap ,
1688
- (trap -> tx == u .ux && trap -> ty == u .uy )
1686
+ levl [t . tx ][t . ty ].typ = filltyp , levl [ t . tx ][ t . ty ]. flags = 0 ;
1687
+ liquid_flow (t . tx , t . ty , filltyp , trap ,
1688
+ (t . tx == u .ux && t . ty == u .uy )
1689
1689
? "Suddenly %s flows in from the adjacent pit!"
1690
1690
: (char * ) 0 );
1691
1691
for (idx = 0 ; idx < 8 ; ++ idx ) {
0 commit comments