From 99ae022d5544ecc252ff943f83dba3aa6614ec57 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 18 Sep 2010 09:52:14 +0200 Subject: [PATCH] astyle --- graphics.c | 6 +-- interface.c | 114 ++++++++++++++++++++++++++-------------------------- main.c | 70 ++++++++++++++++---------------- misc.c | 2 +- powder.c | 32 +++++++-------- 5 files changed, 112 insertions(+), 112 deletions(-) diff --git a/graphics.c b/graphics.c index 47c843fc6..7f9cf8c83 100644 --- a/graphics.c +++ b/graphics.c @@ -2121,9 +2121,9 @@ pixel *prerender_save(void *save, int size, int *width, int *height) return NULL; if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50)) return NULL; - if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66){ - new_format = 1; - } + if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) { + new_format = 1; + } if(c[4]>SAVE_VERSION) return NULL; diff --git a/interface.c b/interface.c index 1f972b301..7bbde7370 100644 --- a/interface.c +++ b/interface.c @@ -1789,7 +1789,7 @@ int search_ui(pixel *vid_buf) memset(img_id, 0, sizeof(img_id)); memset(search_ids, 0, sizeof(search_ids)); - memset(search_dates, 0, sizeof(search_dates)); + memset(search_dates, 0, sizeof(search_dates)); memset(search_names, 0, sizeof(search_names)); memset(search_scoreup, 0, sizeof(search_scoreup)); memset(search_scoredown, 0, sizeof(search_scoredown)); @@ -2004,8 +2004,8 @@ int search_ui(pixel *vid_buf) dp = pos; } } - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255); if(mp==pos && !st) @@ -2069,7 +2069,7 @@ int search_ui(pixel *vid_buf) fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255); - //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); } } @@ -2162,17 +2162,17 @@ int search_ui(pixel *vid_buf) fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); info_box(vid_buf, "Loading..."); - if(search_dates[mp]){ - uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - strappend(uri, "&Date="); - strcaturl(uri, search_dates[mp]); - } else { - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - } + if(search_dates[mp]) { + uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + strappend(uri, "&Date="); + strcaturl(uri, search_dates[mp]); + } else { + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + } data = http_simple_get(uri, &status, &dlen); free(uri); @@ -2384,22 +2384,22 @@ int search_ui(pixel *vid_buf) thlen = 4; } thumb_cache_add(img_id[i], thumb, thlen); - for(pos=0; pos=GRID_X*GRID_Y) break; if(votes) { sd = strchr(str+8, ' '); - if(!sd) + if(!sd) return i; *(sd++) = 0; - pu = strchr(sd, ' '); + pu = strchr(sd, ' '); if(!pu) return i; *(pu++) = 0; @@ -2624,10 +2624,10 @@ int search_results(char *str, int votes) else { sd = strchr(str+8, ' '); - if(!sd) + if(!sd) return i; *(sd++) = 0; - pu = strchr(sd, ' '); + pu = strchr(sd, ' '); if(!pu) return i; *(pu++) = 0; @@ -2650,7 +2650,7 @@ int search_results(char *str, int votes) *(r++) = 0; search_ids[i] = mystrdup(str+8); - search_dates[i] = mystrdup(sd); + search_dates[i] = mystrdup(sd); search_publish[i] = atoi(pu); search_scoreup[i] = atoi(vu); diff --git a/main.c b/main.c index f8e11f6dc..51fe3b0ca 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; jSAVE_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') diff --git a/misc.c b/misc.c index 2eac7b243..7c551e277 100644 --- a/misc.c +++ b/misc.c @@ -228,7 +228,7 @@ void strappend(char *dst, char *src) for(s=(unsigned char *)src; *s; s++) { - *(d++) = *s; + *(d++) = *s; } *d = 0; } diff --git a/powder.c b/powder.c index ae7ba8f30..b1473923a 100644 --- a/powder.c +++ b/powder.c @@ -237,7 +237,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_COAL) + if(t==PT_COAL) parts[i].life = 110; if(t==PT_FIRE) parts[i].life = rand()%50+120; @@ -518,7 +518,7 @@ void update_particles_i(pixel *vid, int start, int inc) (bmap[y/CELL][x/CELL]==2) || (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { @@ -705,8 +705,8 @@ void update_particles_i(pixel *vid, int start, int inc) int ctemp = pv[y/CELL][x/CELL]*2; c_heat = 0.0f; h_count = 0; - if(t==PT_ICEI && !parts[i].ctype) - parts[i].ctype = PT_WATR; + if(t==PT_ICEI && !parts[i].ctype) + parts[i].ctype = PT_WATR; if(ptypes[t].hconduct>(rand()%250)) { for(nx=-1; nx<2; nx++) @@ -937,15 +937,15 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_COAL) { - if(parts[i].life<=0){ - t = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); - goto killed; - } else if(parts[i].life < 100){ - parts[i].life--; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); - } + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + create_part(-1, x, y, PT_FIRE); + goto killed; + } else if(parts[i].life < 100) { + parts[i].life--; + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -957,9 +957,9 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { - if(parts[i].life>100){ - parts[i].life = 99; - } + if(parts[i].life>100) { + parts[i].life = 99; + } } } }