Reconsidering the server's structure

This commit is contained in:
Kayne Ruse
2015-02-17 21:03:19 +11:00
parent 2cc7260552
commit 248d142c2b
3 changed files with 20 additions and 3 deletions
+4
View File
@@ -52,3 +52,7 @@ WaypointManager* RoomData::GetWaypointMgr() {
std::list<CharacterData*>* RoomData::GetCharacterList() {
return &characterList;
}
void RoomData::RunFrame() {
//TODO: (1) EMPTY
}
+2
View File
@@ -49,6 +49,8 @@ public:
WaypointManager* GetWaypointMgr();
std::list<CharacterData*>* GetCharacterList();
void RunFrame();
//TODO: triggers for unload, save, per-second, player enter, player exit, etc.
private:
+14 -3
View File
@@ -193,10 +193,21 @@ void ServerApplication::Proc() {
}
//"tick" the internals
//...
realTime = Clock::now();
//give the machine a break
SDL_Delay(10);
if (simTime < realTime) {
while(simTime < realTime) {
for (auto& it : *roomMgr.GetContainer()) {
it.second.RunFrame();
}
//~60 FPS
simTime += std::chrono::duration<int, std::milli>(16);
}
}
else {
//give the machine a break
SDL_Delay(10);
}
}
delete reinterpret_cast<char*>(packetBuffer);
}