File diff r23952:2d92a4a7c152 → r23953:ba75d2f3b530
src/network/network_udp.cpp
Show inline comments
 
@@ -195,14 +195,13 @@ void ServerNetworkUDPSocketHandler::Rece
 

	
 
		/* At this moment the company names might not fit in the
 
		 * packet. Check whether that is really the case. */
 

	
 
		for (;;) {
 
			int free = SEND_MTU - packet.size;
 
			Company *company;
 
			FOR_ALL_COMPANIES(company) {
 
			for (const Company *company : Company::Iterate()) {
 
				char company_name[NETWORK_COMPANY_NAME_LENGTH];
 
				SetDParam(0, company->index);
 
				GetString(company_name, STR_COMPANY_NAME, company_name + max_cname_length - 1);
 
				free -= MIN_CI_SIZE;
 
				free -= (int)strlen(company_name);
 
			}
 
@@ -211,15 +210,14 @@ void ServerNetworkUDPSocketHandler::Rece
 
			/* Try again, with slightly shorter strings. */
 
			assert(max_cname_length > 0);
 
			max_cname_length--;
 
		}
 
	}
 

	
 
	Company *company;
 
	/* Go through all the companies */
 
	FOR_ALL_COMPANIES(company) {
 
	for (const Company *company : Company::Iterate()) {
 
		/* Send the information */
 
		this->SendCompanyInformation(&packet, company, &company_stats[company->index], max_cname_length);
 
	}
 

	
 
	this->SendPacket(&packet, client_addr);
 
}