From a95ceb4c928baf4eace240852f17af6518b86f8f Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 12 Jun 2012 19:55:00 +0100 Subject: [PATCH] TPT: energy type particles automatically go into photons, not pmap --- src/simulation/Simulation.cpp | 17 +++++++++-------- src/simulation/elements/THDR.cpp | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 70fab9cf7..a195738eb 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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