summaryrefslogtreecommitdiff
path: root/src/simulation/Gravity.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-05-13 16:43:41 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-05-13 16:43:41 (GMT)
commit4032a0469b1f40f7197468f34986e365bd6e7314 (patch)
treef324519139168068628f8d6e0fc8046001c9c0a1 /src/simulation/Gravity.cpp
parenta2e91c247fab4a2cee8936d83979f4a72390f7e7 (diff)
downloadpowder-4032a0469b1f40f7197468f34986e365bd6e7314.zip
powder-4032a0469b1f40f7197468f34986e365bd6e7314.tar.gz
Click function for tools that aren't continuous. Debug helper for UI components (Ctrl+Shift D when DEBUG is defined), fix add sign window logic
Diffstat (limited to 'src/simulation/Gravity.cpp')
-rw-r--r--src/simulation/Gravity.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/simulation/Gravity.cpp b/src/simulation/Gravity.cpp
index b0372a3..356872a 100644
--- a/src/simulation/Gravity.cpp
+++ b/src/simulation/Gravity.cpp
@@ -388,15 +388,15 @@ void Gravity::update_grav(void)
for (x = 0; x < XRES / CELL; x++) {
if (x == j && y == i)//Ensure it doesn't calculate with itself
continue;
- distance = sqrt(pow(j - x, 2) + pow(i - y, 2));
+ distance = sqrt(pow(j - x, 2.0f) + pow(i - y, 2.0f));
#ifdef GRAV_DIFF
val = th_gravmap[i*(XRES/CELL)+j] - th_ogravmap[i*(XRES/CELL)+j];
#else
val = th_gravmap[i*(XRES/CELL)+j];
#endif
- th_gravx[y*(XRES/CELL)+x] += M_GRAV * val * (j - x) / pow(distance, 3);
- th_gravy[y*(XRES/CELL)+x] += M_GRAV * val * (i - y) / pow(distance, 3);
- th_gravp[y*(XRES/CELL)+x] += M_GRAV * val / pow(distance, 2);
+ th_gravx[y*(XRES/CELL)+x] += M_GRAV * val * (j - x) / pow(distance, 3.0f);
+ th_gravy[y*(XRES/CELL)+x] += M_GRAV * val * (i - y) / pow(distance, 3.0f);
+ th_gravp[y*(XRES/CELL)+x] += M_GRAV * val / pow(distance, 2.0f);
}
}
}