Reconsidering the server's structure
This commit is contained in:
@@ -52,3 +52,7 @@ WaypointManager* RoomData::GetWaypointMgr() {
|
|||||||
std::list<CharacterData*>* RoomData::GetCharacterList() {
|
std::list<CharacterData*>* RoomData::GetCharacterList() {
|
||||||
return &characterList;
|
return &characterList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RoomData::RunFrame() {
|
||||||
|
//TODO: (1) EMPTY
|
||||||
|
}
|
||||||
@@ -49,6 +49,8 @@ public:
|
|||||||
WaypointManager* GetWaypointMgr();
|
WaypointManager* GetWaypointMgr();
|
||||||
std::list<CharacterData*>* GetCharacterList();
|
std::list<CharacterData*>* GetCharacterList();
|
||||||
|
|
||||||
|
void RunFrame();
|
||||||
|
|
||||||
//TODO: triggers for unload, save, per-second, player enter, player exit, etc.
|
//TODO: triggers for unload, save, per-second, player enter, player exit, etc.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+14
-3
@@ -193,10 +193,21 @@ void ServerApplication::Proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//"tick" the internals
|
//"tick" the internals
|
||||||
//...
|
realTime = Clock::now();
|
||||||
|
|
||||||
//give the machine a break
|
if (simTime < realTime) {
|
||||||
SDL_Delay(10);
|
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);
|
delete reinterpret_cast<char*>(packetBuffer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user