-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
40 lines (33 loc) · 1.06 KB
/
main.cpp
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
#include "src/server.hpp"
#include "src/client.hpp"
#include "src/configuration.hpp"
#include <iostream>
#include <cstring> // std::strcmp
int main(int argc, char** argv) {
std::cout << "Args: " << argc << std::endl;
for (int i = 0; i < argc; i++) {
std::cout << i << ' ' << argv[i] << std::endl;
}
std::cout << std::endl;
// todo 20190419nitzel Forward to and use the settings in the game etc, to replace the #defines in
CConfiguration config("settings.ini");
std::cout << "Config=" << config << std::endl;
// no args: ask user for client/server
if (argc == 1) {
// ask user
char clientOrServer;
std::cout << "Client(c) or Server(anything else): ";
std::cin >> clientOrServer;
switch (clientOrServer) {
case 'c':
return client(config);
default:
return server(config);
}
}
// arg -s to start a server, otherwise client
if (!std::strcmp(argv[1], "-s")) {
return server(config);
}
return client(config);
}