summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-05 14:32:13 +0000
committerrubidium <rubidium@openttd.org>2010-12-05 14:32:13 +0000
commit98df56d0323be9bd3302d252008977cc540522e4 (patch)
tree2ab4c05c613339885acd319b40f7ec069fec05cf /src/network
parent77cb1b7e06edc8722cbe304d8ec624420d06017e (diff)
downloadopenttd-98df56d0323be9bd3302d252008977cc540522e4.tar.xz
(svn r21390) -Codechange: prepare the network join progress bar for getting the file size later in the download process, i.e. when a chunk of the savegame is already received by the client
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_gui.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 7c4914aa7..6ec2f7b38 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -2177,7 +2177,11 @@ struct NetworkJoinStatusWindow : Window {
case NETWORK_JOIN_STATUS_DOWNLOADING:
SetDParam(0, _network_join_bytes);
SetDParam(1, _network_join_bytes_total);
- DrawString(r.left + 2, r.right - 2, r.top + 20 + FONT_HEIGHT_NORMAL, STR_NETWORK_CONNECTING_DOWNLOADING, TC_FROMSTRING, SA_HOR_CENTER);
+ DrawString(r.left + 2, r.right - 2, r.top + 20 + FONT_HEIGHT_NORMAL, _network_join_bytes_total == 0 ? STR_NETWORK_CONNECTING_DOWNLOADING_1 : STR_NETWORK_CONNECTING_DOWNLOADING_2, TC_FROMSTRING, SA_HOR_CENTER);
+ if (_network_join_bytes_total == 0) {
+ progress = 15; // We don't have the final size yet; the server is still compressing!
+ break;
+ }
/* FALL THROUGH */
default: // Waiting is 15%, so the resting receivement of map is maximum 70%
progress = 15 + _network_join_bytes * (100 - 15) / _network_join_bytes_total;
@@ -2206,7 +2210,8 @@ struct NetworkJoinStatusWindow : Window {
/* Account for downloading ~ 10 MiB */
SetDParam(0, 10000000);
SetDParam(1, 10000000);
- width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING).width);
+ width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width);
+ width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width);
/* Give a bit more clearing for the widest strings than strictly needed */
size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10;