From 99c97f75e2b93ea2cb36f126cd75b298bda5f5a9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 14 May 2006 16:47:52 +0000 Subject: Applied a patch by Guillaume that makes the server sleep between ticks instead of polling for the next one. Somebody will need to verify that this works for on Dev-C++ as well. --- src/main.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 22ac6a2..db594c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -319,7 +319,7 @@ void parseOptions(int argc, char *argv[]) int main(int argc, char *argv[]) { int elapsedWorldTicks; - + LOG_INFO("The Mana World Server v" << PACKAGE_VERSION, 0) // Parse Command Line Options @@ -402,11 +402,7 @@ int main(int argc, char *argv[]) // - Update all active objects/beings state.update(*connectionHandler); } - else { - // when there is nothing to do give away some processor time to - // other tasks - sched_yield(); - }; + worldTimer.sleep(); /*ENetEvent netEvent; @@ -442,13 +438,13 @@ int main(int argc, char *argv[]) enet_packet_destroy(netEvent.packet); } break; - + case ENET_EVENT_TYPE_DISCONNECT: printf("%s disconected.\n", netEvent.peer->data); netEvent.peer->data = NULL; break; - + default: printf("Unhandled enet event\n"); break; -- cgit