roadveh_cmd.c
changeset 4656 acffecd6f484
parent 4574 497540b4a75f
child 4712 273ec3b182bf
equal deleted inserted replaced
4655:0783c829014a 4656:acffecd6f484
    24 #include "tunnel_map.h"
    24 #include "tunnel_map.h"
    25 #include "vehicle_gui.h"
    25 #include "vehicle_gui.h"
    26 #include "newgrf_callbacks.h"
    26 #include "newgrf_callbacks.h"
    27 #include "newgrf_engine.h"
    27 #include "newgrf_engine.h"
    28 #include "newgrf_text.h"
    28 #include "newgrf_text.h"
       
    29 #include "newgrf_sound.h"
    29 #include "yapf/yapf.h"
    30 #include "yapf/yapf.h"
    30 #include "date.h"
    31 #include "date.h"
    31 
    32 
    32 static const uint16 _roadveh_images[63] = {
    33 static const uint16 _roadveh_images[63] = {
    33 	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
    34 	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
   619 			v->breakdowns_since_last_service++;
   620 			v->breakdowns_since_last_service++;
   620 
   621 
   621 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
   622 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
   622 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   623 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   623 
   624 
   624 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
   625 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
   625 			SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
   626 			SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
       
   627 				SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
       
   628 		}
   626 
   629 
   627 		if (!(v->vehstatus & VS_HIDDEN)) {
   630 		if (!(v->vehstatus & VS_HIDDEN)) {
   628 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
   631 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
   629 			if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
   632 			if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
   630 		}
   633 		}
   758 	InvalidateVehicleOrder(v);
   761 	InvalidateVehicleOrder(v);
   759 }
   762 }
   760 
   763 
   761 static void StartRoadVehSound(const Vehicle* v)
   764 static void StartRoadVehSound(const Vehicle* v)
   762 {
   765 {
   763 	SoundFx s = RoadVehInfo(v->engine_type)->sfx;
   766 	if (!PlayVehicleSound(v, VSE_START)) {
   764 	if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0)
   767 		SoundFx s = RoadVehInfo(v->engine_type)->sfx;
   765 		s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN;
   768 		if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0)
   766 	SndPlayVehicleFx(s, v);
   769 			s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN;
       
   770 		SndPlayVehicleFx(s, v);
       
   771 	}
   767 }
   772 }
   768 
   773 
   769 typedef struct RoadVehFindData {
   774 typedef struct RoadVehFindData {
   770 	int x;
   775 	int x;
   771 	int y;
   776 	int y;