1
0
Fork 0
Univerxel/src/client/world/index.cpp

21 lines
724 B
C++
Raw Normal View History

2020-09-20 16:41:54 +00:00
#include "index.hpp"
#ifndef STANDALONE
2020-09-20 16:41:54 +00:00
#include "LocalUniverse.hpp"
#endif
2020-09-20 16:41:54 +00:00
#include "DistantUniverse.hpp"
2020-09-22 20:37:09 +00:00
#include "../../core/utils/logger.hpp"
2020-09-20 16:41:54 +00:00
namespace world::client {
2020-09-22 20:37:09 +00:00
std::unique_ptr<Universe> Load(const std::optional<Universe::connection>& ct, server_handle *const localHandle, const Universe::options &distOpts) {
if(ct.has_value()) {
return std::make_unique<DistantUniverse>(ct.value(), distOpts);
#ifndef STANDALONE
} else if(localHandle != nullptr) {
2020-09-26 22:05:43 +00:00
LOG_D("Using local universe");
return std::make_unique<LocalUniverse>(localHandle);
#endif
2020-09-22 20:37:09 +00:00
} else {
FATAL("Must enable server.allow_local or define client.connection");
2020-09-22 20:37:09 +00:00
}
2020-09-20 16:41:54 +00:00
}
}