summaryrefslogtreecommitdiffhomepage
path: root/Starserver/Main.cpp
blob: 43a567e39397c10e21a310a2c2698e58218336ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.
*/

#include <InfoEx.h>
#include <NetLayer.h>
#include <Panic.h>
#include <starshatter/definition.h>
#include <Utils.h>
#include <VersionInfo.h>

#include "StarServer.h"


int dump_missions = 0;


int
main(int, char*[])
{
    AssignErrLog(fopen("serverlog.txt", "wb"));
    Print("Starserver %s\n", versionInfo);
    Print("%s\n\n", InfoEx::LongDescription().data());
    int result = 1;
    try {
        NetLayer net;
        StarServer server;
        if (server.Init())
            result = server.Run();
    }
    catch (const char* err) {
        Print("Exception: %s\n", err);
    }
    Token::close();
    if (Panic::Panicked()) {
        Print("PANIC: %s\n", Panic::Message());
        result = 1;
    }
    CloseErrLog();
    return result;
}