2020-09-20 16:41:54 +00:00
|
|
|
#include "index.hpp"
|
2020-09-25 18:50:46 +00:00
|
|
|
#ifndef STANDALONE
|
2020-09-20 16:41:54 +00:00
|
|
|
#include "LocalUniverse.hpp"
|
2020-09-25 18:50:46 +00:00
|
|
|
#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);
|
2020-09-25 18:50:46 +00:00
|
|
|
#ifndef STANDALONE
|
|
|
|
} else if(localHandle != nullptr) {
|
2020-09-26 22:05:43 +00:00
|
|
|
LOG_D("Using local universe");
|
2020-09-25 18:50:46 +00:00
|
|
|
return std::make_unique<LocalUniverse>(localHandle);
|
|
|
|
#endif
|
2020-09-22 20:37:09 +00:00
|
|
|
} else {
|
2020-09-25 18:50:46 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|