MCPcopy Create free account
hub / github.com/NetHack/NetHack / add_door

Function add_door

src/mklev.c:573–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void
574add_door(coordxy x, coordxy y, struct mkroom *aroom)
575{
576 struct mkroom *broom;
577 int tmp;
578 int i;
579
580 alloc_doors();
581
582 if (aroom->doorct) {
583 for (i = 0; i < aroom->doorct; i++) {
584 tmp = aroom->fdoor + i;
585 if (svd.doors[tmp].x == x && svd.doors[tmp].y == y)
586 return;
587 }
588 }
589
590 if (aroom->doorct == 0)
591 aroom->fdoor = gd.doorindex;
592
593 aroom->doorct++;
594
595 for (tmp = gd.doorindex; tmp > aroom->fdoor; tmp--)
596 svd.doors[tmp] = svd.doors[tmp - 1];
597
598 for (i = 0; i < svn.nroom; i++) {
599 broom = &svr.rooms[i];
600 if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
601 broom->fdoor++;
602 }
603 for (i = 0; i < gn.nsubroom; i++) {
604 broom = &gs.subrooms[i];
605 if (broom != aroom && broom->doorct && broom->fdoor >= aroom->fdoor)
606 broom->fdoor++;
607 }
608
609 gd.doorindex++;
610 svd.doors[aroom->fdoor].x = x;
611 svd.doors[aroom->fdoor].y = y;
612}
613
614staticfn void
615dosdoor(coordxy x, coordxy y, struct mkroom *aroom, int type)

Callers 2

dosdoorFunction · 0.85
maybe_add_doorFunction · 0.85

Calls 1

alloc_doorsFunction · 0.85

Tested by

no test coverage detected