summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-06-09 18:46:41 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-06-11 12:00:42 (GMT)
commit93316a9f1d687a86558daef529d583f5ae2be992 (patch)
treeae98719e4fe31f5a06a30a54208ce85ec200b5ae /src/elements
parent7ae52660f58188a1bc9d8e69ff2711c6737c7e66 (diff)
downloadpowder-93316a9f1d687a86558daef529d583f5ae2be992.zip
powder-93316a9f1d687a86558daef529d583f5ae2be992.tar.gz
Fix a load of memory leaks
Also fix some compiler warnings (missing headers, wrong pointer type for modf, etc) and move variable declarations for Visual Studio.
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/neut.c6
-rw-r--r--src/elements/soap.c4
-rw-r--r--src/elements/stkm.c4
-rw-r--r--src/elements/stkm2.c8
4 files changed, 9 insertions, 13 deletions
diff --git a/src/elements/neut.c b/src/elements/neut.c
index 20d4618..0d12a6d 100644
--- a/src/elements/neut.c
+++ b/src/elements/neut.c
@@ -1,11 +1,7 @@
#include <element.h>
-#if defined(WIN32) && !defined(__GNUC__)
-_inline int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)
-#else
-inline int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)//testing a new deut create part
-#endif
+int create_n_parts(int n, int x, int y, float vx, float vy, float temp, int t)//testing a new deut create part
{
int i, c;
n = (n/50);
diff --git a/src/elements/soap.c b/src/elements/soap.c
index 4ed10ac..e130e35 100644
--- a/src/elements/soap.c
+++ b/src/elements/soap.c
@@ -186,13 +186,13 @@ int update_SOAP(UPDATE_FUNC_ARGS)
if ((r&0xFF) == PT_OIL)
{
+ float ax, ay;
+
parts[i].vy -= 0.1f;
parts[i].vy *= 0.5f;
parts[i].vx *= 0.5f;
- float ax, ay;
-
ax = (parts[i].vx + parts[r>>8].vx)/2;
ay = (parts[i].vy + parts[r>>8].vy)/2;
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index 8b19406..01990f6 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -86,7 +86,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
//Go left
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
- if (((int)(player[0])&0x01) == 0x01 && ((r&0xFF>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
+ if (((int)(player[0])&0x01) == 0x01 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
{
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
&& (r&0xFF) != PT_LNTG))
@@ -125,7 +125,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
//Go right
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
- if (((int)(player[0])&0x02) == 0x02 && ((r&0xFF>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
+ if (((int)(player[0])&0x02) == 0x02 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
{
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
&& (r&0xFF) != PT_LNTG))
diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c
index 32f8619..a2731a6 100644
--- a/src/elements/stkm2.c
+++ b/src/elements/stkm2.c
@@ -86,10 +86,10 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
//Go left
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
- if (((int)(player2[0])&0x01) == 0x01 && ((r&0xFF>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
+ if (((int)(player2[0])&0x01) == 0x01 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
{
- if (r>=PT_NUM || ptypes[r&0xFF].state != ST_LIQUID
- && (r&0xFF) != PT_LNTG)
+ if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
+ && (r&0xFF) != PT_LNTG))
{
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
{
@@ -125,7 +125,7 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
//Go right
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
- if (((int)(player2[0])&0x02) == 0x02 && ((r&0xFF>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
+ if (((int)(player2[0])&0x02) == 0x02 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
{
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
&& (r&0xFF) != PT_LNTG))