Moved console commands into own function. Added running script files so console commands can be run instantly. Added create command. element names work, from jacksonmj.
This commit is contained in:
parent
6aaa9e78cd
commit
b7f768e4b3
@ -228,5 +228,7 @@ int report_ui(pixel *vid_buf, char *save_id);
|
|||||||
|
|
||||||
char *console_ui(pixel *vid_buf, char error[255]);
|
char *console_ui(pixel *vid_buf, char error[255]);
|
||||||
|
|
||||||
|
int console_get_type(char *element);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3898,6 +3898,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
|||||||
if(ci==-1)
|
if(ci==-1)
|
||||||
{
|
{
|
||||||
strcpy(ed.str, "");
|
strcpy(ed.str, "");
|
||||||
|
ed.cursor = strlen(ed.str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3916,6 +3917,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
|||||||
{
|
{
|
||||||
ci = -1;
|
ci = -1;
|
||||||
strcpy(ed.str, "");
|
strcpy(ed.str, "");
|
||||||
|
ed.cursor = strlen(ed.str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3925,3 +3927,20 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int console_get_type(char *element)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char num[4];
|
||||||
|
i = atoi(element);
|
||||||
|
sprintf(num,"%d",i);
|
||||||
|
if (i>=0 && i<PT_NUM && strcmp(element,num)==0)
|
||||||
|
return i;
|
||||||
|
if (strcasecmp(element,"C4")==0) return PT_PLEX;
|
||||||
|
if (strcasecmp(element,"C5")==0) return PT_C5;
|
||||||
|
if (strcasecmp(element,"NONE")==0) return PT_NONE;
|
||||||
|
for (i=0; i<PT_NUM; i++) {
|
||||||
|
if (strcasecmp(element,ptypes[i].name)==0)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
565
src/main.c
565
src/main.c
@ -1121,7 +1121,7 @@ int main(int argc, char *argv[])
|
|||||||
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
||||||
void *http_ver_check;
|
void *http_ver_check;
|
||||||
char *ver_data=NULL, *tmp;
|
char *ver_data=NULL, *tmp;
|
||||||
char error[255] = "";
|
char console_error[255] = "";
|
||||||
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
|
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
|
||||||
#ifdef INTERNAL
|
#ifdef INTERNAL
|
||||||
int vs = 0;
|
int vs = 0;
|
||||||
@ -1698,265 +1698,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if(console_mode)
|
if(console_mode)
|
||||||
{
|
{
|
||||||
int nx,ny;
|
|
||||||
char *console;
|
char *console;
|
||||||
char *console2;
|
|
||||||
char *console3;
|
|
||||||
char *console4;
|
|
||||||
char *console5;
|
|
||||||
//char error[255] = "error!";
|
//char error[255] = "error!";
|
||||||
sys_pause = 1;
|
sys_pause = 1;
|
||||||
console = console_ui(vid_buf,error);
|
console = console_ui(vid_buf,console_error);
|
||||||
console = mystrdup(console);
|
console = mystrdup(console);
|
||||||
strcpy(error,"");
|
strcpy(console_error,"");
|
||||||
if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0)
|
if(process_command(vid_buf,console,&console_error)==0)
|
||||||
{
|
|
||||||
console2 = strtok(console, " ");
|
|
||||||
console3 = strtok(NULL, " ");
|
|
||||||
console4 = strtok(NULL, " ");
|
|
||||||
console5 = strtok(NULL, " ");
|
|
||||||
if(strcmp(console2, "quit")==0)
|
|
||||||
{
|
{
|
||||||
free(console);
|
free(console);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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, "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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
parts[i].life = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(strcmp(console3, "type")==0)
|
|
||||||
{
|
|
||||||
if(strcmp(console4, "all")==0)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
for(i=0;i<NPART;i++)
|
|
||||||
{
|
|
||||||
if(parts[i].type)
|
|
||||||
parts[i].type = j;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
parts[i].y = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(strcmp(console3, "ctype")==0)
|
|
||||||
{
|
|
||||||
if(strcmp(console4, "all")==0)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
for(i=0;i<NPART;i++)
|
|
||||||
{
|
|
||||||
if(parts[i].type)
|
|
||||||
parts[i].ctype = j;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
i = atoi(console4);
|
|
||||||
if(parts[i].type)
|
|
||||||
{
|
|
||||||
j = atoi(console5);
|
|
||||||
parts[i].vy = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sprintf(error, "Invalid Command", console2);
|
|
||||||
}
|
|
||||||
free(console);
|
free(console);
|
||||||
if(!console_mode)
|
if(!console_mode)
|
||||||
hud_enable = 1;
|
hud_enable = 1;
|
||||||
@ -2751,4 +2503,313 @@ int main(int argc, char *argv[])
|
|||||||
http_done();
|
http_done();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int process_command(pixel *vid_buf,char *console,char *console_error) { //TODO: delete with coords, have 'set' work with coords as well
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
console2 = strtok(console, " ");
|
||||||
|
console3 = strtok(NULL, " ");
|
||||||
|
console4 = strtok(NULL, " ");
|
||||||
|
console5 = strtok(NULL, " ");
|
||||||
|
if(strcmp(console2, "quit")==0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "file")==0 && console3)
|
||||||
|
{
|
||||||
|
FILE *f=fopen(console3, "r");
|
||||||
|
if(f)
|
||||||
|
{
|
||||||
|
char fileread[5000];//TODO: make this change with file size
|
||||||
|
char pch[5000];
|
||||||
|
fread(fileread,1,5000,f);
|
||||||
|
j = 0;
|
||||||
|
for(i=0; i<strlen(fileread); i++)
|
||||||
|
{
|
||||||
|
if(fileread[i] != '\n')
|
||||||
|
pch[i-j] = fileread[i];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
process_command(vid_buf, pch, console_error);
|
||||||
|
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 if(strcmp(console2, "load")==0 && console3)
|
||||||
|
{
|
||||||
|
j = atoi(console3);
|
||||||
|
if(j)
|
||||||
|
{
|
||||||
|
open_ui(vid_buf, console3, NULL);
|
||||||
|
console_mode = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(console2, "create")==0 && console3 && console4 && console5)
|
||||||
|
{
|
||||||
|
j = console_get_type(console3);
|
||||||
|
if (j<0)
|
||||||
|
sprintf(console_error, "Particle type not recognised", console2);
|
||||||
|
nx = atoi(console4);
|
||||||
|
ny = atoi(console5);
|
||||||
|
if(ny < 0 || nx < 0 || ny > YRES || nx > XRES)
|
||||||
|
sprintf(console_error, "Invalid Coordinates", console2);
|
||||||
|
else
|
||||||
|
create_part(-1,nx,ny,j);
|
||||||
|
}
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].life = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "type")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = console_get_type(console5);
|
||||||
|
if (j<0)
|
||||||
|
sprintf(console_error, "Particle type not recognised", console2);
|
||||||
|
else
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].type = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
j = console_get_type(console5);
|
||||||
|
if (j<0)
|
||||||
|
sprintf(console_error, "Particle type not recognised", console2);
|
||||||
|
else
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].y = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp(console3, "ctype")==0)
|
||||||
|
{
|
||||||
|
if(strcmp(console4, "all")==0)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
for(i=0; i<NPART; i++)
|
||||||
|
{
|
||||||
|
if(parts[i].type)
|
||||||
|
parts[i].ctype = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
i = atoi(console4);
|
||||||
|
if(parts[i].type)
|
||||||
|
{
|
||||||
|
j = atoi(console5);
|
||||||
|
parts[i].vy = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf(console_error, "Invalid Command", console2);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user