| 176 |
|
static IDF_FIELD * |
| 177 |
|
get_vlist(IDF_OBJECT *param, const char *zname) |
| 178 |
|
{ |
| 179 |
< |
int i = 0; |
| 179 |
> |
const int itm_len = sizeof(IDF_FIELD)+6; |
| 180 |
> |
static char fld_buf[4*itm_len]; |
| 181 |
> |
static char *next_fbp = fld_buf; |
| 182 |
> |
int i; |
| 183 |
> |
IDF_FIELD *res; |
| 184 |
|
/* check if subsurface */ |
| 185 |
|
if (!strcmp(param->pname, SUBSURF_PNAME)) { |
| 186 |
|
if (zname != NULL) { |
| 189 |
|
if (strcmp((*(ZONE *)lep->data).zname, zname)) |
| 190 |
|
return(NULL); |
| 191 |
|
} |
| 192 |
< |
return(idf_getfield(param, SS_VERT_FLD)); |
| 192 |
> |
res = idf_getfield(param, SS_VERT_FLD); |
| 193 |
> |
} else { |
| 194 |
> |
i = 0; /* check for surface type */ |
| 195 |
> |
while (strcmp(surf_type[i].pname, param->pname)) |
| 196 |
> |
if (surf_type[++i].pname == NULL) |
| 197 |
> |
return(NULL); |
| 198 |
> |
|
| 199 |
> |
if (zname != NULL) { /* matches specified zone? */ |
| 200 |
> |
IDF_FIELD *fptr = idf_getfield(param, surf_type[i].zone_fld); |
| 201 |
> |
if (fptr == NULL || strcmp(fptr->val, zname)) |
| 202 |
> |
return(NULL); |
| 203 |
> |
} |
| 204 |
> |
res = idf_getfield(param, surf_type[i].vert_fld); |
| 205 |
|
} |
| 206 |
< |
/* check for surface type */ |
| 207 |
< |
while (strcmp(surf_type[i].pname, param->pname)) |
| 208 |
< |
if (surf_type[++i].pname == NULL) |
| 206 |
> |
if (!res->val[0]) { /* hack for missing #vert */ |
| 207 |
> |
IDF_FIELD *fptr; |
| 208 |
> |
if (next_fbp >= fld_buf+sizeof(fld_buf)) |
| 209 |
> |
next_fbp = fld_buf; |
| 210 |
> |
i = 0; /* count vertices */ |
| 211 |
> |
for (fptr = res->next; fptr != NULL; fptr = fptr->next) |
| 212 |
> |
++i; |
| 213 |
> |
if (i % 3) |
| 214 |
|
return(NULL); |
| 215 |
< |
|
| 216 |
< |
if (zname != NULL) { /* matches specified zone? */ |
| 217 |
< |
IDF_FIELD *fptr = idf_getfield(param, surf_type[i].zone_fld); |
| 218 |
< |
if (fptr == NULL || strcmp(fptr->val, zname)) |
| 219 |
< |
return(NULL); |
| 215 |
> |
fptr = res->next; |
| 216 |
> |
res = (IDF_FIELD *)next_fbp; next_fbp += itm_len; |
| 217 |
> |
res->next = fptr; |
| 218 |
> |
res->rem = ""; |
| 219 |
> |
sprintf(res->val, "%d", i/3); |
| 220 |
|
} |
| 221 |
< |
/* return field for #verts */ |
| 201 |
< |
return(idf_getfield(param, surf_type[i].vert_fld)); |
| 221 |
> |
return(res); |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
/* Get/allocate surface polygon */ |