News:

Want to praise Simutrans?
Your feedback is important for us ;D.

all trailers removed from convoy in depot when trailer setting is "any"

Started by poppo, August 04, 2026, 02:55:43 AM

Previous topic - Next topic

0 Members and 9 Guests are viewing this topic.

poppo

In tool_change_depot_t's case 'r' or 'R', searching the removable vehicles from convoy with using get_trailer_count().
But, when trailer setting is "any", which can couple not only one vehicle but almost all vehicles, trailer count is 1 and remove this vehicle from convoy.

Before
//bool tool_change_depot_t::init()
// find end
while(nr<cnv->get_vehicle_count()) {
const vehicle_desc_t *info = cnv->get_vehicle(nr)->get_desc();
nr ++;
if(info->get_trailer_count()!=1) {
break;
}

After
// find end
while(nr<cnv->get_vehicle_count()) {
const vehicle_desc_t *info = cnv->get_vehikel(nr)->get_desc();
nr ++;
if(info->get_trailer_count()==1) {
vehicle_desc_t const* const veh = info->get_trailer(0);
// the leading is any, we should keep it.
if(  veh!=vehicle_desc_t::any_vehicle  ) {
break;
}
}
else {
break;
}

}

poppo

I found that we also need to fix depot_frame_t::image_from_convoi_list()

poppo

I check that:
we need to update them:
  • simtool.cc, l8461 in bool tool_change_depot_t::init(),
  • depot_frame_t.cc, l1116 in void depot_frame_t::image_from_convoi_list().
the changing method:
- if(info->get_trailer_count!=1)
+ if(info->get_trailer_count!=1 || info->get_trailer(0)!=vehicle_desc_t::any_vehicle)