mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 03:44:05 +02:00
Improve console element parsing
GOL, 34, 2x2 now work. Element types can no longer be referred to by number, to remove ambiguity between type and particle number.
This commit is contained in:
@@ -3957,19 +3957,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
||||
|
||||
int console_parse_type(char *txt, int *element, char *err)
|
||||
{
|
||||
int i = atoi(txt);
|
||||
char num[4];
|
||||
if (i>=0 && i<PT_NUM)
|
||||
{
|
||||
sprintf(num,"%d",i);
|
||||
if (strcmp(txt,num)==0)
|
||||
{
|
||||
*element = i;
|
||||
strcpy(err,"");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
i = -1;
|
||||
int i = -1;
|
||||
// alternative names for some elements
|
||||
if (strcasecmp(txt,"C4")==0) i = PT_PLEX;
|
||||
else if (strcasecmp(txt,"C5")==0) i = PT_C5;
|
||||
|
Reference in New Issue
Block a user