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

Function add_level

src/dungeon.c:544–563  ·  view source on GitHub ↗

* Add new level to special level chain. Insert it in level order with the * other levels in this dungeon. This assumes that we are never given a * level that has a dungeon number less than the dungeon number of the * last entry. */

Source from the content-addressed store, hash-verified

542 * last entry.
543 */
544staticfn void
545add_level(s_level *new_lev)
546{
547 s_level *prev, *curr;
548
549 prev = (s_level *) 0;
550 for (curr = svs.sp_levchn; curr; curr = curr->next) {
551 if (curr->dlevel.dnum == new_lev->dlevel.dnum
552 && curr->dlevel.dlevel > new_lev->dlevel.dlevel)
553 break;
554 prev = curr;
555 }
556 if (!prev) {
557 new_lev->next = svs.sp_levchn;
558 svs.sp_levchn = new_lev;
559 } else {
560 new_lev->next = curr;
561 prev->next = new_lev;
562 }
563}
564
565staticfn void
566init_level(int dgn, int proto_index, struct proto_dungeon *pd)

Callers 1

init_dungeonsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected