diff --git a/includes/defines.h b/includes/defines.h index 9fba0fb2e..967e3f133 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,9 +8,9 @@ #endif #define SAVE_VERSION 46 -#define MINOR_VERSION 0 +#define MINOR_VERSION 1 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. -//#define BETA +#define BETA #define SERVER "powdertoy.co.uk" diff --git a/includes/powder.h b/includes/powder.h index b09ad5ead..1b2824ecc 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -441,7 +441,7 @@ static const part_type ptypes[PT_NUM] = {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, NULL}, //Maybe TYPE_ENERGY? + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, &update_AMTR}, //Maybe TYPE_ENERGY? {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", ST_SOLID, TYPE_PART, &update_BCOL}, {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN}, {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC}, diff --git a/src/interface.c b/src/interface.c index 570755d85..96b2dbc56 100644 --- a/src/interface.c +++ b/src/interface.c @@ -867,7 +867,7 @@ void login_ui(pixel *vid_buf) if (res && !strncmp(res, "OK ", 3)) { char *s_id,*u_e,*nres; - printf("\n{%s}\n", res); + printf("{%s}\n", res); s_id = strchr(res+3, ' '); if (!s_id) goto fail; @@ -885,7 +885,7 @@ void login_ui(pixel *vid_buf) strcpy(svf_session_id, s_id); nres = mystrdup(u_e); - printf("\n{%s} {%s} {%s}\n", svf_user_id, svf_session_id, nres); + printf("{%s} {%s} {%s}\n", svf_user_id, svf_session_id, nres); if (!strncmp(nres, "ADMIN", 5)) { @@ -3965,6 +3965,7 @@ int console_parse_type(char *txt, int *element, char *err) if (strcmp(txt,num)==0) { *element = i; + strcpy(err,""); return 1; } } @@ -3976,12 +3977,14 @@ int console_parse_type(char *txt, int *element, char *err) if (i>=0) { *element = i; + strcpy(err,""); return 1; } for (i=1; i=0 && nx=XRES) { strcpy(err,"Invalid coordinates"); - free(txt); return 0; } - strcpy(num,""); - coordtxt = strtok(NULL, ","); - if (coordtxt) ny = atoi(coordtxt); - if (ny>=0 && ny=YRES) { strcpy(err,"Invalid coordinates"); - free(txt); return 0; } *x = nx; *y = ny; - free(txt); return 1; } int console_parse_partref(char *txt, int *which, char *err) @@ -4044,6 +4035,7 @@ int console_parse_partref(char *txt, int *which, char *err) if (i>=0 && i2){ + //User is elevated + if (!strncmp(check_data+3, "ADMIN", 5)) + { + svf_admin = 1; + svf_mod = 0; + } + else if (!strncmp(check_data+3, "MOD", 3)) + { + svf_admin = 0; + svf_mod = 1; + } + } + save_presets(0); + } + else + { + //No idea, but log the user out anyway + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + strcpy(svf_user_id, ""); + strcpy(svf_session_id, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; + } + free(check_data); + } + http_session_check = NULL; + } + do_s_check = (do_s_check+1) & 15; + } if (sdl_key=='q' || sdl_key==SDLK_ESCAPE) { @@ -1780,7 +1853,7 @@ int main(int argc, char *argv[]) console = console_ui(vid_buf,console_error); console = mystrdup(console); strcpy(console_error,""); - if(process_command(vid_buf,console,&console_error)==0) + if(process_command(vid_buf,console,&console_error)==-1) { free(console); break; @@ -2626,38 +2699,93 @@ int main(int argc, char *argv[]) return 0; } int process_command(pixel *vid_buf,char *console,char *console_error) { - int nx,ny,i,j,k; - char *console2; - char *console3; - char *console4; - char *console5; + int y,x,nx,ny,i,j,k,m; + int do_next = 1; + char xcoord[10]; + char ycoord[10]; + char console2[15]; + char console3[15]; + char console4[15]; + char console5[15]; //sprintf(console_error, "%s", console); if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0) { - console2 = strtok(console, " "); - console3 = strtok(NULL, " "); - console4 = strtok(NULL, " "); - console5 = strtok(NULL, " "); + sscanf(console,"%14s %14s %14s %14s", console2, console3, console4, console5);//why didn't i know about this function?! if(strcmp(console2, "quit")==0) { - return 0; + return -1; } else if(strcmp(console2, "file")==0 && console3) { FILE *f=fopen(console3, "r"); if(f) { + nx = 0; + ny = 0; + j = 0; + m = 0; + if(console4) + console_parse_coords(console4, &nx , &ny, console_error); char fileread[5000];//TODO: make this change with file size char pch[5000]; + memset(pch,0,sizeof(pch)); + memset(fileread,0,sizeof(fileread)); + char tokens[10]; + int tokensize; fread(fileread,1,5000,f); - j = 0; for(i=0; i