Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include <iostream>
2
3#include "core/Args.hpp"
4#include "core/Server.hpp"
5
6int main(int argc, char** argv)
7{
8 Args args(argc, argv);
9 if (!args.isValid() || args.isHelpRequested()) return args.exitCode();
10
11 try {
12 Server server(args.getConfig());
13 server.run();
14 } catch (const std::exception& e) {
15 std::cerr << "Fatal: " << e.what() << "\n";
16 return 1;
17 }
18 return 0;
19}
Definition Args.hpp:43
int exitCode() const
Gets the exit code for the application.
Definition Args.cpp:93
ServerConfig getConfig() const
Gets the configuration for the server application.
Definition Args.cpp:91
bool isHelpRequested() const
Checks if the help flag was provided in the arguments.
Definition Args.cpp:90
bool isValid() const
Checks if the parsed arguments are valid and if the application should run.
Definition Args.cpp:89
Owns every subsystem and runs the main game loop.
Definition Server.hpp:20
void run()
Run the game loop until the process is stopped.
Definition Server.cpp:98
int main(int argc, char **argv)
Definition main.cpp:6