summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-05-22 11:30:25 +0000
committerfrosch <frosch@openttd.org>2016-05-22 11:30:25 +0000
commitcade383f9b0eaf17bf6c3e05a3470c4f53039d0d (patch)
treeb2d10f74fd6e7f19653b1c13368ed9efd8db4de1 /src
parentebb6e3807520cac80abac5441eb66403bd97c104 (diff)
downloadopenttd-cade383f9b0eaf17bf6c3e05a3470c4f53039d0d.tar.xz
(svn r27579) -Change [FS#6402]: Performance improvement for dedicated servers by skipping drawing calls earlier in the process. (JGR)
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_base.h4
-rw-r--r--src/window.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 59584da78..f923c2d79 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -23,6 +23,7 @@
#include "transport_type.h"
#include "group_type.h"
#include "base_consist.h"
+#include "network/network.h"
#include <list>
#include <map>
@@ -1072,6 +1073,9 @@ struct SpecializedVehicle : public Vehicle {
*/
inline void UpdateViewport(bool force_update, bool update_delta)
{
+ /* Skip updating sprites on dedicated servers without screen */
+ if (_network_dedicated) return;
+
/* Explicitly choose method to call to prevent vtable dereference -
* it gives ~3% runtime improvements in games with many vehicles */
if (update_delta) ((T *)this)->T::UpdateDeltaXY(this->direction);
diff --git a/src/window.cpp b/src/window.cpp
index 1fce1f3a8..bc92416b6 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3031,6 +3031,10 @@ void UpdateWindows()
w->ProcessHighlightedInvalidations();
}
+ /* Skip the actual drawing on dedicated servers without screen.
+ * But still empty the invalidation queues above. */
+ if (_network_dedicated) return;
+
static int we4_timer = 0;
int t = we4_timer + 1;