Compatibility with MSVC - devast8a

This commit is contained in:
Simon Robertshaw 2011-10-23 17:59:04 +01:00
parent 58d667281f
commit b549688fdd
5 changed files with 13 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#include <element.h>
int update_DEST(UPDATE_FUNC_ARGS) {
int r,rx,ry;
int r,rx,ry,topv;
rx=rand()%5-2;
ry=rand()%5-2;
@ -45,7 +45,7 @@ int update_DEST(UPDATE_FUNC_ARGS) {
{
if (ptypes[r&0xFF].hconduct) parts[r>>8].temp = restrict_flt(parts[r>>8].temp+10000.0f, MIN_TEMP, MAX_TEMP);
}
int topv=pv[y/CELL][x/CELL]/9+parts[r>>8].temp/900;
topv=pv[y/CELL][x/CELL]/9+parts[r>>8].temp/900;
if (topv>40.0f)
topv=40.0f;
pv[y/CELL][x/CELL]+=40.0f+topv;

View File

@ -1,7 +1,7 @@
#include <element.h>
int update_EMP(UPDATE_FUNC_ARGS) {
int r,rx,ry,ok=0,t;
int r,rx,ry,ok=0,t,n,nx,ny;
if (parts[i].life)
return 0;
for (rx=-2; rx<3; rx++)
@ -42,7 +42,7 @@ int update_EMP(UPDATE_FUNC_ARGS) {
else if (rand()%120==0)
part_change_type(r, rx, ry, PT_NTCT);
}
int n,nx,ny;
for (nx=-2; nx<3; nx++)
for (ny=-2; ny<3; ny++)
if (rx+nx>=0 && ry+ny>=0 && rx+nx<XRES && ry+ny<YRES && (rx || ry))

View File

@ -1757,7 +1757,7 @@ void draw_parts(pixel *vid)
int orbd[4] = {0, 0, 0, 0};
int orbl[4] = {0, 0, 0, 0};
int cr, cg, cb;
float fr, fg, fb;
float fr, fg, fb, div_n;
float pt = R_TEMP;
if (GRID_MODE)//draws the grid
{
@ -3455,7 +3455,7 @@ void draw_parts(pixel *vid)
addpixel(vid, nx, ny+newx, cr, cg, cb, gradv);
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
float div_n=1.2f-0.006*parts[i].life;
div_n=1.2f-0.006*parts[i].life;
if (div_n<1.01f)
div_n=1.01f;
gradv = gradv/div_n;

View File

@ -122,7 +122,9 @@ void save_presets(int do_update)
{
char * outputdata;
cJSON *root, *userobj, *versionobj;
root = cJSON_CreateObject();
FILE* f;
root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "Powder Toy Preferences", "Don't modify this file unless you know what you're doing. P.S: editing the admin/mod fields in your user info doesn't give you magical powers");
@ -163,7 +165,7 @@ void save_presets(int do_update)
outputdata = cJSON_Print(root);
cJSON_Delete(root);
FILE *f = fopen("powder.pref", "wb");
f = fopen("powder.pref", "wb");
if(!f)
return;
fwrite(outputdata, 1, strlen(outputdata), f);

View File

@ -2613,11 +2613,11 @@ int flood_prop_2(int x, int y, size_t propoffset, void * propvalue, int proptype
{
i = pmap[y][x]>>8;
if(proptype==2){
*((float*)(((void*)&parts[i])+propoffset)) = *((float*)propvalue);
*((float*)(((char*)&parts[i])+propoffset)) = *((float*)propvalue);
} else if(proptype==0) {
*((int*)(((void*)&parts[i])+propoffset)) = *((int*)propvalue);
*((int*)(((char*)&parts[i])+propoffset)) = *((int*)propvalue);
} else if(proptype==1) {
*((char*)(((void*)&parts[i])+propoffset)) = *((char*)propvalue);
*((char*)(((char*)&parts[i])+propoffset)) = *((char*)propvalue);
}
bitmap[(y*XRES)+x] = 1;
}