summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-01-23 14:58:54 +0000
committerfrosch <frosch@openttd.org>2011-01-23 14:58:54 +0000
commit9a1c0f139aeafd3ff550d0689e3a4c227927f0e5 (patch)
tree45c8b5f0450ca60560286502972b4c507494a0a5 /src/vehicle_gui.cpp
parent3f103c35a6af62993cc01d53d9fd4554f353bf60 (diff)
downloadopenttd-9a1c0f139aeafd3ff550d0689e3a4c227927f0e5.tar.xz
(svn r21902) -Fix: Do not count articulated parts when passing the number of vehicles to refit to the command. That may exceed 8 bits.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5bd5f18ef..9c94fea4b 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -758,9 +758,14 @@ struct RefitWindow : public Window {
if (left_x < 0 && !start_counting) {
this->selected_vehicle = u->index;
start_counting = true;
+
+ /* Count the first vehicle, even if articulated part */
+ this->num_vehicles++;
+ } else if (start_counting && !u->IsArticulatedPart()) {
+ /* Do not count articulated parts */
+ this->num_vehicles++;
}
- if (start_counting) this->num_vehicles++;
if (right_x < 0) break;
}
}