diff options
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 18 |
1 files changed, 18 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; |
