Changeset - r16649:132186a763f6
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-12-05 14:32:13
rubidium@openttd.org
(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
2 files changed with 9 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1691,13 +1691,14 @@ STR_NETWORK_CONNECTING_5                
 
STR_NETWORK_CONNECTING_6                                        :{BLACK}(6/6) Registering..
 

	
 
STR_NETWORK_CONNECTING_SPECIAL_1                                :{BLACK}Fetching game info..
 
STR_NETWORK_CONNECTING_SPECIAL_2                                :{BLACK}Fetching company info..
 
############ End of leave-in-this-order
 
STR_NETWORK_CONNECTING_WAITING                                  :{BLACK}{NUM} client{P "" s} in front of you
 
STR_NETWORK_CONNECTING_DOWNLOADING                              :{BLACK}{BYTES} / {BYTES} downloaded so far
 
STR_NETWORK_CONNECTING_DOWNLOADING_1                            :{BLACK}{BYTES} downloaded so far
 
STR_NETWORK_CONNECTING_DOWNLOADING_2                            :{BLACK}{BYTES} / {BYTES} downloaded so far
 

	
 
STR_NETWORK_CONNECTION_DISCONNECT                               :{BLACK}Disconnect
 

	
 
STR_NETWORK_NEED_GAME_PASSWORD_CAPTION                          :{WHITE}Server is protected. Enter password
 
STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION                       :{WHITE}Company is protected. Enter password
 

	
src/network/network_gui.cpp
Show inline comments
 
@@ -2174,13 +2174,17 @@ struct NetworkJoinStatusWindow : Window 
 
				DrawString(r.left + 2, r.right - 2, r.top + 20 + FONT_HEIGHT_NORMAL, STR_NETWORK_CONNECTING_WAITING, TC_FROMSTRING, SA_HOR_CENTER);
 
				progress = 15; // third stage is 15%
 
				break;
 
			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;
 
		}
 

	
 
		/* Draw nice progress bar :) */
 
@@ -2203,13 +2207,14 @@ struct NetworkJoinStatusWindow : Window 
 
		SetDParam(0, 255);
 
		width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width);
 

	
 
		/* 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;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
0 comments (0 inline, 0 general)