Add support for headless

This commit is contained in:
Bruno Rybársky 2024-08-31 22:48:36 +02:00
parent 0ba96ca478
commit 0a42b24f09

@ -159,14 +159,17 @@ var worldLock sync.Mutex
var totalRenderTime, totalGameLogicCatchUp, totalNormalGameLogic, totalTicking, totalScalingTime, totalRemotePlayerUpdate, tickCount, totalFrameTime, frameCount uint64 var totalRenderTime, totalGameLogicCatchUp, totalNormalGameLogic, totalTicking, totalScalingTime, totalRemotePlayerUpdate, tickCount, totalFrameTime, frameCount uint64
func main() { func main() {
initializeSDL()
defer sdl.Quit()
configX, err := loadOrCreateConfig("config.json") configX, err := loadOrCreateConfig("config.json")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
serverConfig = configX.ServerConfig serverConfig = configX.ServerConfig
config = configX config = configX
if !(config.Server && !config.DoKeymapPlayer && !config.DoJoyStickPlayers && !config.DoAllKeymapsPlayers && !config.MapWindow) {
initializeSDL()
defer sdl.Quit()
}
if config.ProfilerOn { if config.ProfilerOn {
f, err := os.Create("cpuprofile") f, err := os.Create("cpuprofile")
if err != nil { if err != nil {