mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-22 07:53:00 +02:00
now warns about a disabled python console.
This commit is contained in:
BIN
build/powder
BIN
build/powder
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#define SAVE_VERSION 46
|
#define SAVE_VERSION 46
|
||||||
#define MINOR_VERSION 4
|
#define MINOR_VERSION 4
|
||||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
#define IDENT_VERSION "D" //Change this if you're not Simon! It should be a single letter.
|
||||||
//#define BETA
|
//#define BETA
|
||||||
|
|
||||||
#define SERVER "powdertoy.co.uk"
|
#define SERVER "powdertoy.co.uk"
|
||||||
@@ -161,6 +161,7 @@ int player2spawn;
|
|||||||
int death2;
|
int death2;
|
||||||
int ISSPAWN1;
|
int ISSPAWN1;
|
||||||
int ISSPAWN2;
|
int ISSPAWN2;
|
||||||
|
extern char pyready;
|
||||||
extern sign signs[MAXSIGNS];
|
extern sign signs[MAXSIGNS];
|
||||||
extern stamp stamps[STAMP_MAX];
|
extern stamp stamps[STAMP_MAX];
|
||||||
extern int stamp_count;
|
extern int stamp_count;
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -15,6 +15,8 @@
|
|||||||
#include <interface.h>
|
#include <interface.h>
|
||||||
#include <misc.h>
|
#include <misc.h>
|
||||||
|
|
||||||
|
|
||||||
|
//char pyready=1;
|
||||||
SDLMod sdl_mod;
|
SDLMod sdl_mod;
|
||||||
int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
||||||
|
|
||||||
@@ -3890,8 +3892,10 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) {
|
|||||||
//clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
|
//clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
|
||||||
memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
|
memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||||
draw_line(vid_buf, 0, 219, XRES+BARSIZE-1, 219, 228, 228, 228, XRES+BARSIZE);
|
draw_line(vid_buf, 0, 219, XRES+BARSIZE-1, 219, 228, 228, 228, XRES+BARSIZE);
|
||||||
drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64, python by Doxin)" //TODO: help command
|
if(pyready)
|
||||||
,255, 255, 255, 255);
|
drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64, python by Doxin)",255, 255, 255, 255);
|
||||||
|
else
|
||||||
|
drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64, python disabled)",255, 0, 0, 255);
|
||||||
|
|
||||||
cc = 0;
|
cc = 0;
|
||||||
currentcommand = last_command;
|
currentcommand = last_command;
|
||||||
|
522
src/main.c
522
src/main.c
@@ -3666,25 +3666,51 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef PYCONSOLE
|
#ifdef PYCONSOLE
|
||||||
if(pyready==1)
|
if(pyready==1)
|
||||||
{
|
{
|
||||||
char *console;
|
char *console;
|
||||||
//char error[255] = "error!";
|
//char error[255] = "error!";
|
||||||
sys_pause = 1;
|
sys_pause = 1;
|
||||||
console = console_ui(vid_buf,console_error,console_more);
|
console = console_ui(vid_buf,console_error,console_more);
|
||||||
console = mystrdup(console);
|
console = mystrdup(console);
|
||||||
strcpy(console_error,"");
|
strcpy(console_error,"");
|
||||||
if(process_command(vid_buf,console,&console_error,pfunc)==-1)
|
if(process_command(vid_buf,console,&console_error,pfunc)==-1)
|
||||||
{
|
{
|
||||||
free(console);
|
free(console);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(console);
|
free(console);
|
||||||
if(!console_mode)
|
if(!console_mode)
|
||||||
hud_enable = 1;
|
hud_enable = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_mode=0;
|
{
|
||||||
|
char *console;
|
||||||
|
sys_pause = 1;
|
||||||
|
console = console_ui(vid_buf,console_error,console_more);
|
||||||
|
console = mystrdup(console);
|
||||||
|
strcpy(console_error,"");
|
||||||
|
if(process_command_old(vid_buf,console,&console_error)==-1)
|
||||||
|
{
|
||||||
|
free(console);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(console);
|
||||||
|
if(!console_mode)
|
||||||
|
hud_enable = 1;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
console_mode=0;
|
char *console;
|
||||||
|
sys_pause = 1;
|
||||||
|
console = console_ui(vid_buf,console_error,console_more);
|
||||||
|
console = mystrdup(console);
|
||||||
|
strcpy(console_error,"");
|
||||||
|
if(process_command_old(vid_buf,console,&console_error)==-1)
|
||||||
|
{
|
||||||
|
free(console);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(console);
|
||||||
|
if(!console_mode)
|
||||||
|
hud_enable = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3768,3 +3794,467 @@ int process_command(pixel *vid_buf,char *console,char *console_error,PyObject *p
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int process_command_old(pixel *vid_buf,char *console,char *console_error) {
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
sscanf(console,"%14s %14s %14s %14s", console2, console3, console4, console5);//why didn't i know about this function?!
|
||||||
|
if(strcmp(console2, "quit")==0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "file")==0 && console3)
|
||||||
|
{
|
||||||
|
if(file_script){
|
||||||
|
FILE *f=fopen(console3, "r");
|
||||||
|
if(f)
|
||||||
|
{
|
||||||
|
char fileread[5000];//TODO: make this change with file size
|
||||||
|
char pch[5000];
|
||||||
|
char tokens[10];
|
||||||
|
int tokensize;
|
||||||
|
nx = 0;
|
||||||
|
ny = 0;
|
||||||
|
j = 0;
|
||||||
|
m = 0;
|
||||||
|
if(console4)
|
||||||
|
console_parse_coords(console4, &nx , &ny, console_error);
|
||||||
|
memset(pch,0,sizeof(pch));
|
||||||
|
memset(fileread,0,sizeof(fileread));
|
||||||
|
fread(fileread,1,5000,f);
|
||||||
|
for(i=0; i<strlen(fileread); i++)
|
||||||
|
{
|
||||||
|
if(fileread[i] != '\n')
|
||||||
|
{
|
||||||
|
pch[i-j] = fileread[i];
|
||||||
|
if(fileread[i] != ' ')
|
||||||
|
tokens[i-m] = fileread[i];
|
||||||
|
}
|
||||||
|
if(fileread[i] == ' ' || fileread[i] == '\n')
|
||||||
|
{
|
||||||
|
if(sregexp(tokens,"^x.[0-9],y.[0-9]")==0)//TODO: fix regex matching to work with x,y ect, right now it has to have a +0 or -0
|
||||||
|
{
|
||||||
|
char temp[5];
|
||||||
|
int starty = 0;
|
||||||
|
tokensize = strlen(tokens);
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
sscanf(tokens,"x%d,y%d",&x,&y);
|
||||||
|
sscanf(tokens,"%9s,%9s",xcoord,ycoord);
|
||||||
|
x += nx;
|
||||||
|
y += ny;
|
||||||
|
sprintf(xcoord,"%d",x);
|
||||||
|
sprintf(ycoord,"%d",y);
|
||||||
|
for(k = 0; k<strlen(xcoord);k++)//rewrite pch with numbers
|
||||||
|
{
|
||||||
|
pch[i-j-tokensize+k] = xcoord[k];
|
||||||
|
starty = k+1;
|
||||||
|
}
|
||||||
|
pch[i-j-tokensize+starty] = ',';
|
||||||
|
starty++;
|
||||||
|
for(k=0;k<strlen(ycoord);k++)
|
||||||
|
{
|
||||||
|
pch[i-j-tokensize+starty+k] = ycoord[k];
|
||||||
|
|
||||||
|
}
|
||||||
|
pch[i-j-tokensize +strlen(xcoord) +1 +strlen(ycoord)] = ' ';
|
||||||
|
j = j -tokensize +strlen(xcoord) +1 +strlen(ycoord);
|
||||||
|
}
|
||||||
|
memset(tokens,0,sizeof(tokens));
|
||||||
|
m = i+1;
|
||||||
|
}
|
||||||
|
if(fileread[i] == '\n')
|
||||||
|
{
|
||||||
|
|
||||||
|
if(do_next)
|
||||||
|
{
|
||||||
|
if(strcmp(pch,"else")==0)
|
||||||
|
do_next = 0;
|
||||||
|
else
|
||||||
|
do_next = process_command_old(vid_buf, pch, console_error);
|
||||||
|
}
|
||||||
|
else if(strcmp(pch,"endif")==0 || strcmp(pch,"else")==0)
|
||||||
|
do_next = 1;
|
||||||
|
memset(pch,0,sizeof(pch));
|
||||||
|
j = i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//sprintf(console_error, "%s exists", console3);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(console_error, "%s does not exist", console3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(console_error, "Scripts are not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "sound")==0 && console3)
|
||||||
|
{
|
||||||
|
if (sound_enable) play_sound(console3);
|
||||||
|
else strcpy(console_error, "Audio device not available - cannot play sounds");
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "load")==0 && console3)
|
||||||
|
{
|
||||||
|
j = atoi(console3);
|
||||||
|
if(j)
|
||||||
|
{
|
||||||
|
open_ui(vid_buf, console3, NULL);
|
||||||
|
console_mode = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "if")==0 && console3)
|
||||||
|
{
|
||||||
|
if(strcmp(console3, "type")==0)//TODO: add more than just type, and be able to check greater/less than
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error)
|
||||||
|
&& console_parse_type(console5, &j, console_error))
|
||||||
|
{
|
||||||
|
if(parts[i].type==j)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(console2, "create")==0 && console3 && console4)
|
||||||
|
{
|
||||||
|
if (console_parse_type(console3, &j, console_error)
|
||||||
|
&& console_parse_coords(console4, &nx, &ny, console_error))
|
||||||
|
{
|
||||||
|
if (!j)
|
||||||
|
strcpy(console_error, "Cannot create particle with type NONE");
|
||||||
|
else if (create_part(-1,nx,ny,j)<0)
|
||||||
|
strcpy(console_error, "Could not create particle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((strcmp(console2, "delete")==0 || strcmp(console2, "kill")==0) && console3)
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console3, &i, console_error))
|
||||||
|
kill_part(i);
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "reset")==0 && console3)
|
||||||
|
{
|
||||||
|
if(strcmp(console3, "pressure")==0)
|
||||||
|
{
|
||||||
|
for (nx = 0; nx<XRES/CELL; nx++)
|
||||||
|
for (ny = 0; ny<YRES/CELL; ny++)
|
||||||
|
{
|
||||||
|
pv[ny][nx] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console3, "velocity")==0)
|
||||||
|
{
|
||||||
|
for (nx = 0; nx<XRES/CELL; nx++)
|
||||||
|
for (ny = 0; ny<YRES/CELL; ny++)
|
||||||
|
{
|
||||||
|
vx[ny][nx] = 0;
|
||||||
|
vy[ny][nx] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console3, "sparks")==0)
|
||||||
|
{
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type==PT_SPRK)
|
||||||
|
{
|
||||||
|
parts[i].type = parts[i].ctype;
|
||||||
|
parts[i].life = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console3, "temp")==0)
|
||||||
|
{
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
parts[i].temp = ptypes[parts[i].type].heat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "set")==0 && console3 && console4 && console5)
|
||||||
|
{
|
||||||
|
if(strcmp(console3, "life")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].life = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].life = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].life = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "type")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
if (console_parse_type(console5, &j, console_error))
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].type = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error)
|
||||||
|
&& console_parse_type(console5, &k, console_error))
|
||||||
|
{
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].type = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error)
|
||||||
|
&& console_parse_type(console5, &j, console_error))
|
||||||
|
{
|
||||||
|
parts[i].type = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "temp")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].temp = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].temp= k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].temp = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "tmp")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].tmp = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].tmp = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].tmp = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "x")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].x = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].x = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].x = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "y")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].y = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].y = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].y = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "ctype")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
if (console_parse_type(console5, &j, console_error))
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].ctype = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error)
|
||||||
|
&& console_parse_type(console5, &k, console_error))
|
||||||
|
{
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].ctype = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error)
|
||||||
|
&& console_parse_type(console5, &j, console_error))
|
||||||
|
{
|
||||||
|
parts[i].ctype = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "vx")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].vx = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].vx = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].vx = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "vy")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].vy = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (console_parse_type(console4, &j, console_error))
|
||||||
|
{
|
||||||
|
k = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type == j)
|
||||||
|
parts[i].vy = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (console_parse_partref(console4, &i, console_error))
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].vy = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf(console_error, "Invalid Command", console2);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
@@ -17,6 +17,8 @@ if(DEBUG==False):
|
|||||||
sys.stdout=logger()
|
sys.stdout=logger()
|
||||||
sys.stderr=logger()
|
sys.stderr=logger()
|
||||||
|
|
||||||
|
#raise SyntaxError()
|
||||||
|
|
||||||
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
|
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
|
||||||
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
|
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
|
||||||
"snow":16,"wood":17,"neut":18,"plut":19,"plnt":20,"acid":21,"void":22,
|
"snow":16,"wood":17,"neut":18,"plut":19,"plnt":20,"acid":21,"void":22,
|
||||||
|
BIN
stdlib.zip
BIN
stdlib.zip
Binary file not shown.
@@ -1,18 +0,0 @@
|
|||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
if len(sys.argv)<2:
|
|
||||||
print("usage: syntaxcheck.py <filename>")
|
|
||||||
raise SystemExit
|
|
||||||
|
|
||||||
fname=sys.argv[1]
|
|
||||||
cppargs=["-E"]+sys.argv[2:]
|
|
||||||
|
|
||||||
p=subprocess.Popen(["gcc",fname]+cppargs,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
|
|
||||||
ret=p.communicate()
|
|
||||||
if len(ret[1])>0:
|
|
||||||
print("errors hapened!")
|
|
||||||
print(repr(ret[1].decode()))
|
|
||||||
raise SystemExit(-1)
|
|
||||||
|
|
||||||
print(len(ret[0].decode()))
|
|
||||||
#python syntaxcheck.py ./src/main.c -DINTERNAL -opowder -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -lSDL -lm -lbz2 -lpython2.7 -lm -L/usr/lib/python2.7/config -I/usr/include/python2.7 -march=native -DX86 -DX86_SSE3 -msse3 src/*.c src/elements/*.c -DLIN64
|
|
Reference in New Issue
Block a user