diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp index 6e573a521..c8d98ceeb 100644 --- a/src/simulation/Air.cpp +++ b/src/simulation/Air.cpp @@ -5,36 +5,25 @@ #include #include -/*float kernel[9]; - -float vx[YCELLS][XCELLS], ovx[YCELLS][XCELLS]; -float vy[YCELLS][XCELLS], ovy[YCELLS][XCELLS]; -float pv[YCELLS][XCELLS], opv[YCELLS][XCELLS]; -unsigned char bmap_blockair[YCELLS][XCELLS]; - -float cb_vx[YCELLS][XCELLS]; -float cb_vy[YCELLS][XCELLS]; -float cb_pv[YCELLS][XCELLS]; -float cb_hv[YCELLS][XCELLS]; - -float fvx[YCELLS][XCELLS], fvy[YCELLS][XCELLS]; - -float hv[YCELLS][XCELLS], ohv[YCELLS][XCELLS]; // For Ambient Heat */ - void Air::make_kernel(void) //used for velocity { - int i, j; float s = 0.0f; - for (j=-1; j<2; j++) - for (i=-1; i<2; i++) + for (auto j=-1; j<2; j++) + { + for (auto i=-1; i<2; i++) { kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); s += kernel[(i+1)+3*(j+1)]; } + } s = 1.0f / s; - for (j=-1; j<2; j++) - for (i=-1; i<2; i++) + for (auto j=-1; j<2; j++) + { + for (auto i=-1; i<2; i++) + { kernel[(i+1)+3*(j+1)] *= s; + } + } } void Air::Clear() @@ -51,60 +40,58 @@ void Air::ClearAirH() void Air::update_airh(void) { - int x, y, i, j; - float odh, dh, dx, dy, f, tx, ty; - for (i=0; i0 && y+j0 && x+i=2 && i=2 && j0 && y+j0 && x+i1.0f || dy*advDistanceMult>1.0f) && (tx>=2 && tx=2 && tystd::abs(dy)) { stepX = (dx<0.0f) ? 1.f : -1.f; @@ -255,7 +250,8 @@ void Air::update_air(void) } tx = float(x); ty = float(y); - for (step=0; step=2 && i<=XCELLS-3 && @@ -335,6 +331,7 @@ void Air::update_air(void) ovy[y][x] = dy; opv[y][x] = dp; } + } memcpy(vx, ovx, sizeof(vx)); memcpy(vy, ovy, sizeof(vy)); memcpy(pv, opv, sizeof(pv)); @@ -343,14 +340,15 @@ void Air::update_air(void) void Air::Invert() { - int nx, ny; - for (nx = 0; nx