File diff r8555:63e19bfda16e → r8556:c5860d29500d
src/train_cmd.cpp
Show inline comments
 
@@ -732,12 +732,13 @@ CommandCost CmdBuildRailVehicle(TileInde
 
			v->direction = DiagDirToDir(dir);
 
			v->tile = tile;
 
			v->owner = _current_player;
 
			v->x_pos = x;
 
			v->y_pos = y;
 
			v->z_pos = GetSlopeZ(x, y);
 
			v->running_ticks = 0;
 
			v->u.rail.track = TRACK_BIT_DEPOT;
 
			v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 
			v->spritenum = rvi->image_index;
 
			v->cargo_type = rvi->cargo_type;
 
			v->cargo_subtype = 0;
 
			v->cargo_cap = rvi->capacity;
 
@@ -3592,12 +3593,13 @@ void Train::Tick()
 
{
 
	if (_age_cargo_skip_counter == 0) this->cargo.AgeCargo();
 

	
 
	this->tick_counter++;
 

	
 
	if (IsFrontEngine(this)) {
 
		if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
 
		this->current_order_time++;
 

	
 
		TrainLocoHandler(this, false);
 

	
 
		/* make sure vehicle wasn't deleted. */
 
		if (this->type == VEH_TRAIN && IsFrontEngine(this))
 
@@ -3662,17 +3664,18 @@ void Train::OnNewDay()
 
		/* update destination */
 
		if (this->current_order.type == OT_GOTO_STATION) {
 
			TileIndex tile = GetStation(this->current_order.dest)->train_tile;
 
			if (tile != 0) this->dest_tile = tile;
 
		}
 

	
 
		if ((this->vehstatus & VS_STOPPED) == 0) {
 
		if (this->running_ticks != 0) {
 
			/* running costs */
 
			CommandCost cost(EXPENSES_TRAIN_RUN, this->GetRunningCost() / 364);
 

	
 
			this->profit_this_year -= cost.GetCost() >> 8;
 
			CommandCost cost(EXPENSES_TRAIN_RUN, this->GetRunningCost() * this->running_ticks / (364 * DAY_TICKS));
 

	
 
			this->profit_this_year -= cost.GetCost();
 
			this->running_ticks = 0;
 

	
 
			SubtractMoneyFromPlayerFract(this->owner, cost);
 

	
 
			InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
 
			InvalidateWindowClasses(WC_TRAINS_LIST);
 
		}