ship_cmd.c
changeset 4656 9c1d8c4d3e60
parent 4574 61a17f80cfb9
child 4712 4335ad42e163
equal deleted inserted replaced
4655:2af9a0c4cec2 4656:9c1d8c4d3e60
    23 #include "water_map.h"
    23 #include "water_map.h"
    24 #include "yapf/yapf.h"
    24 #include "yapf/yapf.h"
    25 #include "debug.h"
    25 #include "debug.h"
    26 #include "newgrf_callbacks.h"
    26 #include "newgrf_callbacks.h"
    27 #include "newgrf_text.h"
    27 #include "newgrf_text.h"
       
    28 #include "newgrf_sound.h"
    28 #include "date.h"
    29 #include "date.h"
    29 
    30 
    30 static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
    31 static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
    31 static const byte _ship_sometracks[4] = {0x19, 0x16, 0x25, 0x2A};
    32 static const byte _ship_sometracks[4] = {0x19, 0x16, 0x25, 0x2A};
    32 
    33 
   171 			v->breakdowns_since_last_service++;
   172 			v->breakdowns_since_last_service++;
   172 
   173 
   173 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
   174 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
   174 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   175 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   175 
   176 
   176 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
   177 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
   177 			SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
   178 			SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
       
   179 				SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
       
   180 		}
   178 
   181 
   179 		if (!(v->vehstatus & VS_HIDDEN)) {
   182 		if (!(v->vehstatus & VS_HIDDEN)) {
   180 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
   183 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
   181 			if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
   184 			if (u != NULL) u->u.special.unk0 = v->breakdown_delay * 2;
   182 		}
   185 		}
   196 	MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
   199 	MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
   197 }
   200 }
   198 
   201 
   199 static void PlayShipSound(Vehicle *v)
   202 static void PlayShipSound(Vehicle *v)
   200 {
   203 {
   201 	SndPlayVehicleFx(ShipVehInfo(v->engine_type)->sfx, v);
   204 	if (!PlayVehicleSound(v, VSE_START)) {
       
   205 		SndPlayVehicleFx(ShipVehInfo(v->engine_type)->sfx, v);
       
   206 	}
   202 }
   207 }
   203 
   208 
   204 static void ProcessShipOrder(Vehicle *v)
   209 static void ProcessShipOrder(Vehicle *v)
   205 {
   210 {
   206 	const Order *order;
   211 	const Order *order;