update to 1.6.0

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2016-04-02 00:50:09 +03:00
parent fe10aa3cba
commit 5c9ef5a264
223 changed files with 4114 additions and 3049 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
/* $Id: vehicle.cpp 27270 2015-05-08 17:23:55Z frosch $ */
/* $Id: vehicle.cpp 27426 2015-10-30 17:24:05Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -1290,6 +1290,9 @@ void AgeVehicle(Vehicle *v)
* @param front The front vehicle of the consist to check.
* @param colour The string to show depending on if we are unloading or loading
* @return A percentage of how full the Vehicle is.
* Percentages are rounded towards 50%, so that 0% and 100% are only returned
* if the vehicle is completely empty or full.
* This is useful for both display and conditional orders.
*/
uint8 CalcPercentVehicleFilled(const Vehicle *front, StringID *colour)
{
@@ -1337,7 +1340,13 @@ uint8 CalcPercentVehicleFilled(const Vehicle *front, StringID *colour)
if (max == 0) return 100;
/* Return the percentage */
return (count * 100) / max;
if (count * 2 < max) {
/* Less than 50%; round up, so that 0% means really empty. */
return CeilDiv(count * 100, max);
} else {
/* More than 50%; round down, so that 100% means really full. */
return (count * 100) / max;
}
}
/**