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

Function shrine_pos

src/mkroom.c:576–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576staticfn coord *
577shrine_pos(int roomno)
578{
579 static coord buf;
580 int delta;
581 struct mkroom *troom = &svr.rooms[roomno - ROOMOFFSET];
582
583 /* if width and height are odd, placement will be the exact center;
584 if either or both are even, center point is a hypothetical spot
585 between map locations and placement will be adjacent to that */
586 delta = troom->hx - troom->lx;
587 buf.x = troom->lx + delta / 2;
588 if ((delta % 2) && rn2(2))
589 buf.x++;
590 delta = troom->hy - troom->ly;
591 buf.y = troom->ly + delta / 2;
592 if ((delta % 2) && rn2(2))
593 buf.y++;
594 return &buf;
595}
596
597staticfn void
598mktemple(void)

Callers 1

mktempleFunction · 0.85

Calls 1

rn2Function · 0.85

Tested by

no test coverage detected