#include "Startup.h"
#include "CustomAssert.h"
#include "Curl/curl.h"
#include <thread>
#include <iostream>
[[noreturn]] void loop(){
    DebugPrintTID();
    while(true){
        std::cout.flush();
        std::this_thread::sleep_for(std::chrono::milliseconds(600));
    }
}
int main(int argc, char* argv[]) {
    DebugPrintTID();
    // curl needs to be initialized to properly deallocate its resources later
    Assert(curl_global_init(CURL_GLOBAL_DEFAULT) == CURLE_OK);
    #ifdef DEBUG
        std::thread t1(loop);
        t1.detach();
    #endif
    ConsoleInit();
    InitServer(argc,argv);
    InitConfig();
    InitLua();
    InitRes();
    HBInit();
    StatInit();
    NetMain();
    // clean up curl at the end to be sure
    curl_global_cleanup();
    return 0;
}
