From: hackbard Date: Wed, 14 May 2003 17:32:50 +0000 (+0000) Subject: -----!!!! X-Git-Tag: fpb~56 X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=c71815b4b5dc67546a9ca407c256d18a4abb3aff;p=physik%2Fnlsop.git -----!!!! --- diff --git a/dfbapi.h b/dfbapi.h index 54ab56b..985d983 100644 --- a/dfbapi.h +++ b/dfbapi.h @@ -5,6 +5,9 @@ * */ +#ifndef DFBAPI_H +#define DFBAPI_H + #include /* two dimensional lattice */ @@ -56,5 +59,9 @@ int d2_lattice_draw(d2_lattice *d2_l,int x,int y,int arg_c,char **arg_v); int d3_lattice_init(int *argc,char **argv,d3_lattice *d3_l,int x,int y,int z); int d3_lattice_release(d3_lattice *d3_l); int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v); +int d2_event_init(d2_lattice *d2_l); +int d3_event_init(d3_lattice *d3_l); +int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc); int dx_lattice_get_color(unsigned char *status,unsigned char *r,unsigned char *g,unsigned char *b); +#endif /* DFBAPI_H */ diff --git a/nlsop.c b/nlsop.c index 030db9f..041fac0 100644 --- a/nlsop.c +++ b/nlsop.c @@ -79,7 +79,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int p*=*conc; if(!(*thiz&AMORPH)) { - if(rand_get(URAND_MAX)<=p) + if(get_rand(URAND_MAX)<=p) { MAKE_AMORPH(thiz); *t_c=*t_c+1-*conc; @@ -87,7 +87,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int } else { /* assume 1-p probability */ - if(rand_get(URAND_MAX)>p) + if(get_rand(URAND_MAX)>p) { MAKE_CRYST(thiz); *t_c=*t_c+1+*conc; @@ -138,13 +138,14 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) left=(int)(((i+1)*a+b)*t_c/sum)%area_h[i]; while(left) { - x=get_rand(d3_l->max_x); - y=get_rand(d3_l->max_y); - if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH)) - { - *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1; - total+=1; - left-=1; + x=get_rand(d3_l->max_x); + y=get_rand(d3_l->max_y); + if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH)) + { + *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1; + total+=1; + left-=1; + } } } left=t_c-total; @@ -381,9 +382,9 @@ int main(int argc,char **argv) { while((i #include @@ -18,3 +21,4 @@ u32 get_rand_lgp(u32 max,double a,double b); #define BUFSIZE (16*1048576) /* 64 MByte */ #define URAND_MAX 0xffffffff +#endif /* RANDOM_H */