src/train_cmd.cpp
changeset 9046 ed21d7485650
parent 9006 f68ac871be5c
child 9047 4dce11366b62
equal deleted inserted replaced
9045:fb5d8378b111 9046:ed21d7485650
  2200 	} while ((v = v->Next()) != NULL);
  2200 	} while ((v = v->Next()) != NULL);
  2201 
  2201 
  2202 	if (sound) PlayVehicleSound(u, VSE_TRAIN_EFFECT);
  2202 	if (sound) PlayVehicleSound(u, VSE_TRAIN_EFFECT);
  2203 }
  2203 }
  2204 
  2204 
  2205 static void TrainPlayLeaveStationSound(const Vehicle* v)
  2205 void Train::PlayLeaveStationSound() const
  2206 {
  2206 {
  2207 	static const SoundFx sfx[] = {
  2207 	static const SoundFx sfx[] = {
  2208 		SND_04_TRAIN,
  2208 		SND_04_TRAIN,
  2209 		SND_0A_TRAIN_HORN,
  2209 		SND_0A_TRAIN_HORN,
  2210 		SND_0A_TRAIN_HORN,
  2210 		SND_0A_TRAIN_HORN,
  2211 		SND_47_MAGLEV_2,
  2211 		SND_47_MAGLEV_2,
  2212 		SND_41_MAGLEV
  2212 		SND_41_MAGLEV
  2213 	};
  2213 	};
  2214 
  2214 
  2215 	if (PlayVehicleSound(v, VSE_START)) return;
  2215 	if (PlayVehicleSound(this, VSE_START)) return;
  2216 
  2216 
  2217 	EngineID engtype = v->engine_type;
  2217 	EngineID engtype = this->engine_type;
  2218 	SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], v);
  2218 	SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], this);
  2219 }
       
  2220 
       
  2221 void Train::PlayLeaveStationSound() const
       
  2222 {
       
  2223 	TrainPlayLeaveStationSound(this);
       
  2224 }
  2219 }
  2225 
  2220 
  2226 static bool CheckTrainStayInDepot(Vehicle *v)
  2221 static bool CheckTrainStayInDepot(Vehicle *v)
  2227 {
  2222 {
  2228 	/* bail out if not all wagons are in the same depot or not in a depot at all */
  2223 	/* bail out if not all wagons are in the same depot or not in a depot at all */
  2251 		}
  2246 		}
  2252 	}
  2247 	}
  2253 
  2248 
  2254 	VehicleServiceInDepot(v);
  2249 	VehicleServiceInDepot(v);
  2255 	InvalidateWindowClasses(WC_TRAINS_LIST);
  2250 	InvalidateWindowClasses(WC_TRAINS_LIST);
  2256 	TrainPlayLeaveStationSound(v);
  2251 	v->PlayLeaveStationSound();
  2257 
  2252 
  2258 	v->u.rail.track = TRACK_BIT_X;
  2253 	v->u.rail.track = TRACK_BIT_X;
  2259 	if (v->direction & 2) v->u.rail.track = TRACK_BIT_Y;
  2254 	if (v->direction & 2) v->u.rail.track = TRACK_BIT_Y;
  2260 
  2255 
  2261 	v->vehstatus &= ~VS_HIDDEN;
  2256 	v->vehstatus &= ~VS_HIDDEN;