TPT: energy type particles automatically go into photons, not pmap

This commit is contained in:
Simon Robertshaw 2012-06-12 19:55:00 +01:00
parent 3b020b3151
commit a95ceb4c92
2 changed files with 11 additions and 10 deletions

View File

@ -1810,6 +1810,7 @@ void Simulation::init_can_move()
//whol eats anar
can_move[PT_ANAR][PT_WHOL] = 1;
can_move[PT_ANAR][PT_NWHL] = 1;
can_move[PT_THDR][PT_THDR] = 2;
}
/*
@ -1891,7 +1892,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if (!e) //if no movement
{
if (parts[i].type!=PT_NEUT && parts[i].type!=PT_PHOT && parts[i].type!=PT_ELEC)
if (!(elements[parts[i].type].Properties & TYPE_ENERGY))
return 0;
if (!legacy_enable && parts[i].type==PT_PHOT && r)//PHOT heat conduction
{
@ -1905,7 +1906,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if (!parts[r>>8].ctype)
parts[r>>8].ctype = parts[i].type;
}
if ((r&0xFF)==PT_PRTI && (parts[i].type==PT_PHOT || parts[i].type==PT_NEUT || parts[i].type==PT_ELEC))
if ((r&0xFF)==PT_PRTI && (elements[parts[i].type].Properties & TYPE_ENERGY))
{
int nnx, count;
for (count=0; count<8; count++)
@ -2059,7 +2060,7 @@ int Simulation::do_move(int i, int x, int y, float nxf, float nyf)
kill_part(i);
return -1;
}
if (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)
if (elements[t].Properties & TYPE_ENERGY)
photons[ny][nx] = t|(i<<8);
else if (t)
pmap[ny][nx] = t|(i<<8);
@ -2329,7 +2330,7 @@ void Simulation::part_change_type(int i, int x, int y, int t)//changes the type
}
parts[i].type = t;
if (t==PT_PHOT || t==PT_NEUT || t==PT_ELEC)
if (elements[t].Properties & TYPE_ENERGY)
{
photons[y][x] = t|(i<<8);
if ((pmap[y][x]>>8)==i)
@ -2490,7 +2491,7 @@ int Simulation::create_part(int p, int x, int y, int tv)//the function for creat
}
return -1;
}
if (photons[y][x] && (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC))
if (photons[y][x] && (elements[t].Properties & TYPE_ENERGY))
return -1;
if (pfree == -1)
return -1;
@ -2741,7 +2742,7 @@ int Simulation::create_part(int p, int x, int y, int tv)//the function for creat
if (t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)
parts[i].ctype = 0x47FFFF;
//and finally set the pmap/photon maps to the newly created particle
if (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)
if (elements[t].Properties & TYPE_ENERGY)
photons[y][x] = t|(i<<8);
else if (t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH)
pmap[y][x] = t|(i<<8);
@ -3644,7 +3645,7 @@ killed:
stagnant = parts[i].flags & FLAG_STAGNANT;
parts[i].flags &= ~FLAG_STAGNANT;
if ((t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)) {
if (elements[t].Properties & TYPE_ENERGY) {
if (t == PT_PHOT) {
if (parts[i].flags&FLAG_SKIPMOVE)
{
@ -4060,7 +4061,7 @@ void Simulation::update_particles()//doesn't update the particles themselves, bu
y = (int)(parts[i].y+0.5f);
if (x>=0 && y>=0 && x<XRES && y<YRES)
{
if (t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)
if (elements[t].Properties & TYPE_ENERGY)
photons[y][x] = t|(i<<8);
else
pmap[y][x] = t|(i<<8);

View File

@ -31,7 +31,7 @@ Element_THDR::Element_THDR()
Description = "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.";
State = ST_NONE;
Properties = TYPE_ENERGY;
Properties = TYPE_PART;
LowPressure = IPL;
LowPressureTransition = NT;
@ -99,4 +99,4 @@ int Element_THDR::graphics(GRAPHICS_FUNC_ARGS)
}
Element_THDR::~Element_THDR() {}
Element_THDR::~Element_THDR() {}