added run count

This commit is contained in:
Lexi Quinn 2023-07-20 20:38:06 +10:00
parent c7387f5acb
commit 1aa1ed514a
2 changed files with 20 additions and 11 deletions

View File

@ -41,6 +41,7 @@ int runMarker2 = 0;
//save file stuff //save file stuff
char *default_file_name = "untitled.quest"; char *default_file_name = "untitled.quest";
int run_count = 0;
int files = 0; int files = 0;
char **filePaths = NULL; char **filePaths = NULL;
char **names, **values; char **names, **values;
@ -294,6 +295,7 @@ void appendRunToFile()
fprintf(fp, "\n"); fprintf(fp, "\n");
fclose(fp); fclose(fp);
run_count++;
runUnsaved = false; runUnsaved = false;
} }
@ -319,10 +321,14 @@ void loadFiles()
while(1) { while(1) {
if (!fgets(buff, 255, fp)) if (!fgets(buff, 255, fp))
break; break;
if (buff[0] == '/' && buff[1] == '/' || buff[0] == '\n') if (buff[0] == '/' && buff[1] == '/' || buff[0] == '\n' || buff[0] == '\t')
continue; continue;
if (!strcmp(buff, "Segment\n") || !strcmp(buff, "Route\n")) if (!strcmp(buff, "Segment\n") || !strcmp(buff, "Route\n"))
break; continue;
if (!strcmp(buff, "Run\n")) {
run_count++;
continue;
}
if (!fgets(buff2, 255, fp)) if (!fgets(buff2, 255, fp))
break; break;
if (buff2[0] == '\t') { if (buff2[0] == '\t') {
@ -347,6 +353,7 @@ void loadFiles()
for (int i = 0; i < valuecount; i++) { for (int i = 0; i < valuecount; i++) {
printf("%s | %s", names[i], values[i]); printf("%s | %s", names[i], values[i]);
} }
printf("%d\n", run_count);
} }
//TODO: eventually file loading should support loading multiple files //TODO: eventually file loading should support loading multiple files

View File

@ -64,7 +64,7 @@ int timestringDigits(int ms)
void printbig(int x, int y, int ms) void printbig(int x, int y, int ms)
{ {
char small[13]; char small[13];
timestring(&small, ms); timestring(small, ms);
if (w < strlen(small)) { if (w < strlen(small)) {
printf("2smol\n"); printf("2smol\n");
return; return;
@ -194,18 +194,20 @@ int main (int argc, char *argv[])
//Request foreground color from config file //Request foreground color from config file
fp = popen("./result/bin/quest-log foreground", "r"); fp = popen("./result/bin/quest-log foreground", "r");
fgets(path, sizeof(path), fp); if (fgets(path, sizeof(path), fp)) {
if (strcmp(path, "DATA NOT PRESENT")) if (strcmp(path, "DATA NOT PRESENT"))
processColorString(&f, path); processColorString(&f, path);
printf("\033[38;2;%d;%d;%dm", f.r, f.g, f.b); printf("\033[38;2;%d;%d;%dm", f.r, f.g, f.b);
}
pclose(fp); pclose(fp);
//Request background color from config file //Request background color from config file
fp = popen("./result/bin/quest-log background", "r"); fp = popen("./result/bin/quest-log background", "r");
fgets(path, sizeof(path), fp); if (fgets(path, sizeof(path), fp)) {
if (strcmp(path, "DATA NOT PRESENT")) if (strcmp(path, "DATA NOT PRESENT"))
processColorString(&b, path); processColorString(&b, path);
printf("\033[48;2;%d;%d;%dm", b.r, b.g, b.b); printf("\033[48;2;%d;%d;%dm", b.r, b.g, b.b);
}
pclose(fp); pclose(fp);
//Set fps from command line argument //Set fps from command line argument