summaryrefslogtreecommitdiffhomepage
path: root/Starserver
diff options
context:
space:
mode:
Diffstat (limited to 'Starserver')
-rw-r--r--Starserver/CMakeLists.txt14
-rw-r--r--Starserver/Main.cpp40
2 files changed, 54 insertions, 0 deletions
diff --git a/Starserver/CMakeLists.txt b/Starserver/CMakeLists.txt
new file mode 100644
index 0000000..3142ce2
--- /dev/null
+++ b/Starserver/CMakeLists.txt
@@ -0,0 +1,14 @@
+project(Starserver)
+add_executable(
+ Starserver
+ Main.cpp
+ )
+target_include_directories(
+ Starserver
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+target_link_libraries(
+ Starserver
+ PRIVATE StarsEx
+ )
+install(TARGETS Starserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
diff --git a/Starserver/Main.cpp b/Starserver/Main.cpp
new file mode 100644
index 0000000..0063060
--- /dev/null
+++ b/Starserver/Main.cpp
@@ -0,0 +1,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;
+}