diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-14 23:10:10 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-14 23:10:10 (GMT) |
| commit | 45563e97e813cfd21724ad1111e5de3e04679e1a (patch) | |
| tree | 28d6e7d257c8790fa4ac892cb051bd9a86f3681d /src/simulation/Simulation.cpp | |
| parent | 0b4ad4f25cf168226677f648cf4cadfdb6caa59a (diff) | |
| download | powder-45563e97e813cfd21724ad1111e5de3e04679e1a.zip powder-45563e97e813cfd21724ad1111e5de3e04679e1a.tar.gz | |
Make flood_prop use PropertyType from StructProperty, Property tool works
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index a992ef8..0032bb2 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -88,7 +88,7 @@ void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int c, int flags) CreateWalls(i, j, 0, 0, c, flags); } -int Simulation::flood_prop_2(int x, int y, size_t propoffset, void * propvalue, int proptype, int parttype, char * bitmap) +int Simulation::flood_prop_2(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype, int parttype, char * bitmap) { int x1, x2, i, dy = 1; x1 = x2 = x; @@ -111,12 +111,22 @@ int Simulation::flood_prop_2(int x, int y, size_t propoffset, void * propvalue, for (x=x1; x<=x2; x++) { i = pmap[y][x]>>8; - if(proptype==2){ - *((float*)(((char*)&parts[i])+propoffset)) = *((float*)propvalue); - } else if(proptype==0) { - *((int*)(((char*)&parts[i])+propoffset)) = *((int*)propvalue); - } else if(proptype==1) { - *((char*)(((char*)&parts[i])+propoffset)) = *((char*)propvalue); + switch (proptype) { + case StructProperty::Float: + *((float*)(((char*)&parts[i])+propoffset)) = *((float*)propvalue); + break; + + case StructProperty::ParticleType: + case StructProperty::Integer: + *((int*)(((char*)&parts[i])+propoffset)) = *((int*)propvalue); + break; + + case StructProperty::UInteger: + *((unsigned int*)(((char*)&parts[i])+propoffset)) = *((unsigned int*)propvalue); + break; + + default: + break; } bitmap[(y*XRES)+x] = 1; } @@ -133,7 +143,7 @@ int Simulation::flood_prop_2(int x, int y, size_t propoffset, void * propvalue, return 1; } -int Simulation::flood_prop(int x, int y, size_t propoffset, void * propvalue, int proptype) +int Simulation::flood_prop(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype) { int r = 0; char * bitmap = (char *)malloc(XRES*YRES); //Bitmap for checking |
