summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2014-04-08 20:19:41 +0000
committerplanetmaker <planetmaker@openttd.org>2014-04-08 20:19:41 +0000
commit3e9c10f9e11935a82d33fd5c66592d795c279777 (patch)
treeb9c0e4a9e81a00c70865c0f7b8695c6bc8f17987 /src/video
parentbef953a32cd0a8bf3dad5cbbe2798dc3ab57ac5c (diff)
downloadopenttd-3e9c10f9e11935a82d33fd5c66592d795c279777.tar.xz
(svn r26449) -Add: Allow more sound sleep for dedicated servers when there's nothing to do and nobody paying attention
Diffstat (limited to 'src/video')
-rw-r--r--src/video/dedicated_v.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 8e5b9ea91..9be1b2d3c 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -316,7 +316,15 @@ void VideoDriver_Dedicated::MainLoop()
}
/* Don't sleep when fast forwarding (for desync debugging) */
- if (!_ddc_fastforward) CSleep(1);
+ if (!_ddc_fastforward) {
+ /* Sleep longer on a dedicated server, if the game is paused and no clients connected.
+ * That can allow the CPU to better use deep sleep states. */
+ if (_pause_mode != 0 && !HasClients()) {
+ CSleep(100);
+ } else {
+ CSleep(1);
+ }
+ }
}
}