Merge branch 'ticks' into develop
This commit is contained in:
@@ -52,3 +52,7 @@ WaypointManager* RoomData::GetWaypointMgr() {
|
||||
std::list<CharacterData*>* RoomData::GetCharacterList() {
|
||||
return &characterList;
|
||||
}
|
||||
|
||||
void RoomData::RunFrame() {
|
||||
//TODO: (1) EMPTY
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
+12
-1
@@ -193,11 +193,22 @@ void ServerApplication::Proc() {
|
||||
}
|
||||
|
||||
//"tick" the internals
|
||||
//...
|
||||
realTime = Clock::now();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user