version 1.4 | | version 1.5 |
---|
| | |
/* | | /* |
* static char *rcsid_sock_info_c = | | * static char *rcsid_sock_info_c = |
* "$Id: info.c,v 1.4 2001/07/14 04:12:01 mwedel Exp $"; | | * "$Id: info.c,v 1.5 2001/08/08 14:40:50 avogl Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
LOG(llevError,"Non player objectg called draw_map.\n"); | | LOG(llevError,"Non player objectg called draw_map.\n"); |
return; | | return; |
} | | } |
| | |
/* First, we figure out what spaces are 'reachable' by the player */ | | /* First, we figure out what spaces are 'reachable' by the player */ |
memset(map_mark, 0, MAP_WIDTH(pl->map) * MAP_HEIGHT(pl->map)); | | memset(map_mark, 0, MAP_WIDTH(pl->map) * MAP_HEIGHT(pl->map)); |
magic_mapping_mark(pl, map_mark, 3); | | magic_mapping_mark(pl, map_mark, 3); |
| | |
} | | } |
} | | } |
} | | } |
| | |
xmin--; | | xmin--; |
xmin = xmin < 0 ? 0 : xmin; | | xmin = xmin < 0 ? 0 : xmin; |
xmax++; | | xmax++; |
| | |
ymax++; | | ymax++; |
ymax = ymax > MAP_HEIGHT(pl->map) - 1? MAP_HEIGHT(pl->map) - 1: ymax; | | ymax = ymax > MAP_HEIGHT(pl->map) - 1? MAP_HEIGHT(pl->map) - 1: ymax; |
| | |
| | |
sl.buf=malloc(MAXSOCKBUF); | | sl.buf=malloc(MAXSOCKBUF); |
sprintf((char*)sl.buf,"magicmap %d %d %d %d ", (xmax-xmin+1), (ymax-ymin+1), | | sprintf((char*)sl.buf,"magicmap %d %d %d %d ", (xmax-xmin+1), (ymax-ymin+1), |
pl->x - xmin, pl->y - ymin); | | pl->x - xmin, pl->y - ymin); |
| | |
if ((mark=map_mark[x+MAP_WIDTH(pl->map)*y])==0) | | if ((mark=map_mark[x+MAP_WIDTH(pl->map)*y])==0) |
sl.buf[sl.len++]=0; | | sl.buf[sl.len++]=0; |
else { | | else { |
| | /* get map face and assign the proper magicmap value */ |
New_Face *f = GET_MAP_FACE(pl->map, x, y, 0); | | New_Face *f = GET_MAP_FACE(pl->map, x, y, 0); |
if (mark==2) | | if (f==NULL) { |
| | /* this map spot is completely empty */ |
| | sl.buf[sl.len++]=0; |
| | } |
| | else if (mark==2) |
sl.buf[sl.len++]=f->magicmap | FACE_WALL; | | sl.buf[sl.len++]=f->magicmap | FACE_WALL; |
else | | else |
sl.buf[sl.len++]=f->magicmap; | | sl.buf[sl.len++]=f->magicmap; |
| | |
| | |
} /* x loop */ | | } /* x loop */ |
} /* y loop */ | | } /* y loop */ |
| | |
Send_With_Handling(&pl->contr->socket, &sl); | | Send_With_Handling(&pl->contr->socket, &sl); |
free(sl.buf); | | free(sl.buf); |
free(map_mark); | | free(map_mark); |