summaryrefslogtreecommitdiffhomepage
path: root/Starserver
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-01 22:37:49 +0200
committerAki <please@ignore.pl>2022-04-01 22:41:20 +0200
commitc2199769d8f0d2b213db6f6f4349e9ebbfa0a111 (patch)
tree8ea8b24e1717a21f4821bf920c8bb31d6747491a /Starserver
parent3f320f31fc4f9e90302bd62208a52bfd8d3fd7c2 (diff)
downloadstarshatter-c2199769d8f0d2b213db6f6f4349e9ebbfa0a111.zip
starshatter-c2199769d8f0d2b213db6f6f4349e9ebbfa0a111.tar.gz
starshatter-c2199769d8f0d2b213db6f6f4349e9ebbfa0a111.tar.bz2
Created a stand-alone server executable
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;
+}