summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-21 14:32:27 +0000
committerrubidium <rubidium@openttd.org>2007-06-21 14:32:27 +0000
commit0d8e82b7d742b54216bf6bc8a1d3b4eafe8124ab (patch)
tree4d9bfa9de886f7ff167c4fa02326f5cd302e8cce /src/vehicle_gui.cpp
parentc755fa43d08e5adaad87745769369ec8e5e59915 (diff)
downloadopenttd-0d8e82b7d742b54216bf6bc8a1d3b4eafe8124ab.tar.xz
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index fca73e38b..b9bd7bb31 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -589,7 +589,7 @@ static int CDECL VehicleProfitThisYearSorter(const void *a, const void *b)
{
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
- int r = va->profit_this_year - vb->profit_this_year;
+ int r = ClampToI32(va->profit_this_year - vb->profit_this_year);
VEHICLEUNITNUMBERSORTER(r, va, vb);
@@ -600,7 +600,7 @@ static int CDECL VehicleProfitLastYearSorter(const void *a, const void *b)
{
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
- int r = va->profit_last_year - vb->profit_last_year;
+ int r = ClampToI32(va->profit_last_year - vb->profit_last_year);
VEHICLEUNITNUMBERSORTER(r, va, vb);
@@ -687,13 +687,12 @@ static int CDECL VehicleValueSorter(const void *a, const void *b)
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
const Vehicle *u;
- int valuea = 0, valueb = 0;
- int r;
+ Money valuea = 0, valueb = 0;
for (u = va; u != NULL; u = u->next) valuea += u->value;
for (u = vb; u != NULL; u = u->next) valueb += u->value;
- r = valuea - valueb;
+ int r = ClampToI32(valuea - valueb);
VEHICLEUNITNUMBERSORTER(r, va, vb);