Update some things.
This commit is contained in:
parent
f215bc3742
commit
4ad41f2e2e
34 changed files with 573 additions and 905 deletions
|
|
@ -1,14 +1,37 @@
|
|||
#include "Server.h"
|
||||
#include "Network/Network.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<NetworkServer>();
|
||||
addSubsystem<ServerNetwork>();
|
||||
addSubsystem<WorldManager>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue