version 1.38 | | version 1.39 |
---|
| | |
/* | | /* |
* static char *rcsid_pets_c = | | * static char *rcsid_pets_c = |
* "$Id: pets.c,v 1.38 2005/10/28 19:08:53 akirschbaum Exp $"; | | * "$Id: pets.c,v 1.39 2005/11/16 08:16:09 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
LOG(llevError,"Owner of the pet not on a map in memory!?\n"); | | LOG(llevError,"Owner of the pet not on a map in memory!?\n"); |
return; | | return; |
} | | } |
dir = find_free_spot(ob->arch, owner->map, | | dir = find_free_spot(ob, owner->map, |
owner->x, owner->y, 1, SIZEOFFREE); | | owner->x, owner->y, 1, SIZEOFFREE); |
| | |
if (dir==-1) { | | if (dir==-1) { |
| | |
dir = rndm(1, 8); | | dir = rndm(1, 8); |
dx = ob->x + freearr_x[dir]; | | dx = ob->x + freearr_x[dir]; |
dy = ob->y + freearr_y[dir]; | | dy = ob->y + freearr_y[dir]; |
if (get_map_flags(owner->map, NULL, dx, dy, NULL, NULL) & (P_WALL | P_OUT_OF_MAP)) | | m = ob->map; |
| | if (get_map_flags(ob->map, &m, dx, dy, &dx, &dy) & P_OUT_OF_MAP) |
| | continue; |
| | else if (OB_TYPE_MOVE_BLOCK(ob, GET_MAP_MOVE_BLOCK(m, dx, dy))) |
continue; | | continue; |
else | | else |
break; | | break; |
| | |
if(!dir) | | if(!dir) |
dir=find_free_spot(NULL,op->map,op->x,op->y,1,9); | | dir=find_free_spot(NULL,op->map,op->x,op->y,1,9); |
| | |
if ((dir==-1) || arch_blocked(at, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { | | if ((dir==-1) || ob_blocked(&at->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { |
new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); |
return 0; | | return 0; |
} | | } |
| | |
} | | } |
ndir = dir; | | ndir = dir; |
if (!ndir) | | if (!ndir) |
ndir = find_free_spot(mon->arch, op->map, op->x, op->y, 1, SIZEOFFREE); | | ndir = find_free_spot(mon, op->map, op->x, op->y, 1, SIZEOFFREE); |
if (ndir == -1 || arch_blocked(mon->arch,op->map, op->x + freearr_x[ndir], op->y+freearr_y[ndir])) { | | if (ndir == -1 || ob_blocked(mon,op->map, op->x + freearr_x[ndir], op->y+freearr_y[ndir])) { |
ndir=-1; | | ndir=-1; |
if (++tries == 5) { | | if (++tries == 5) { |
new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way."); |
| | |
} | | } |
| | |
if (!dir) | | if (!dir) |
dir = find_free_spot(summon_arch, op->map, op->x, op->y, 1, SIZEOFFREE); | | dir = find_free_spot(&summon_arch->clone, op->map, op->x, op->y, 1, SIZEOFFREE); |
| | |
if (dir > 0) { | | if (dir > 0) { |
x = op->x + freearr_x[dir]; | | x = op->x + freearr_x[dir]; |
| | |
y = 0; | | y = 0; |
} | | } |
| | |
if (dir == -1 || arch_blocked(summon_arch, op->map, x, y)){ | | if (dir == -1 || ob_blocked(&summon_arch->clone, op->map, x, y)){ |
new_draw_info(NDI_UNIQUE, 0, op, "There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0, op, "There is something in the way."); |
return 0; | | return 0; |
} | | } |
| | |
if (!tmp->nrof) SET_FLAG(tmp, FLAG_NO_DROP); | | if (!tmp->nrof) SET_FLAG(tmp, FLAG_NO_DROP); |
} | | } |
dir = absdir(dir + 1); | | dir = absdir(dir + 1); |
if (arch_blocked(summon_arch, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { | | if (ob_blocked(&summon_arch->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { |
if (i < nrof) { | | if (i < nrof) { |
new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way,"); | | new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way,"); |
new_draw_info(NDI_UNIQUE, 0,op, "No more pets for this casting."); | | new_draw_info(NDI_UNIQUE, 0,op, "No more pets for this casting."); |