Skip to content

Commit ade72c8

Browse files
committed
Fix integer overflow when loading time exceeds uint16 range
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11900 8aca7d54-2c30-db11-9de9-000461428c89
1 parent 50bc11d commit ade72c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/simutrans/descriptor/vehicle_desc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class vehicle_desc_t : public obj_desc_transport_related_t {
238238
bool can_follow_any() const { return trailer_count==0; }
239239

240240
uint16 get_capacity() const { return capacity; }
241-
uint16 get_loading_time() const { return loading_time; } // ms per full loading/unloading
241+
uint32 get_loading_time() const { return loading_time; } // ms per full loading/unloading
242242
uint32 get_weight() const { return weight; }
243243
uint32 get_power() const { return power; }
244244
sint64 get_running_cost() const { return running_cost; }

src/simutrans/simconvoi.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ void convoi_t::hat_gehalten(halthandle_t halt)
30363036
continue;
30373037
}
30383038

3039-
const uint32_t ms_for_full_load = v->get_desc()->get_loading_time();
3039+
const uint32 ms_for_full_load = v->get_desc()->get_loading_time();
30403040

30413041
uint32 min_loading_step_time = ms_for_full_load / v->get_cargo_max() + 1;
30423042
time = max(time, min_loading_step_time);

0 commit comments

Comments
 (0)