diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index b5d07bc75..88457c3ab 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -167,7 +167,8 @@ GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2) Particle tempPart = parts[i]; tempPart.x -= fullX; tempPart.y -= fullY; - *newSave << tempPart; + if(elements[tempPart.type].Enabled) + *newSave << tempPart; } } diff --git a/src/simulation/elements/BCLN.cpp b/src/simulation/elements/BCLN.cpp index 457a9aa9c..80a5d44fd 100644 --- a/src/simulation/elements/BCLN.cpp +++ b/src/simulation/elements/BCLN.cpp @@ -57,7 +57,7 @@ int Element_BCLN::update(UPDATE_FUNC_ARGS) parts[i].vx += advection*sim->vx[y/CELL][x/CELL]; parts[i].vy += advection*sim->vy[y/CELL][x/CELL]; } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) diff --git a/src/simulation/elements/CLNE.cpp b/src/simulation/elements/CLNE.cpp index 62c67c02b..6ffe4f13c 100644 --- a/src/simulation/elements/CLNE.cpp +++ b/src/simulation/elements/CLNE.cpp @@ -49,7 +49,7 @@ Element_CLNE::Element_CLNE() //#TPT-Directive ElementHeader Element_CLNE static int update(UPDATE_FUNC_ARGS) int Element_CLNE::update(UPDATE_FUNC_ARGS) { - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) diff --git a/src/simulation/elements/CONV.cpp b/src/simulation/elements/CONV.cpp index 4ee4682fd..de31d73d0 100644 --- a/src/simulation/elements/CONV.cpp +++ b/src/simulation/elements/CONV.cpp @@ -50,7 +50,7 @@ Element_CONV::Element_CONV() int Element_CONV::update(UPDATE_FUNC_ARGS) { int r, rx, ry; - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) @@ -72,7 +72,7 @@ int Element_CONV::update(UPDATE_FUNC_ARGS) } } } - else if(parts[i].ctype>0 && parts[i].ctype0 && parts[i].ctypeelements[parts[i].ctype]->Enabled && parts[i].ctype!=PT_CONV) { for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx340) { n = 340; } - if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM) + if (x<0 || y<0 || x>=XRES || y>=YRES || t<0 || t>=PT_NUM || !sim->elements[t].Enabled) return -1; for (c=0; c=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx0 && parts[i].ctype0 && parts[i].ctypeelements[parts[i].ctype].Enabled && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { diff --git a/src/simulation/elements/PCLN.cpp b/src/simulation/elements/PCLN.cpp index 1b814b092..7e6b3d744 100644 --- a/src/simulation/elements/PCLN.cpp +++ b/src/simulation/elements/PCLN.cpp @@ -74,7 +74,7 @@ int Element_PCLN::update(UPDATE_FUNC_ARGS) parts[i].life = 10; } } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx>8].ctype; } } - if (parts[i].ctype>0 && parts[i].ctype0 && parts[i].ctypeelements[parts[i].ctype].Enabled && parts[i].life==10) { if (parts[i].ctype==PT_PHOT) {//create photons a different way for (rx=-1; rx<2; rx++) { diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index aa2efeb2d..4cccdbb66 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -56,7 +56,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS) { if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD||ct==PT_INWR) parts[i].temp = R_TEMP + 273.15f; - if (ct<=0 || ct>=PT_NUM) + if (ct<=0 || ct>=PT_NUM || !sim->elements[parts[i].ctype].Enabled) ct = PT_METL; sim->part_change_type(i,x,y,ct); parts[i].ctype = PT_NONE; diff --git a/src/simulation/elements/STKM.cpp b/src/simulation/elements/STKM.cpp index ee351051e..1dd3347a2 100644 --- a/src/simulation/elements/STKM.cpp +++ b/src/simulation/elements/STKM.cpp @@ -85,7 +85,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) { float gvx, gvy; float gx, gy, dl, dr; - if ((parts[i].ctype>0 && parts[i].ctypeelements[parts[i].ctype].Falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT || parts[i].ctype == PT_LIGH) + if ((parts[i].ctype>0 && parts[i].ctypeelements[parts[i].ctype].Enabled && sim->elements[parts[i].ctype].Falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT || parts[i].ctype == PT_LIGH) playerp->elem = parts[i].ctype; playerp->frames++;