train_cmd.c
changeset 715 83805642c830
parent 679 e959706a3e4d
child 737 ceb3dce50a37
equal deleted inserted replaced
714:e3b9eda8dc45 715:83805642c830
  2544 }
  2544 }
  2545 
  2545 
  2546 
  2546 
  2547 static const byte _depot_track_ind[4] = {0,1,0,1};
  2547 static const byte _depot_track_ind[4] = {0,1,0,1};
  2548 
  2548 
       
  2549 // Validation for the news item "Train is waiting in depot"
       
  2550 bool ValidateTrainInDepot( uint data_a, uint data_b )
       
  2551 {
       
  2552 	Vehicle *v = &_vehicles[data_a];
       
  2553 	if (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED))
       
  2554 		return true;
       
  2555 	else
       
  2556 		return false;
       
  2557 }
       
  2558 
  2549 void TrainEnterDepot(Vehicle *v, uint tile)
  2559 void TrainEnterDepot(Vehicle *v, uint tile)
  2550 {
  2560 {
  2551 	SetSignalsOnBothDir(tile, _depot_track_ind[_map5[tile]&3]);
  2561 	SetSignalsOnBothDir(tile, _depot_track_ind[_map5[tile]&3]);
  2552 
  2562 
  2553 	if (v->subtype != 0)
  2563 	if (v->subtype != 0)
  2578 			v->cur_order_index++;
  2588 			v->cur_order_index++;
  2579 		} else if (t.flags & OF_FULL_LOAD) { // User initiated?
  2589 		} else if (t.flags & OF_FULL_LOAD) { // User initiated?
  2580 			v->vehstatus |= VS_STOPPED;
  2590 			v->vehstatus |= VS_STOPPED;
  2581 			if (v->owner == _local_player) {
  2591 			if (v->owner == _local_player) {
  2582 				SetDParam(0, v->unitnumber);
  2592 				SetDParam(0, v->unitnumber);
  2583 				AddNewsItem(
  2593 				AddValidatedNewsItem(
  2584 					STR_8814_TRAIN_IS_WAITING_IN_DEPOT,
  2594 					STR_8814_TRAIN_IS_WAITING_IN_DEPOT,
  2585 					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
  2595 					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
  2586 					v->index,
  2596 					v->index,
  2587 					0);
  2597 					0,
       
  2598 					ValidateTrainInDepot);
  2588 			}
  2599 			}
  2589 		}
  2600 		}
  2590 	}
  2601 	}
  2591 }
  2602 }
  2592 
  2603