src/aircraft_cmd.cpp
changeset 9052 392f5995d323
parent 9030 23b6734d71dd
child 9062 cfef22f7dd66
equal deleted inserted replaced
9051:0becfc1d0c09 9052:392f5995d323
   319 		v->y_pos = u->y_pos = y;
   319 		v->y_pos = u->y_pos = y;
   320 
   320 
   321 		u->z_pos = GetSlopeZ(x, y);
   321 		u->z_pos = GetSlopeZ(x, y);
   322 		v->z_pos = u->z_pos + 1;
   322 		v->z_pos = u->z_pos + 1;
   323 
   323 
       
   324 		v->running_ticks = 0;
       
   325 
   324 //		u->delta_x = u->delta_y = 0;
   326 //		u->delta_x = u->delta_y = 0;
   325 
   327 
   326 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
   328 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
   327 		u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_SHADOW;
   329 		u->vehstatus = VS_HIDDEN | VS_UNCLICKABLE | VS_SHADOW;
   328 
   330 
   733 
   735 
   734 	CheckVehicleBreakdown(this);
   736 	CheckVehicleBreakdown(this);
   735 	AgeVehicle(this);
   737 	AgeVehicle(this);
   736 	CheckIfAircraftNeedsService(this);
   738 	CheckIfAircraftNeedsService(this);
   737 
   739 
   738 	if (this->vehstatus & VS_STOPPED) return;
   740 	if (this->running_ticks == 0) return;
   739 
   741 
   740 	CommandCost cost = CommandCost(EXPENSES_AIRCRAFT_RUN, GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running / 364);
   742 	CommandCost cost(EXPENSES_AIRCRAFT_RUN, GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running * this->running_ticks / (364 * DAY_TICKS));
   741 
   743 
   742 	this->profit_this_year -= cost.GetCost() >> 8;
   744 	this->profit_this_year -= cost.GetCost();
       
   745 	this->running_ticks = 0;
   743 
   746 
   744 	SubtractMoneyFromPlayerFract(this->owner, cost);
   747 	SubtractMoneyFromPlayerFract(this->owner, cost);
   745 
   748 
   746 	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
   749 	InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
   747 	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
   750 	InvalidateWindowClasses(WC_AIRCRAFT_LIST);
  2144 
  2147 
  2145 void Aircraft::Tick()
  2148 void Aircraft::Tick()
  2146 {
  2149 {
  2147 	if (!IsNormalAircraft(this)) return;
  2150 	if (!IsNormalAircraft(this)) return;
  2148 
  2151 
       
  2152 	if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
       
  2153 
  2149 	if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
  2154 	if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
  2150 
  2155 
  2151 	AgeAircraftCargo(this);
  2156 	AgeAircraftCargo(this);
  2152 
  2157 
  2153 	for (uint i = 0; i != 2; i++) {
  2158 	for (uint i = 0; i != 2; i++) {