src/roadveh_cmd.cpp
changeset 10621 3edd349d9c14
parent 10556 ec733f5899fa
child 10703 2c998f3776d1
equal deleted inserted replaced
10619:73c3e4d60426 10621:3edd349d9c14
   278 		AddArticulatedParts(vl, VEH_ROAD);
   278 		AddArticulatedParts(vl, VEH_ROAD);
   279 
   279 
   280 		VehiclePositionChanged(v);
   280 		VehiclePositionChanged(v);
   281 
   281 
   282 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
   282 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
   283 		RebuildVehicleLists();
   283 		InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
   284 		InvalidateWindow(WC_COMPANY, v->owner);
   284 		InvalidateWindow(WC_COMPANY, v->owner);
   285 		if (IsLocalPlayer())
   285 		if (IsLocalPlayer())
   286 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
   286 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
   287 
   287 
   288 		GetPlayer(_current_player)->num_engines[p1]++;
   288 		GetPlayer(_current_player)->num_engines[p1]++;
   379 	CommandCost ret(EXPENSES_NEW_VEHICLES, -v->value);
   379 	CommandCost ret(EXPENSES_NEW_VEHICLES, -v->value);
   380 
   380 
   381 	if (flags & DC_EXEC) {
   381 	if (flags & DC_EXEC) {
   382 		// Invalidate depot
   382 		// Invalidate depot
   383 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   383 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   384 		RebuildVehicleLists();
   384 		InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
   385 		InvalidateWindow(WC_COMPANY, v->owner);
   385 		InvalidateWindow(WC_COMPANY, v->owner);
   386 		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   386 		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   387 		DeleteDepotHighlightOfVehicle(v);
   387 		DeleteDepotHighlightOfVehicle(v);
   388 		delete v;
   388 		delete v;
   389 	}
   389 	}
   572 	for (; v->Next() != NULL; v = v->Next()) u = v;
   572 	for (; v->Next() != NULL; v = v->Next()) u = v;
   573 	u->SetNext(NULL);
   573 	u->SetNext(NULL);
   574 
   574 
   575 	DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   575 	DeleteWindowById(WC_VEHICLE_VIEW, v->index);
   576 
   576 
   577 	RebuildVehicleLists();
   577 	InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
   578 	InvalidateWindow(WC_COMPANY, v->owner);
   578 	InvalidateWindow(WC_COMPANY, v->owner);
   579 
   579 
   580 	if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v);
   580 	if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v);
   581 
   581 
   582 	MarkSingleVehicleDirty(v);
   582 	MarkSingleVehicleDirty(v);
  2114 			v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
  2114 			v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
  2115 			v->cargo_type = new_cid;
  2115 			v->cargo_type = new_cid;
  2116 			v->cargo_subtype = new_subtype;
  2116 			v->cargo_subtype = new_subtype;
  2117 			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  2117 			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  2118 			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
  2118 			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
  2119 			RebuildVehicleLists();
  2119 			InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
  2120 		}
  2120 		}
  2121 
  2121 
  2122 		if (only_this) break;
  2122 		if (only_this) break;
  2123 	}
  2123 	}
  2124 
  2124