summaryrefslogtreecommitdiff
path: root/src/simulation/elements/IRON.cpp
diff options
context:
space:
mode:
authorcracker64 <cracker642@gmail.com>2013-02-27 17:08:10 (GMT)
committer cracker64 <cracker642@gmail.com>2013-02-27 17:08:10 (GMT)
commit3d2e59415003c51c0b6dbe764003cc2012ba9ca7 (patch)
tree98bf2347be2a5ada02c4a2297b3e1c88acf72e21 /src/simulation/elements/IRON.cpp
parent27e3e1251837f5d64e835068d5f5bd5b67b95921 (diff)
downloadpowder-3d2e59415003c51c0b6dbe764003cc2012ba9ca7.zip
powder-3d2e59415003c51c0b6dbe764003cc2012ba9ca7.tar.gz
Small modifications part three.
Diffstat (limited to 'src/simulation/elements/IRON.cpp')
-rw-r--r--src/simulation/elements/IRON.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/simulation/elements/IRON.cpp b/src/simulation/elements/IRON.cpp
index 1542da9..b742b30 100644
--- a/src/simulation/elements/IRON.cpp
+++ b/src/simulation/elements/IRON.cpp
@@ -49,7 +49,7 @@ Element_IRON::Element_IRON()
//#TPT-Directive ElementHeader Element_IRON static int update(UPDATE_FUNC_ARGS)
int Element_IRON::update(UPDATE_FUNC_ARGS)
{
- int r, rx, ry;
+ int r, rx, ry, rt;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -57,12 +57,13 @@ int Element_IRON::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
- ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
- ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
- ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
- ((r&0xFF) == PT_LO2))&&
- (!(parts[i].life))
+ rt = r&0xFF;
+ if ((!(parts[i].life)) &&
+ ((rt == PT_SALT && !(rand()%47)) ||
+ (rt == PT_SLTW && !(rand()%67)) ||
+ (rt == PT_WATR && !(rand()%1200)) ||
+ (rt == PT_O2 && !(rand()%250)) ||
+ (rt == PT_LO2))
)
{
sim->part_change_type(i,x,y,PT_BMTL);
@@ -73,4 +74,4 @@ int Element_IRON::update(UPDATE_FUNC_ARGS)
}
-Element_IRON::~Element_IRON() {} \ No newline at end of file
+Element_IRON::~Element_IRON() {}