Japanese Simutrans Forum

日本語simutransフォーラム => バグレポート => 解決されたバグ => トピック開設者: z9999+ さんの発言 2010/07/18 21:47

トピック名: [102.2.2] 車庫ウィンドウでクラッシュする
投稿者: z9999+ さんの発言 2010/07/18 21:47
車庫ウィンドウで編成に動力車が含まれていない場合にクラッシュします。

コード: [選択]
Index: gui/depot_frame.cc
===================================================================
--- gui/depot_frame.cc (リビジョン 3540)
+++ gui/depot_frame.cc (作業コピー)
@@ -1083,8 +1083,8 @@
  total_max_weight += (max_weight*besch->get_zuladung()+499)/1000;
  total_min_weight += (min_weight*besch->get_zuladung()+499)/1000;
  }
- max_speed = min(speed_to_kmh(cnv->get_min_top_speed()), (uint32) sqrt((((double)total_power/total_min_weight)-1)*2500));
- min_speed = min(speed_to_kmh(cnv->get_min_top_speed()), (uint32) sqrt((((double)total_power/total_max_weight)-1)*2500));
+ max_speed = total_power==0 ? 0 : min(speed_to_kmh(cnv->get_min_top_speed()), (uint32) sqrt((((double)total_power/total_min_weight)-1)*2500));
+ min_speed = total_power==0 ? 0 : min(speed_to_kmh(cnv->get_min_top_speed()), (uint32) sqrt((((double)total_power/total_max_weight)-1)*2500));
  sprintf(txt_convoi_count, "%s %d (%s %i)",
  translator::translate("Fahrzeuge:"), cnv->get_vehikel_anzahl(),
  translator::translate("Station tiles:"), cnv->get_tile_length() );