--- deliantra/server/server/move.C 2008/05/06 16:55:26 1.24 +++ deliantra/server/server/move.C 2008/12/27 02:31:19 1.28 @@ -177,18 +177,18 @@ if (i == -1) return 0; /* No free spot */ - if (op->head != NULL) - op = op->head; + op = op->head_ (); op->remove (); - for (tmp = op; tmp != NULL; tmp = tmp->more) - tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->x), - tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->y); - tmp = insert_ob_in_map (op, op->map, originator, 0); - if (tmp) - return 0; - else - return 1; + for (object *tmp = op; tmp; tmp = tmp->more) + { + tmp->x = x + freearr_x[i] + (!tmp->arch ? 0 : tmp->arch->x); + tmp->y = y + freearr_y[i] + (!tmp->arch ? 0 : tmp->arch->y); + } + + op = insert_ob_in_map (op, op->map, originator, 0); + + return !op; } /* @@ -226,9 +226,11 @@ { if (i == 0 && j == 0) continue; + /* Perhaps this should be extended to support tiled maps */ if (OUT_OF_REAL_MAP (teleporter->map, teleporter->x + i, teleporter->y + j)) continue; + other_teleporter = GET_MAP_OB (teleporter->map, teleporter->x + i, teleporter->y + j); while (other_teleporter) @@ -237,7 +239,8 @@ break; other_teleporter = other_teleporter->above; } - if (other_teleporter && !(RANDOM () % ++nrofalt)) + + if (other_teleporter && !rndm (++nrofalt)) altern = other_teleporter; } @@ -286,13 +289,14 @@ user->remove (); /* Update location for the object */ - for (tmp = user; tmp != NULL; tmp = tmp->more) + for (tmp = user; tmp; tmp = tmp->more) { - tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->x); - tmp->y = other_teleporter->y + freearr_y[k] + (tmp->arch == NULL ? 0 : tmp->arch->y); + tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch ? tmp->arch->x : 0); + tmp->y = other_teleporter->y + freearr_y[k] + (tmp->arch ? tmp->arch->y : 0); } + tmp = insert_ob_in_map (user, other_teleporter->map, NULL, 0); - return (tmp == NULL); + return !tmp; } void @@ -375,7 +379,9 @@ x = op->x + freearr_x[dir]; y = op->y + freearr_y[dir]; - if (!QUERY_FLAG (op, FLAG_CAN_ROLL) || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) > pusher->stats.Str)) + if (!QUERY_FLAG (op, FLAG_CAN_ROLL) + || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) + > pusher->stats.Str)) return 0; m = op->map;