MCPcopy Index your code
hub / github.com/NetHack/NetHack / move_update

Function move_update

src/hack.c:3587–3622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3585}
3586
3587staticfn void
3588move_update(boolean newlev)
3589{
3590 char c, *ptr1, *ptr2, *ptr3, *ptr4;
3591
3592 Strcpy(u.urooms0, u.urooms);
3593 Strcpy(u.ushops0, u.ushops);
3594 if (newlev) {
3595 (void) memset(u.urooms, '\0', sizeof u.urooms);
3596 (void) memset(u.uentered, '\0', sizeof u.uentered);
3597 (void) memset(u.ushops, '\0', sizeof u.ushops);
3598 (void) memset(u.ushops_entered, '\0', sizeof u.ushops_entered);
3599 Strcpy(u.ushops_left, u.ushops0);
3600 return;
3601 }
3602 Strcpy(u.urooms, in_rooms(u.ux, u.uy, 0));
3603
3604 for (ptr1 = u.urooms, ptr2 = u.uentered,
3605 ptr3 = u.ushops, ptr4 = u.ushops_entered; *ptr1; ptr1++) {
3606 c = *ptr1;
3607 if (!strchr(u.urooms0, c))
3608 *ptr2++ = c;
3609 if (IS_SHOP(c - ROOMOFFSET)) {
3610 *ptr3++ = c;
3611 if (!strchr(u.ushops0, c))
3612 *ptr4++ = c;
3613 }
3614 }
3615 *ptr2 = '\0', *ptr3 = '\0', *ptr4 = '\0';
3616
3617 /* filter u.ushops0 -> u.ushops_left */
3618 for (ptr1 = u.ushops0, ptr2 = u.ushops_left; *ptr1; ptr1++)
3619 if (!strchr(u.ushops, *ptr1))
3620 *ptr2++ = *ptr1;
3621 *ptr2 = '\0';
3622}
3623
3624/* possibly deliver a one-time room entry message */
3625void

Callers 1

check_special_roomFunction · 0.85

Calls 1

in_roomsFunction · 0.85

Tested by

no test coverage detected