summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-31 02:42:34 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-31 02:42:34 (GMT)
commitcdd7399cc1c009838970ab5dce60c5ad4c332d46 (patch)
treec0db98fec2d034f5eb949b3bdc123039be8ebe1f /src/main.c
parentf85ef31b1f9b643e04a5e4614a26dd27332ced19 (diff)
downloadpowder-cdd7399cc1c009838970ab5dce60c5ad4c332d46.zip
powder-cdd7399cc1c009838970ab5dce60c5ad4c332d46.tar.gz
Make console recognise element names
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index 5b0f124..ea3ba71 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1783,7 +1783,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].life = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1797,19 +1798,26 @@ int main(int argc, char *argv[])
{
if(strcmp(console4, "all")==0)
{
- j = atoi(console5);
- for(i=0; i<NPART; i++)
- {
- if(parts[i].type)
- parts[i].type = j;
- }
- } else
+ j = console_get_type(console5);
+ if (j<0)
+ sprintf(error, "Particle type not recognised", console2);
+ else
+ for(i=0; i<NPART; i++)
+ {
+ if(parts[i].type)
+ parts[i].type = j;
+ }
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
{
- j = atoi(console5);
- parts[i].type = j;
+ j = console_get_type(console5);
+ if (j<0)
+ sprintf(error, "Particle type not recognised", console2);
+ else
+ parts[i].type = j;
}
}
}
@@ -1823,7 +1831,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].temp = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1843,7 +1852,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].tmp = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1863,7 +1873,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].x = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1883,7 +1894,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].y = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1903,7 +1915,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].ctype = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1923,7 +1936,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].vx = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)
@@ -1943,7 +1957,8 @@ int main(int argc, char *argv[])
if(parts[i].type)
parts[i].vy = j;
}
- } else
+ }
+ else
{
i = atoi(console4);
if(parts[i].type)