1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include "cp_types.h"
#include "cp_proto.h"
/* Several technical routines to set various details of face structure */
int set_face_next(struct p_data *p,char *datastr)
/* set's "next_face" index of faces */
{
char next[256];
int f1,f2;
char *nextptr;
nextptr=datastr;
while (grab_next(&nextptr,next) && sscanf(next,"%d",&f1)==1
&& f1>=0 && f1<=p->facecount
&& grab_next(&nextptr,next) && sscanf(next,"%d",&f2)==1
&& f2>0 && f2<=p->facecount)
{
if (f1==0) p->first_face=f2;
else p->faces[f1].next_face=f2;
}
return 1;
} /* set_face_next */
int set_face_index(struct p_data *p,char *datastr)
/* set "index_flag" of faces */
{
char next[256];
int fn,ind;
char *nextptr;
nextptr=datastr;
while (grab_next(&nextptr,next) && sscanf(next,"%d",&fn)==1
&& fn>0 && fn<=p->facecount
&& grab_next(&nextptr,next) && sscanf(next,"%d",&ind)==1
&& ind >=0 && ind <3)
p->faces[fn].index_flag=ind;
return 1;
} /* set_face_index */
int set_face_red(struct p_data *p,char *datastr)
/* set "rwb_flag" of faces */
{
char next[256];
int fn,ind;
char *nextptr;
nextptr=datastr;
while (grab_next(&nextptr,next) && sscanf(next,"%d",&fn)==1
&& fn>0 && fn<=p->facecount
&& grab_next(&nextptr,next) && sscanf(next,"%d",&ind)==1
&& p->rwb_flags)
p->rwb_flags[fn]=ind;
return 1;
} /* set_face_red */
int set_face_rnext(struct p_data *p,char *datastr)
/* set's "next_face" index of faces */
{
char next[256];
int f1,f2;
char *nextptr;
nextptr=datastr;
while (grab_next(&nextptr,next) && sscanf(next,"%d",&f1)==1
&& f1>=0 && f1<=p->facecount
&& grab_next(&nextptr,next) && sscanf(next,"%d",&f2)==1
&& f2>0 && f2<=p->facecount)
p->faces[f1].next_red=f2;
return 1;
} /* set_face_rnext */
|