Initial commit.
This commit is contained in:
commit
74c23c0ad5
57 changed files with 3491 additions and 0 deletions
37
Server/Server.cpp
Normal file
37
Server/Server.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "Server.h"
|
||||
#include "Network.h"
|
||||
#include "World/WorldManager.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
void Server::init() {
|
||||
for (auto & system : subsystems) {
|
||||
system->init();
|
||||
system->reload();
|
||||
}
|
||||
}
|
||||
|
||||
void Server::tick() {
|
||||
for (auto & system : subsystems) {
|
||||
system->tick();
|
||||
}
|
||||
}
|
||||
|
||||
void Server::run() {
|
||||
init();
|
||||
|
||||
auto time = std::chrono::steady_clock::now();
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
if (time - now > std::chrono::milliseconds(50)) {
|
||||
tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Server::addDefaultSubsystems() {
|
||||
addSubsystem<ServerNetwork>();
|
||||
addSubsystem<WorldManager>();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue