summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-03 11:52:07 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-03 11:52:07 (GMT)
commit347c382e9964ef7954246399ab9d96df43dcbff0 (patch)
treef720da533d4b129290e29d7e4c935ace41b68c57 /src/simulation/Simulation.cpp
parenta3ebfb0ffde9c4ec9db5ace2e15968065c744cde (diff)
downloadpowder-347c382e9964ef7954246399ab9d96df43dcbff0.zip
powder-347c382e9964ef7954246399ab9d96df43dcbff0.tar.gz
Allow PROP to set types from element name, fixes issue #48
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp18
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;