summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interface.c42
-rw-r--r--src/main.c60
-rw-r--r--src/powder.c4
3 files changed, 53 insertions, 53 deletions
diff --git a/src/interface.c b/src/interface.c
index 0d963e0..e345007 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -852,16 +852,16 @@ void login_ui(pixel *vid_buf)
char *s_id,*u_e,*nres;
s_id = strchr(res+3, ' ');
*(s_id++) = 0;
-
+
u_e = strchr(s_id, ' ');
*(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;
@@ -3837,17 +3837,17 @@ 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, 15, 15, "Welcome to The Powder Toy console v.1 (by cracker64)\n"
- "Current commands are quit, set, reset, load\n"
- "You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n"
- "You can also use 'all' instead of a particle number to do it to everything\n"
- "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n"
- "To load a save use load saveID (ex. load 1337)"
- ,255, 187, 187, 255);
-
+ "Current commands are quit, set, reset, load\n"
+ "You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n"
+ "You can also use 'all' instead of a particle number to do it to everything\n"
+ "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n"
+ "To load a save use load saveID (ex. load 1337)"
+ ,255, 187, 187, 255);
+
cc = 0;
currentcommand = last_command;
while(cc < 10)
@@ -3859,18 +3859,18 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
{
if(cc<9) {
currentcommand = currentcommand->prev_command;
- } else if(currentcommand->prev_command!=NULL){
+ } else if(currentcommand->prev_command!=NULL) {
free(currentcommand->prev_command);
currentcommand->prev_command = NULL;
}
cc++;
- }
+ }
else
{
break;
}
}
-
+
if(error)
drawtext(vid_buf, 15, 190, error,255, 187, 187, 255);
ui_edit_draw(vid_buf, &ed);
@@ -3901,26 +3901,26 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
}
else
{
- if(last_command!=NULL){
+ if(last_command!=NULL) {
currentcommand = last_command;
for (cc = 0; cc<ci; cc++) {
if(currentcommand->prev_command==NULL)
ci = cc;
- else
+ else
currentcommand = currentcommand->prev_command;
}
strcpy(ed.str, currentcommand->command);
}
- else
+ else
{
ci = -1;
strcpy(ed.str, "");
}
}
}
-
+
}
-
-
+
+
}
diff --git a/src/main.c b/src/main.c
index e6f29b4..d20fb35 100644
--- a/src/main.c
+++ b/src/main.c
@@ -718,7 +718,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
ttv |= (d[p++]);
parts[i-1].tmp = ttv;
if(ptypes[parts[i-1].type].properties&PROP_LIFE && !parts[i-1].tmp)
- for(q = 1; q<NGOL ; q++) {
+ for(q = 1; q<=NGOL ; q++) {
if(parts[i-1].type==goltype[q-1] && grule[q][9]==2)
parts[i-1].tmp = grule[q][9]-1;
}
@@ -1736,7 +1736,7 @@ int main(int argc, char *argv[])
{
pv[ny][nx] = 0;
}
-
+
}
else if(strcmp(console3, "velocity")==0)
{
@@ -1749,7 +1749,7 @@ int main(int argc, char *argv[])
}
else if(strcmp(console3, "sparks")==0)
{
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type==PT_SPRK)
{
@@ -1760,7 +1760,7 @@ int main(int argc, char *argv[])
}
else if(strcmp(console3, "temp")==0)
{
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
{
@@ -1776,12 +1776,12 @@ int main(int argc, char *argv[])
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].life = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1790,18 +1790,18 @@ int main(int argc, char *argv[])
parts[i].life = j;
}
}
- }
+ }
if(strcmp(console3, "type")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].type = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1810,18 +1810,18 @@ int main(int argc, char *argv[])
parts[i].type = j;
}
}
- }
+ }
if(strcmp(console3, "temp")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].temp = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1830,18 +1830,18 @@ int main(int argc, char *argv[])
parts[i].temp = j;
}
}
- }
+ }
if(strcmp(console3, "tmp")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].tmp = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1850,18 +1850,18 @@ int main(int argc, char *argv[])
parts[i].tmp = j;
}
}
- }
+ }
if(strcmp(console3, "x")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].x = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1876,12 +1876,12 @@ int main(int argc, char *argv[])
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].y = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1890,18 +1890,18 @@ int main(int argc, char *argv[])
parts[i].y = j;
}
}
- }
+ }
if(strcmp(console3, "ctype")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].ctype = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1910,18 +1910,18 @@ int main(int argc, char *argv[])
parts[i].ctype = j;
}
}
- }
+ }
if(strcmp(console3, "vx")==0)
{
- if(strcmp(console4, "all")==0)
+ if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].vx = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
@@ -1930,18 +1930,18 @@ int main(int argc, char *argv[])
parts[i].vx = j;
}
}
- }
+ }
if(strcmp(console3, "vy")==0)
{
if(strcmp(console4, "all")==0)
{
j = atoi(console5);
- for(i=0;i<NPART;i++)
+ for(i=0; i<NPART; i++)
{
if(parts[i].type)
parts[i].vy = j;
}
- } else
+ } else
{
i = atoi(console4);
if(parts[i].type)
diff --git a/src/powder.c b/src/powder.c
index b2932d1..a378da4 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)