version 1.98 | | version 1.99 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.98 2006/01/07 06:33:07 qal21 Exp $"; | | * "$Id: map.c,v 1.99 2006/01/07 18:05:07 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
int on_same_map(object *op1, object *op2) | | int on_same_map(object *op1, object *op2) |
{ | | { |
| | mapstruct *tmp; |
| | |
/* If the object isn't on a map, can't be on the same map, now can it? | | /* If the object isn't on a map, can't be on the same map, now can it? |
* this check also prevents crashes below. | | * this check also prevents crashes below. |
*/ | | */ |
if (op1->map == NULL || op2->map == NULL) return FALSE; | | if (op1->map == NULL || op2->map == NULL) return FALSE; |
| | |
if (op1->map == op2->map || op1->map->tile_map[0] == op2->map || | | /* on same map? */ |
op1->map->tile_map[1] == op2->map || | | if (op1->map == op2->map) return TRUE; |
op1->map->tile_map[2] == op2->map || | | |
op1->map->tile_map[3] == op2->map) return TRUE; | | /* on adjacent map? */ |
| | if (op1->map->tile_map[0] == op2->map) return TRUE; |
| | if (op1->map->tile_map[1] == op2->map) return TRUE; |
| | if (op1->map->tile_map[2] == op2->map) return TRUE; |
| | if (op1->map->tile_map[3] == op2->map) return TRUE; |
| | |
| | /* on diagonally adjacent map? */ |
| | tmp = op1->map->tile_map[0]; |
| | if (tmp != NULL) { |
| | if (tmp->tile_map[1] == op2->map || tmp->tile_map[3] == op2->map) return TRUE; |
| | } |
| | |
| | tmp = op1->map->tile_map[1]; |
| | if (tmp != NULL) { |
| | if (tmp->tile_map[0] == op2->map || tmp->tile_map[2] == op2->map) return TRUE; |
| | } |
| | |
| | tmp = op1->map->tile_map[2]; |
| | if (tmp != NULL) { |
| | if (tmp->tile_map[1] == op2->map || tmp->tile_map[3] == op2->map) return TRUE; |
| | } |
| | |
| | tmp = op1->map->tile_map[3]; |
| | if (tmp != NULL) { |
| | if (tmp->tile_map[0] == op2->map || tmp->tile_map[2] == op2->map) return TRUE; |
| | } |
| | |
return FALSE; | | return FALSE; |
} | | } |