summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-09 21:12:25 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-09 21:12:25 (GMT)
commit88d107f18a9c6d37493a953142a503d963ec37b1 (patch)
treeb2a90a8127c977534cbd258a7d9e985ee23f9d40
parent6094753eb18fd315acd0eaecaaf19ecf609acfbe (diff)
downloadpowder-88d107f18a9c6d37493a953142a503d963ec37b1.zip
powder-88d107f18a9c6d37493a953142a503d963ec37b1.tar.gz
Better channel handling
-rw-r--r--includes/powder.h6
-rw-r--r--src/elements/prti.c6
-rw-r--r--src/elements/prto.c6
-rw-r--r--src/elements/wifi.c6
-rw-r--r--src/powder.c2
5 files changed, 10 insertions, 16 deletions
diff --git a/includes/powder.h b/includes/powder.h
index 66816b0..d6862da 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -891,9 +891,9 @@ static int lolzrule[9][9] =
{0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
};
-int portal[MAX_TEMP/100][8][80];
-float portaltemp[MAX_TEMP/100][8][80];
-int wireless[MAX_TEMP/100][2];
+int portal[(int)(MAX_TEMP-73.15f)/100+2][8][80];
+float portaltemp[(int)(MAX_TEMP-73.15f)/100+2][8][80];
+int wireless[(int)(MAX_TEMP-73.15f)/100+2][2];
extern int isplayer;
extern float player[27];
diff --git a/src/elements/prti.c b/src/elements/prti.c
index 33b449f..ff9f459 100644
--- a/src/elements/prti.c
+++ b/src/elements/prti.c
@@ -1,11 +1,9 @@
#include <powder.h>
int update_PRTI(UPDATE_FUNC_ARGS) {
- int r, temp, nnx, temprange = 100;
+ int r, nnx;
int count =0;
- for ( temp = 0; temp < MAX_TEMP; temp += temprange)
- if (parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
- parts[i].tmp = temp/100;
+ parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (ny=-1; ny<2; ny++)
for (nx=-1; nx<2; nx++)
if (x+nx>=0 && y+ny>0 &&
diff --git a/src/elements/prto.c b/src/elements/prto.c
index f7f97fc..acaa689 100644
--- a/src/elements/prto.c
+++ b/src/elements/prto.c
@@ -1,11 +1,9 @@
#include <powder.h>
int update_PRTO(UPDATE_FUNC_ARGS) {
- int r, temp, nnx, temprange = 100;
+ int r, nnx;
int count = 0;
- for ( temp = 0; temp < MAX_TEMP; temp += temprange)
- if (parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
- parts[i].tmp = temp/100;
+ parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
for (ny=1; ny>-2; ny--)
for (nx=1; nx>-2; nx--)
if (x+nx>=0 && y+ny>0 &&
diff --git a/src/elements/wifi.c b/src/elements/wifi.c
index fb1a522e..6584a00 100644
--- a/src/elements/wifi.c
+++ b/src/elements/wifi.c
@@ -1,10 +1,8 @@
#include <powder.h>
int update_WIFI(UPDATE_FUNC_ARGS) {
- int r, rx, ry, temp, temprange = 100;
- for ( temp = 0; temp < MAX_TEMP; temp += temprange)
- if (parts[i].temp-73.15>temp&&parts[i].temp-73.15 <temp+temprange)
- parts[i].tmp = temp/100;
+ int r, rx, ry;
+ parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
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))
diff --git a/src/powder.c b/src/powder.c
index bcdd924..64e29b4 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1301,7 +1301,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if (ISWIRE==1)
{
- for ( q = 0; q<99; q++)
+ for ( q = 0; q<(int)(MAX_TEMP-73.15f)/100+2; q++)
if (!wireless[q][1])
{
wireless[q][0] = 0;