summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorFelix Wallin <nibbler.v1@gmail.com>2010-09-18 07:52:14 (GMT)
committer Felix Wallin <nibbler.v1@gmail.com>2010-09-18 07:52:14 (GMT)
commit99ae022d5544ecc252ff943f83dba3aa6614ec57 (patch)
tree6787ea4c4ed830f14aeb69f8fb8449d631d157df /main.c
parentfa099338bb87d25ea660e74b16811d18256e7d51 (diff)
downloadpowder-99ae022d5544ecc252ff943f83dba3aa6614ec57.zip
powder-99ae022d5544ecc252ff943f83dba3aa6614ec57.tar.gz
astyle
Diffstat (limited to 'main.c')
-rw-r--r--main.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/main.c b/main.c
index f8e11f6..51fe3b0 100644
--- a/main.c
+++ b/main.c
@@ -310,10 +310,10 @@ void *build_save(int *size, int x0, int y0, int w, int h)
i = m[j];
if(i)
{
- //New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format
- int tttemp = (int)parts[i-1].temp;
- d[p++] = ((tttemp&0xFF00)>>8);
- d[p++] = (tttemp&0x00FF);
+ //New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format
+ int tttemp = (int)parts[i-1].temp;
+ d[p++] = ((tttemp&0xFF00)>>8);
+ d[p++] = (tttemp&0x00FF);
}
}
for(j=0; j<w*h; j++)
@@ -349,8 +349,8 @@ void *build_save(int *size, int x0, int y0, int w, int h)
i = (p*101+99)/100 + 612;
c = malloc(i);
- //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
- //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
+ //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
+ //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
c[0] = 0x50; //0x66;
c[1] = 0x53; //0x75;
@@ -386,16 +386,16 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h;
int fp[NPART], nf=0, new_format = 0, ttv = 0;
- //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
- //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
+ //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
+ //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error
if(size<16)
return 1;
if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50))
return 1;
- if(c[2]==0x76 && c[1]==0x53 && c[0]==0x50){
- new_format = 1;
- }
+ if(c[2]==0x76 && c[1]==0x53 && c[0]==0x50) {
+ new_format = 1;
+ }
if(c[4]>SAVE_VERSION)
return 2;
ver = c[4];
@@ -600,13 +600,13 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
if(i <= NPART)
{
if(ver>=42) {
- if(new_format){
- ttv = (d[p++])<<8;
- ttv |= (d[p++]);
- parts[i-1].temp = ttv;
- } else {
- parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP;
- }
+ if(new_format) {
+ ttv = (d[p++])<<8;
+ ttv |= (d[p++]);
+ parts[i-1].temp = ttv;
+ } else {
+ parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP;
+ }
} else {
parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273;
}
@@ -614,9 +614,9 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
else
{
p++;
- if(new_format){
- p++;
- }
+ if(new_format) {
+ p++;
+ }
}
}
else
@@ -1253,8 +1253,8 @@ int main(int argc, char *argv[])
{
set_cmode(6);
}
- if(sdl_key==SDLK_LEFTBRACKET){
- if(sdl_zoom_trig==1)
+ if(sdl_key==SDLK_LEFTBRACKET) {
+ if(sdl_zoom_trig==1)
{
ZSIZE -= 1;
if(ZSIZE>32)
@@ -1265,18 +1265,18 @@ int main(int argc, char *argv[])
}
else
{
- if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
- bs -= 1;
- else
- bs -= ceil((bs/5)+0.5f);
+ if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
+ bs -= 1;
+ else
+ bs -= ceil((bs/5)+0.5f);
if(bs>1224)
bs = 1224;
if(bs<0)
bs = 0;
}
- }
- if(sdl_key==SDLK_RIGHTBRACKET){
- if(sdl_zoom_trig==1)
+ }
+ if(sdl_key==SDLK_RIGHTBRACKET) {
+ if(sdl_zoom_trig==1)
{
ZSIZE += 1;
if(ZSIZE>32)
@@ -1287,16 +1287,16 @@ int main(int argc, char *argv[])
}
else
{
- if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
- bs += 1;
- else
- bs += ceil((bs/5)+0.5f);
+ if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
+ bs += 1;
+ else
+ bs += ceil((bs/5)+0.5f);
if(bs>1224)
bs = 1224;
if(bs<0)
bs = 0;
}
- }
+ }
if(sdl_key==SDLK_SPACE)
sys_pause = !sys_pause;
if(sdl_key=='h')