move_update()

Some changes I made while investigating the unpaid_code impossible.
Shouldn't produce any noticeable changes in behavior.
This commit is contained in:
PatR
2022-01-11 23:42:13 -08:00
parent 5c14f3e81d
commit 6fda779979
+18 -20
View File
@@ -2625,39 +2625,37 @@ in_town(register int x, register int y)
static void static void
move_update(register boolean newlev) move_update(register boolean newlev)
{ {
char *ptr1, *ptr2, *ptr3, *ptr4; char c, *ptr1, *ptr2, *ptr3, *ptr4;
Strcpy(u.urooms0, u.urooms); Strcpy(u.urooms0, u.urooms);
Strcpy(u.ushops0, u.ushops); Strcpy(u.ushops0, u.ushops);
if (newlev) { if (newlev) {
u.urooms[0] = '\0'; (void) memset(u.urooms, '\0', sizeof u.urooms);
u.uentered[0] = '\0'; (void) memset(u.uentered, '\0', sizeof u.uentered);
u.ushops[0] = '\0'; (void) memset(u.ushops, '\0', sizeof u.ushops);
u.ushops_entered[0] = '\0'; (void) memset(u.ushops_entered, '\0', sizeof u.ushops_entered);
Strcpy(u.ushops_left, u.ushops0); Strcpy(u.ushops_left, u.ushops0);
return; return;
} }
Strcpy(u.urooms, in_rooms(u.ux, u.uy, 0)); Strcpy(u.urooms, in_rooms(u.ux, u.uy, 0));
for (ptr1 = &u.urooms[0], ptr2 = &u.uentered[0], ptr3 = &u.ushops[0], for (ptr1 = u.urooms, ptr2 = u.uentered,
ptr4 = &u.ushops_entered[0]; ptr3 = u.ushops, ptr4 = u.ushops_entered; *ptr1; ptr1++) {
*ptr1; ptr1++) { c = *ptr1;
if (!index(u.urooms0, *ptr1)) if (!index(u.urooms0, c))
*(ptr2++) = *ptr1; *ptr2++ = c;
if (IS_SHOP(*ptr1 - ROOMOFFSET)) { if (IS_SHOP(c - ROOMOFFSET)) {
*(ptr3++) = *ptr1; *ptr3++ = c;
if (!index(u.ushops0, *ptr1)) if (!index(u.ushops0, c))
*(ptr4++) = *ptr1; *ptr4++ = c;
} }
} }
*ptr2 = '\0'; *ptr2 = '\0', *ptr3 = '\0', *ptr4 = '\0';
*ptr3 = '\0';
*ptr4 = '\0';
/* filter u.ushops0 -> u.ushops_left */ /* filter u.ushops0 -> u.ushops_left */
for (ptr1 = &u.ushops0[0], ptr2 = &u.ushops_left[0]; *ptr1; ptr1++) for (ptr1 = u.ushops0, ptr2 = u.ushops_left; *ptr1; ptr1++)
if (!index(u.ushops, *ptr1)) if (!index(u.ushops, *ptr1))
*(ptr2++) = *ptr1; *ptr2++ = *ptr1;
*ptr2 = '\0'; *ptr2 = '\0';
} }
@@ -2665,7 +2663,7 @@ move_update(register boolean newlev)
void void
check_special_room(boolean newlev) check_special_room(boolean newlev)
{ {
register struct monst *mtmp; struct monst *mtmp;
char *ptr; char *ptr;
move_update(newlev); move_update(newlev);