remove old commented code

This commit is contained in:
Paul Dino Jones 2025-01-16 22:10:44 -05:00
parent 4df9787c21
commit 13d7a03acb
2 changed files with 0 additions and 280 deletions

View File

@ -104,98 +104,6 @@ int loadtyreconfig(SimData* simdata, char* configfile)
return 0;
}
//void loadtyreconfig(SimData* simdata, char* configfile)
//{
// json_t *root;
// json_error_t error;
//
// root = json_load_file(configfile, 0, NULL);
//
// if(!root)
// {
// slogw("could not open config file for tyre diameters");
// return;
// }
//
// if(!json_is_object(root))
// {
// slogw("Malformed content (1) in tyre diameters config");
// json_decref(root);
// return;
// }
//
// json_t* cararray = json_object_get(root, "cars");
// if(!json_is_array(cararray))
// {
// slogw("Malformed content (2) in tyre diameters config");
// json_decref(root);
// json_decref(cararray);
// return;
// }
//
// for(int i = 0; i < json_array_size(cararray); i++)
// {
// json_t *data, *sha, *commit, *message;
// const char *message_text;
//
// data = json_array_get(cararray, i);
// if(!json_is_object(data))
// {
// slogw("Malformed content (3) in tyre diameters config");
// break;
// }
// json_t* jcar = json_object_get(data, "car");
//
// if(!json_is_string(jcar))
// {
// slogw("Malformed content (4) in tyre diameters config");
//
// json_decref(data);
// json_decref(jcar);
// break;
// }
// const char* car = json_string_value(jcar);
//
// json_t* jtyre0 = json_object_get(data, "tyre0");
// json_t* jtyre1 = json_object_get(data, "tyre1");
// json_t* jtyre2 = json_object_get(data, "tyre2");
// json_t* jtyre3 = json_object_get(data, "tyre3");
//
// double diameter0 = json_real_value(jtyre0);
// double diameter1 = json_real_value(jtyre1);
// double diameter2 = json_real_value(jtyre2);
// double diameter3 = json_real_value(jtyre3);
//
// slogt("car is: %s", car);
// slogt("diameter 0 is %f", diameter0);
// slogt("diameter 1 is %f", diameter1);
// slogt("diameter 2 is %f", diameter2);
// slogt("diameter 3 is %f", diameter3);
//
// json_decref(data);
// json_decref(jcar);
// json_decref(jtyre0);
// json_decref(jtyre1);
// json_decref(jtyre2);
// json_decref(jtyre3);
//
// if(simdata->car != NULL)
// {
// if (strcicmp(car, simdata->car) == 0)
// {
// simdata->tyrediameter[0] = diameter0;
// simdata->tyrediameter[1] = diameter1;
// simdata->tyrediameter[2] = diameter2;
// simdata->tyrediameter[3] = diameter3;
// break;
// }
// }
// }
//
// json_decref(root);
// json_decref(cararray);
//}
int savetyreconfig(SimData* simdata, char* configfile)
{
config_t cfg;
@ -247,53 +155,6 @@ int savetyreconfig(SimData* simdata, char* configfile)
return 0;
}
//void savetyreconfig(SimData* simdata, char* configfile)
//{
//
// json_t* object = json_object();
// json_t* array = json_array();
// json_t* car = json_string(simdata->car);
// json_t* tyre0 = json_real(simdata->tyrediameter[0]);
// json_t* tyre1 = json_real(simdata->tyrediameter[1]);
// json_t* tyre2 = json_real(simdata->tyrediameter[2]);
// json_t* tyre3 = json_real(simdata->tyrediameter[3]);
// json_object_set_new(object, "car", car);
// json_object_set_new(object, "tyre0", tyre0);
// json_object_set_new(object, "tyre1", tyre1);
// json_object_set_new(object, "tyre2", tyre2);
// json_object_set_new(object, "tyre3", tyre3);
//
// json_array_append(array, object);
//
// json_t* file = json_load_file(configfile, 0, NULL);
//
// if(!file)
// {
// slogw("could not open config file for tyre diameters");
// return;
// }
//
// if(!json_is_object(file))
// {
// json_object_set_new(file, "cars", array);
// }
// else
// {
// json_t* cararray = json_object_get(file, "cars");
// json_array_append(cararray, array);
// }
//
// json_dump_file(file, configfile, 0);
//
// json_decref(tyre0);
// json_decref(tyre1);
// json_decref(tyre2);
// json_decref(tyre3);
// json_decref(car);
// json_decref(object);
// json_decref(array);
//}
void getTyreDiameter(SimData* simdata)
{
if(simdata->velocity > minvelocity && simdata->brake <= maxbrake && simdata->gas <= maxthrottle)

View File

@ -619,147 +619,6 @@ int monocoque_mainloop(MonocoqueSettings* ms)
return 0;
}
//int clilooper(SimDevice* devices, int numdevices, Parameters* p, SimData* simdata, SimMap* simmap)
//{
// struct pollfd mypoll = { STDIN_FILENO, POLLIN|POLLPRI };
// double update_rate = DEFAULT_UPDATE_RATE;
// char ch;
// int t=0;
// int s=0;
// go2 = true;
// slogd("game data found, starting game loop");
// while (go2 == true && simdata->simstatus > 1)
// {
// simdatamap(simdata, simmap, p->sim);
// showstats(simdata);
// t++;
// s++;
// if(simdata->rpms<100)
// {
// simdata->rpms=100;
// }
//
// for (int x = 0; x < numdevices; x++)
// {
// if (devices[x].initialized == true)
// {
// devices[x].update(&devices[x], simdata);
// }
// }
//
// if( poll(&mypoll, 1, 1000.0/update_rate) )
// {
// scanf("%c", &ch);
// if(ch == 'q')
// {
// slogd("User gameloop exit requested.");
// go2 = false;
// }
// }
// }
//
// simdata->velocity = 0;
// simdata->rpms = 100;
// simdata->gear = MONOCOQUE_GEAR_NEUTRAL;
// for (int x = 0; x < numdevices; x++)
// {
// if (devices[x].initialized == true)
// {
// devices[x].update(&devices[x], simdata);
// }
// }
//
// fprintf(stdout, "\n");
// int r = simfree(simdata, simmap, p->sim);
// slogd("simfree returned %i", r);
//
// return 0;
//}
//int looper(SimDevice* devices, int numdevices, Parameters* p)
//{
// memset(&act, 0, sizeof(act));
// act.sa_sigaction = sighandler;
// act.sa_flags = SA_SIGINFO;
// sigaction(SIGTERM, &act, NULL);
// sigaction(SIGINT, &act, NULL);
// sigaction(SIGTSTP, &act, NULL);
//
// SimData* simdata = malloc(sizeof(SimData));
// SimMap* simmap = malloc(sizeof(SimMap));
// simdata->tyrediameter[0] = -1;
// simdata->tyrediameter[1] = -1;
// simdata->tyrediameter[2] = -1;
// simdata->tyrediameter[3] = -1;
//
// struct termios newsettings, canonicalmode;
// tcgetattr(0, &canonicalmode);
// newsettings = canonicalmode;
// newsettings.c_lflag &= (~ICANON & ~ECHO);
// newsettings.c_cc[VMIN] = 1;
// newsettings.c_cc[VTIME] = 0;
// tcsetattr(0, TCSANOW, &newsettings);
// char ch;
// struct pollfd mypoll = { STDIN_FILENO, POLLIN|POLLPRI };
//
// fprintf(stdout, "Searching for sim data... Press q to quit...\n");
// p->simon = false;
// double update_rate = SIM_CHECK_RATE;
// go = true;
// while (go == true)
// {
// p->simon = false;
// getSim(simdata, simmap, &p->simon, &p->sim);
//
// if (p->simon == true && simdata->simstatus > 1)
// {
// slogi("preparing game loop with %i devices...", numdevices);
//
//
// slogi("sending initial data to devices");
// simdata->velocity = 16;
// simdata->rpms = 100;
// for (int x = 0; x < numdevices; x++)
// {
// devices[x].update(&devices[x], simdata);
// }
// sleep(3);
//
// clilooper(devices, numdevices, p, simdata, simmap);
// }
// if (p->simon == true)
// {
// p->simon = false;
// fprintf(stdout, "Searching for sim data... Press q again to quit...\n");
// sleep(2);
// }
//
// if (poll(&mypoll, 1, 1000.0/update_rate) )
// {
// if (go != false )
// {
// scanf("%c", &ch);
// if(ch == 'q')
// {
// slogd("User application exit requested.");
// go = false;
// }
// }
// }
// }
//
// fprintf(stdout, "\n");
// fflush(stdout);
// tcsetattr(0, TCSANOW, &canonicalmode);
//
// int r = simfree(simdata, simmap, p->sim);
// slogd("simfree returned %i", r);
// free(simdata);
// free(simmap);
//
// return 0;
//}
int tester(SimDevice* devices, int numdevices)
{