diff options
Diffstat (limited to 'src/simulation')
| -rw-r--r-- | src/simulation/Simulation.cpp | 18 | ||||
| -rw-r--r-- | src/simulation/Simulation.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index f1bea94..3f2796a 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -4294,6 +4294,24 @@ movedone: } } +int Simulation::GetParticleType(std::string type) +{ + int i = -1; + char * txt = (char*)type.c_str(); + + // alternative names for some elements + if (strcasecmp(txt,"C4")==0) i = PT_PLEX; + else if (strcasecmp(txt,"C5")==0) i = PT_C5; + else if (strcasecmp(txt,"NONE")==0) i = PT_NONE; + for (i=1; i<PT_NUM; i++) { + if (strcasecmp(txt, elements[i].Name)==0 && strlen(elements[i].Name) && elements[i].Enabled) + { + return i; + } + } + return -1; +} + void Simulation::update_particles()//doesn't update the particles themselves, but some other things { int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index ff59a92..31a0a07 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -183,6 +183,8 @@ public: void GetGravityField(int x, int y, float particleGrav, float newtonGrav, float & pGravX, float & pGravY); + int GetParticleType(std::string type); + void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate); inline void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); |
