flood delete will delete walls even if wall delete tool isn't selected

This commit is contained in:
jacob1 2013-07-18 18:30:24 -04:00
parent 6a4cc7e1f7
commit 40285e107a
2 changed files with 19 additions and 15 deletions

View File

@ -1471,8 +1471,10 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break; break;
case SDLK_INSERT: case SDLK_INSERT:
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE); c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE);
break;
case SDLK_DELETE: case SDLK_DELETE:
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE); c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE);
break;
} }
if (shift && showDebug && key == '1') if (shift && showDebug && key == '1')

View File

@ -1434,13 +1434,15 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
//if initial flood point is out of bounds, do nothing //if initial flood point is out of bounds, do nothing
if (c != 0 && (x < CELL || x >= XRES-CELL || y < CELL || y >= YRES-CELL)) if (c != 0 && (x < CELL || x >= XRES-CELL || y < CELL || y >= YRES-CELL))
return 1; return 1;
else if (x < 0 || x >= XRES || y < 0 || y >= YRES)
return 1;
if (c==0) if (c==0)
{ {
cm = pmap[y][x]&0xFF; cm = pmap[y][x]&0xFF;
if (!cm) if (!cm)
cm = photons[y][x]&0xFF; cm = photons[y][x]&0xFF;
if (!cm) if (!cm && bmap[y/CELL][x/CELL])
return 0; FloodWalls(x, y, WL_ERASE, -1, flags);
} }
else else
cm = 0; cm = 0;
@ -3526,11 +3528,11 @@ void Simulation::update_particles_i(int start, int inc)
create_part(-1, parts[i].x, parts[i].y, PT_STKM2); create_part(-1, parts[i].x, parts[i].y, PT_STKM2);
} }
//the main particle loop function, goes over all particles. //the main particle loop function, goes over all particles.
for (i=0; i<=parts_lastActiveIndex; i++) for (i=0; i<=parts_lastActiveIndex; i++)
if (parts[i].type) if (parts[i].type)
{ {
t = parts[i].type; t = parts[i].type;
x = (int)(parts[i].x+0.5f); x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f); y = (int)(parts[i].y+0.5f);
@ -3664,7 +3666,7 @@ void Simulation::update_particles_i(int start, int inc)
if (!legacy_enable) if (!legacy_enable)
{ {
if (y-2 >= 0 && y-2 < YRES && (elements[t].Properties&TYPE_LIQUID) && (t!=PT_GEL || gel_scale>(1+rand()%255))) {//some heat convection for liquids if (y-2 >= 0 && y-2 < YRES && (elements[t].Properties&TYPE_LIQUID) && (t!=PT_GEL || gel_scale>(1+rand()%255))) {//some heat convection for liquids
r = pmap[y-2][x]; r = pmap[y-2][x];
if (!(!r || parts[i].type != (r&0xFF))) { if (!(!r || parts[i].type != (r&0xFF))) {
if (parts[i].temp>parts[r>>8].temp) { if (parts[i].temp>parts[r>>8].temp) {
@ -3802,14 +3804,14 @@ void Simulation::update_particles_i(int start, int inc)
if (platent[t] <= (c_heat - (elements[parts[i].ctype].LowTemperature - dbt)*c_Cm)) if (platent[t] <= (c_heat - (elements[parts[i].ctype].LowTemperature - dbt)*c_Cm))
{ {
pt = (c_heat - platent[t])/c_Cm; pt = (c_heat - platent[t])/c_Cm;
t = parts[i].ctype; t = parts[i].ctype;
parts[i].ctype = PT_NONE; parts[i].ctype = PT_NONE;
parts[i].life = 0; parts[i].life = 0;
} }
else else
{ {
parts[i].temp = restrict_flt(elements[parts[i].ctype].LowTemperature - dbt, MIN_TEMP, MAX_TEMP); parts[i].temp = restrict_flt(elements[parts[i].ctype].LowTemperature - dbt, MIN_TEMP, MAX_TEMP);
s = 0; s = 0;
} }
#else #else
t = parts[i].ctype; t = parts[i].ctype;
@ -4202,10 +4204,10 @@ killed:
photons[ny][nx] = t|(i<<8); photons[ny][nx] = t|(i<<8);
else if (t) else if (t)
pmap[ny][nx] = t|(i<<8); pmap[ny][nx] = t|(i<<8);
}
} }
else if (elements[t].Properties & TYPE_ENERGY) }
{ else if (elements[t].Properties & TYPE_ENERGY)
{
if (t == PT_PHOT) { if (t == PT_PHOT) {
if (parts[i].flags&FLAG_SKIPMOVE) if (parts[i].flags&FLAG_SKIPMOVE)
{ {