summaryrefslogtreecommitdiffhomepage
path: root/Starserver/Main.cpp
blob: 00630602c68169798f32f5c64679b324ad39d08c (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
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.
*/

#include "MachineInfo.h"
#include "NetLayer.h"
#include "Panic.h"
#include "StarServer.h"
#include "Token.h"
#include "Utils.h"


int dump_missions = 0;


int
main(int argc, char * argv[])
{
    AssignErrLog(fopen("serverlog.txt", "wb"));
    MachineInfo::DescribeMachine();
    int result = 1;
    try {
        NetLayer net;
        StarServer server;
        if (server.Init(nullptr, nullptr, nullptr, 0))
            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;
}