src/train_cmd.cpp
changeset 8035 a0200ced6d9f
parent 8025 39c5dc3c2b4a
child 8047 bcc7782ef238
equal deleted inserted replaced
8034:0f6a176ce1e9 8035:a0200ced6d9f
    93 			total_power += RailVehInfo(u->u.rail.first_engine)->pow_wag_power;
    93 			total_power += RailVehInfo(u->u.rail.first_engine)->pow_wag_power;
    94 		}
    94 		}
    95 	}
    95 	}
    96 
    96 
    97 	if (v->u.rail.cached_power != total_power || v->u.rail.cached_max_te != max_te) {
    97 	if (v->u.rail.cached_power != total_power || v->u.rail.cached_max_te != max_te) {
       
    98 		/* If it has no power (no catenary), stop the train */
       
    99 		if (total_power == 0) v->vehstatus |= VS_STOPPED;
       
   100 
    98 		v->u.rail.cached_power = total_power;
   101 		v->u.rail.cached_power = total_power;
    99 		v->u.rail.cached_max_te = max_te;
   102 		v->u.rail.cached_max_te = max_te;
   100 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   103 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   101 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
   104 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
   102 	}
   105 	}