diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/interface.c | 18 | ||||
| -rw-r--r-- | src/main.c | 11 | ||||
| -rw-r--r-- | src/powder.c | 14 |
3 files changed, 25 insertions, 18 deletions
diff --git a/src/interface.c b/src/interface.c index 112fef4..1c2c59a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -867,18 +867,26 @@ void login_ui(pixel *vid_buf) if (res && !strncmp(res, "OK ", 3)) { char *s_id,*u_e,*nres; + printf("\n{%s}\n", res); s_id = strchr(res+3, ' '); + if (!s_id) + goto fail; *(s_id++) = 0; - + u_e = strchr(s_id, ' '); - *(u_e++) = 0; + if (!u_e){ + u_e = malloc(1); + memset(u_e, 0, 1); + } + else + *(u_e++) = 0; strcpy(svf_user_id, res+3); strcpy(svf_session_id, s_id); nres = mystrdup(u_e); - + printf("\n{%s} {%s} {%s}\n", svf_user_id, svf_session_id, nres); - + if (!strncmp(nres, "ADMIN", 5)) { svf_admin = 1; @@ -3854,7 +3862,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show mx /= sdl_scale; my /= sdl_scale; ed.focus = 1; - + clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent? draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE); drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.2 (by cracker64)\n" @@ -2552,12 +2552,11 @@ int main(int argc, char *argv[]) return 0; } int process_command(pixel *vid_buf,char *console,char *console_error) { - -int nx,ny,i,j; -char *console2; -char *console3; -char *console4; -char *console5; + int nx,ny,i,j; + char *console2; + char *console3; + char *console4; + char *console5; //sprintf(console_error, "%s", console); if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0) { diff --git a/src/powder.c b/src/powder.c index b2932d1..493dec7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1328,7 +1328,7 @@ void update_particles_i(pixel *vid, int start, int inc) neighbors = gol2[nx][ny][0]; if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART) continue; - for ( golnum = 1; golnum<NGOL; golnum++) + for ( golnum = 1; golnum<=NGOL; golnum++) for ( goldelete = 0; goldelete<9; goldelete++) { if (neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) @@ -1345,7 +1345,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_NONE;//using kill_part makes it not work } gol2[nx][ny][0] = 0; - for ( z = 1; z<NGOL; z++) + for ( z = 1; z<=NGOL; z++) gol2[nx][ny][z] = 0; } if (createdsomething) @@ -1963,15 +1963,15 @@ killed: { parts[i].x = clear_xf+(j-clear_x); parts[i].y = fin_yf; - x = j; - y = fin_y; + nx = j; + ny = fin_y; s = 1; break; } if (try_move(i, x, y, j, clear_y)) { parts[i].x = clear_xf+(j-clear_x); - x = j; + nx = j; s = 1; break; } @@ -1985,12 +1985,12 @@ killed: if (s) for (j=clear_y+r; j>=0 && j<YRES && j>=clear_y-rt && j<clear_y+rt; j+=r) { - if (try_move(i, x, y, clear_x, j)) + if (try_move(i, x, y, nx, j)) { parts[i].y = clear_yf+(j-clear_y); break; } - if ((pmap[j][x]&255)!=t || (bmap[j/CELL][x/CELL] && bmap[j/CELL][x/CELL]!=WL_STREAM)) + if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM)) { s = 0; break; |
