summaryrefslogtreecommitdiff
path: root/Ports/xash3d-fwgs/patches/0002-Engine-Keep-HTTP-from-endlessly-formatting-NaN-value.patch
blob: c3bfa0b5923eafd971d8ec59758258ae4fed685b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
Date: Mon, 2 May 2022 01:22:35 +0200
Subject: [PATCH] Engine: Keep HTTP from endlessly formatting NaN values

For whatever reason, our progress count for HTTP downloads stays at 0.
This results in the engine calculating a NaN progress value many times
each frame, which results in a significant performance hit.
---
 engine/common/net_ws.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c
index ef403b3..8b491ba 100644
--- a/engine/common/net_ws.c
+++ b/engine/common/net_ws.c
@@ -2280,7 +2280,7 @@ void HTTP_Run( void )
 	}
 
 	// update progress
-	if( !Host_IsDedicated() )
+	if( !Host_IsDedicated() && iProgressCount != 0 )
 		Cvar_SetValue( "scr_download", flProgress/iProgressCount * 100 );
 
 	HTTP_AutoClean();