src/aircraft_cmd.cpp
branchnoai
changeset 10645 8cbdb511a674
parent 10455 22c441f5adf9
child 10715 6bdf79ffb022
equal deleted inserted replaced
10644:6c4314786d68 10645:8cbdb511a674
   445 			u->SetNext(w);
   445 			u->SetNext(w);
   446 			VehiclePositionChanged(w);
   446 			VehiclePositionChanged(w);
   447 		}
   447 		}
   448 
   448 
   449 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
   449 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
   450 		RebuildVehicleLists();
   450 		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
   451 		InvalidateWindow(WC_COMPANY, v->owner);
   451 		InvalidateWindow(WC_COMPANY, v->owner);
   452 		if (IsLocalPlayer())
   452 		if (IsLocalPlayer())
   453 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); //updates the replace Aircraft window
   453 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); //updates the replace Aircraft window
   454 
   454 
   455 		GetPlayer(_current_player)->num_engines[p1]++;
   455 		GetPlayer(_current_player)->num_engines[p1]++;
   460 
   460 
   461 
   461 
   462 static void DoDeleteAircraft(Vehicle *v)
   462 static void DoDeleteAircraft(Vehicle *v)
   463 {
   463 {
   464 	DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   464 	DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   465 	RebuildVehicleLists();
       
   466 	InvalidateWindow(WC_COMPANY, v->owner);
   465 	InvalidateWindow(WC_COMPANY, v->owner);
   467 	DeleteDepotHighlightOfVehicle(v);
   466 	DeleteDepotHighlightOfVehicle(v);
   468 	DeleteVehicleChain(v);
   467 	DeleteVehicleChain(v);
   469 	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
   468 	InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
   470 }
   469 }
   471 
   470 
   472 /** Sell an aircraft.
   471 /** Sell an aircraft.
   473  * @param tile unused
   472  * @param tile unused
   474  * @param flags for command type
   473  * @param flags for command type
   655 		u->cargo.Truncate(v->cargo_type == new_cid ? mail : 0);
   654 		u->cargo.Truncate(v->cargo_type == new_cid ? mail : 0);
   656 		v->cargo_type = new_cid;
   655 		v->cargo_type = new_cid;
   657 		v->cargo_subtype = new_subtype;
   656 		v->cargo_subtype = new_subtype;
   658 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   657 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   659 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   658 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   660 		RebuildVehicleLists();
   659 		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
   661 	}
   660 	}
   662 
   661 
   663 	return cost;
   662 	return cost;
   664 }
   663 }
   665 
   664 
  1402 
  1401 
  1403 	AI_Event(v->owner, new AIEventVehicleCrash(v->index, v->tile));
  1402 	AI_Event(v->owner, new AIEventVehicleCrash(v->index, v->tile));
  1404 
  1403 
  1405 	SetDParam(1, st->index);
  1404 	SetDParam(1, st->index);
  1406 	AddNewsItem(newsitem,
  1405 	AddNewsItem(newsitem,
  1407 		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
  1406 		NS_ACCIDENT_VEHICLE,
  1408 		v->index,
  1407 		v->index,
  1409 		0);
  1408 		0);
  1410 
  1409 
  1411 	SndPlayVehicleFx(SND_12_EXPLOSION, v);
  1410 	SndPlayVehicleFx(SND_12_EXPLOSION, v);
  1412 }
  1411 }
  1447 		st->had_vehicle_of_type |= HVOT_AIRCRAFT;
  1446 		st->had_vehicle_of_type |= HVOT_AIRCRAFT;
  1448 		SetDParam(0, st->index);
  1447 		SetDParam(0, st->index);
  1449 		/* show newsitem of celebrating citizens */
  1448 		/* show newsitem of celebrating citizens */
  1450 		AddNewsItem(
  1449 		AddNewsItem(
  1451 			STR_A033_CITIZENS_CELEBRATE_FIRST,
  1450 			STR_A033_CITIZENS_CELEBRATE_FIRST,
  1452 			NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
  1451 			(v->owner == _local_player) ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
  1453 			v->index,
  1452 			v->index,
  1454 			0);
  1453 			0);
  1455 	}
  1454 	}
  1456 
  1455 
  1457 	v->BeginLoading();
  1456 	v->BeginLoading();